From 8246bca46f06d6d5af8cbb5736848f11e8d3eb18 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 10 Jan 2017 13:14:52 +1300 Subject: [PATCH] Add comment blocks --- CRM/Activity/Tokens.php | 3 ++ CRM/Admin/Form/Setting/Localization.php | 2 ++ CRM/Campaign/Form/Search.php | 6 +++- CRM/Case/Form/Task/PDF.php | 5 +++ CRM/Core/CodeGen/Reflection.php | 10 ++++++ CRM/Core/CodeGen/Util/Template.php | 9 ++++++ CRM/Core/Config/MagicMerge.php | 39 ++++++++++++++++++++++ CRM/Core/DAO/AllCoreTables.php | 43 +++++++++++++++++++++---- CRM/Core/Error/Log.php | 3 ++ CRM/Core/Page/AJAX.php | 10 ++++++ CRM/Core/Page/File.php | 3 ++ CRM/Core/Payment/eWAY.php | 3 ++ CRM/Event/Tokens.php | 5 +++ CRM/Extension/Manager/Report.php | 3 ++ CRM/Extension/Manager/Search.php | 3 ++ CRM/Financial/Page/Batch.php | 3 ++ CRM/Logging/Reverter.php | 5 +++ CRM/Mailing/Tokens.php | 8 +++++ CRM/Utils/File.php | 15 +++++++-- CRM/Utils/PDF/Document.php | 5 +++ CRM/Utils/System/Backdrop.php | 5 +++ CRM/Utils/System/Base.php | 10 ++++++ CRM/Utils/System/Drupal6.php | 5 +++ xml/templates/civicrm_version.tpl | 6 ++-- 24 files changed, 198 insertions(+), 11 deletions(-) diff --git a/CRM/Activity/Tokens.php b/CRM/Activity/Tokens.php index 990e2af549..ed487e2f11 100644 --- a/CRM/Activity/Tokens.php +++ b/CRM/Activity/Tokens.php @@ -45,6 +45,9 @@ */ class CRM_Activity_Tokens extends \Civi\Token\AbstractTokenSubscriber { + /** + * CRM_Activity_Tokens constructor. + */ public function __construct() { parent::__construct('activity', array( 'activity_id' => ts('Activity ID'), diff --git a/CRM/Admin/Form/Setting/Localization.php b/CRM/Admin/Form/Setting/Localization.php index 6101fd33b7..bb7b40d87e 100644 --- a/CRM/Admin/Form/Setting/Localization.php +++ b/CRM/Admin/Form/Setting/Localization.php @@ -277,6 +277,8 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { } /** + * Get the default locale options. + * * @return array */ public static function getDefaultLocaleOptions() { diff --git a/CRM/Campaign/Form/Search.php b/CRM/Campaign/Form/Search.php index 67084701bb..da3d9fafbc 100644 --- a/CRM/Campaign/Form/Search.php +++ b/CRM/Campaign/Form/Search.php @@ -175,8 +175,12 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search { CRM_Utils_System::setTitle(ts('Find Respondents To %1', array(1 => ucfirst($this->_operation)))); } + /** + * Load the default survey for all actions. + * + * @return array + */ public function setDefaultValues() { - //load the default survey for all actions. if (empty($this->_defaults)) { $defaultSurveyId = key(CRM_Campaign_BAO_Survey::getSurveys(TRUE, TRUE)); if ($defaultSurveyId) { diff --git a/CRM/Case/Form/Task/PDF.php b/CRM/Case/Form/Task/PDF.php index 42cbfc8033..0a2434bc58 100644 --- a/CRM/Case/Form/Task/PDF.php +++ b/CRM/Case/Form/Task/PDF.php @@ -56,6 +56,11 @@ class CRM_Case_Form_Task_PDF extends CRM_Case_Form_Task { CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this); } + /** + * Set defaults for the pdf. + * + * @return array + */ public function setDefaultValues() { return CRM_Contact_Form_Task_PDFLetterCommon::setDefaultValues(); } diff --git a/CRM/Core/CodeGen/Reflection.php b/CRM/Core/CodeGen/Reflection.php index 8741e2a0cd..2b022ffefb 100644 --- a/CRM/Core/CodeGen/Reflection.php +++ b/CRM/Core/CodeGen/Reflection.php @@ -31,6 +31,9 @@ class CRM_Core_CodeGen_Reflection extends CRM_Core_CodeGen_BaseTask { } + /** + * Run generator. + */ public function run() { echo "Generating table list\n"; $template = new CRM_Core_CodeGen_Util_Template('php'); @@ -55,12 +58,19 @@ class CRM_Core_CodeGen_Reflection extends CRM_Core_CodeGen_BaseTask { } /** + * Get absolute file name. + * * @return string */ protected function getAbsFileName() { return $this->config->CoreDAOCodePath . "AllCoreTables.data.php"; } + /** + * Get the checksum for the schema. + * + * @return string + */ protected function getSchemaChecksum() { if (!$this->checksum) { CRM_Utils_Array::flatten($this->tables, $flat); diff --git a/CRM/Core/CodeGen/Util/Template.php b/CRM/Core/CodeGen/Util/Template.php index 36af880bf6..b7d2bf0001 100644 --- a/CRM/Core/CodeGen/Util/Template.php +++ b/CRM/Core/CodeGen/Util/Template.php @@ -49,6 +49,8 @@ class CRM_Core_CodeGen_Util_Template { } /** + * Run template generator. + * * @param string $infile * Filename of the template, without a path. * @param string $outpath @@ -68,6 +70,13 @@ class CRM_Core_CodeGen_Util_Template { } } + /** + * Fetch via Smarty. + * + * @param string $infile + * + * @return string + */ public function fetch($infile) { return $this->smarty->fetch($infile); } diff --git a/CRM/Core/Config/MagicMerge.php b/CRM/Core/Config/MagicMerge.php index 2e02db292b..72fe7827ed 100644 --- a/CRM/Core/Config/MagicMerge.php +++ b/CRM/Core/Config/MagicMerge.php @@ -58,10 +58,16 @@ class CRM_Core_Config_MagicMerge { private $cache = array(); + /** + * CRM_Core_Config_MagicMerge constructor. + */ public function __construct() { $this->map = self::getPropertyMap(); } + /** + * Set the map to the property map. + */ public function __wakeup() { $this->map = self::getPropertyMap(); } @@ -204,6 +210,14 @@ class CRM_Core_Config_MagicMerge { ); } + /** + * Get value. + * + * @param string $k + * + * @return mixed + * @throws \CRM_Core_Exception + */ public function __get($k) { if (!isset($this->map[$k])) { throw new \CRM_Core_Exception("Cannot read unrecognized property CRM_Core_Config::\${$k}."); @@ -281,6 +295,14 @@ class CRM_Core_Config_MagicMerge { } } + /** + * Set value. + * + * @param string $k + * @param mixed $v + * + * @throws \CRM_Core_Exception + */ public function __set($k, $v) { if (!isset($this->map[$k])) { throw new \CRM_Core_Exception("Cannot set unrecognized property CRM_Core_Config::\${$k}"); @@ -311,10 +333,24 @@ class CRM_Core_Config_MagicMerge { } } + /** + * Is value set. + * + * @param string $k + * + * @return bool + */ public function __isset($k) { return isset($this->map[$k]); } + /** + * Unset value. + * + * @param string $k + * + * @throws \CRM_Core_Exception + */ public function __unset($k) { if (!isset($this->map[$k])) { throw new \CRM_Core_Exception("Cannot unset unrecognized property CRM_Core_Config::\${$k}"); @@ -358,6 +394,9 @@ class CRM_Core_Config_MagicMerge { return $this->settings; } + /** + * Initialise local settings. + */ private function initLocals() { if ($this->locals === NULL) { $this->locals = array( diff --git a/CRM/Core/DAO/AllCoreTables.php b/CRM/Core/DAO/AllCoreTables.php index edbfd1efc6..31987ffa43 100644 --- a/CRM/Core/DAO/AllCoreTables.php +++ b/CRM/Core/DAO/AllCoreTables.php @@ -30,8 +30,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2017 - * $Id$ - * */ class CRM_Core_DAO_AllCoreTables { @@ -39,6 +37,11 @@ class CRM_Core_DAO_AllCoreTables { private static $daoToClass = NULL; private static $entityTypes = NULL; + /** + * Initialise. + * + * @param bool $fresh + */ public static function init($fresh = FALSE) { static $init = FALSE; if ($init && !$fresh) { @@ -68,6 +71,12 @@ class CRM_Core_DAO_AllCoreTables { /** * (Quasi-Private) Do not call externally (except for unit-testing) + * + * @param string $daoName + * @param string $className + * @param string $tableName + * @param string $fields_callback + * @param string $links_callback */ public static function registerEntityType($daoName, $className, $tableName, $fields_callback = NULL, $links_callback = NULL) { self::$daoToClass[$daoName] = $className; @@ -128,11 +137,20 @@ class CRM_Core_DAO_AllCoreTables { return FALSE !== array_search($tableName, self::tables()); } + /** + * Get the DAO for the class. + * + * @param string $className + * + * @return string + */ public static function getCanonicalClassName($className) { return str_replace('_BAO_', '_DAO_', $className); } /** + * Get a list of all DAO classes. + * * @return array * List of class names. */ @@ -140,6 +158,12 @@ class CRM_Core_DAO_AllCoreTables { return array_values(self::daoToClass()); } + /** + * Get the classname for the table. + * + * @param string $tableName + * @return string + */ public static function getClassForTable($tableName) { //CRM-19677: on multilingual setup, trim locale from $tableName to fetch class name if (CRM_Core_I18n::isMultilingual()) { @@ -182,6 +206,11 @@ class CRM_Core_DAO_AllCoreTables { self::tables()); } + /** + * Reinitialise cache. + * + * @param bool $fresh + */ public static function reinitializeCache($fresh = FALSE) { self::init($fresh); } @@ -206,11 +235,12 @@ class CRM_Core_DAO_AllCoreTables { $exports = array(); $fields = $dao::fields(); - foreach($fields as $name => $field) { + foreach ($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { $exports[$labelName] = & $fields[$name]; - } else { + } + else { $exports[$name] = & $fields[$name]; } } @@ -245,11 +275,12 @@ class CRM_Core_DAO_AllCoreTables { $imports = array(); $fields = $dao::fields(); - foreach($fields as $name => $field) { + foreach ($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { $imports[$labelName] = & $fields[$name]; - } else { + } + else { $imports[$name] = & $fields[$name]; } } diff --git a/CRM/Core/Error/Log.php b/CRM/Core/Error/Log.php index 3e301981a1..80a28cba02 100644 --- a/CRM/Core/Error/Log.php +++ b/CRM/Core/Error/Log.php @@ -33,6 +33,9 @@ */ class CRM_Core_Error_Log extends \Psr\Log\AbstractLogger { + /** + * CRM_Core_Error_Log constructor. + */ public function __construct() { $this->map = array( \Psr\Log\LogLevel::DEBUG => PEAR_LOG_DEBUG, diff --git a/CRM/Core/Page/AJAX.php b/CRM/Core/Page/AJAX.php index 8d6add8e28..f52b7a0f31 100644 --- a/CRM/Core/Page/AJAX.php +++ b/CRM/Core/Page/AJAX.php @@ -214,6 +214,16 @@ class CRM_Core_Page_AJAX { CRM_Utils_System::setHttpHeader('Cache-Control', "max-age=$ttl, public"); } + /** + * Set defaults for sort and pager. + * + * @param int $defaultOffset + * @param int $defaultRowCount + * @param string $defaultSort + * @param string $defaultsortOrder + * + * @return array + */ public static function defaultSortAndPagerParams($defaultOffset = 0, $defaultRowCount = 25, $defaultSort = NULL, $defaultsortOrder = 'asc') { $params = array( '_raw_values' => array(), diff --git a/CRM/Core/Page/File.php b/CRM/Core/Page/File.php index 98fc0fa142..a04428b603 100644 --- a/CRM/Core/Page/File.php +++ b/CRM/Core/Page/File.php @@ -34,6 +34,9 @@ */ class CRM_Core_Page_File extends CRM_Core_Page { + /** + * Run page. + */ public function run() { $fileName = CRM_Utils_Request::retrieve('filename', 'String', $this); $path = CRM_Core_Config::singleton()->customFileUploadDir . $fileName; diff --git a/CRM/Core/Payment/eWAY.php b/CRM/Core/Payment/eWAY.php index f1b4e73336..10be2be366 100644 --- a/CRM/Core/Payment/eWAY.php +++ b/CRM/Core/Payment/eWAY.php @@ -95,6 +95,9 @@ require_once 'eWAY/eWAY_GatewayRequest.php'; require_once 'eWAY/eWAY_GatewayResponse.php'; +/** + * Class CRM_Core_Payment_eWAY. + */ class CRM_Core_Payment_eWAY extends CRM_Core_Payment { # (not used, implicit in the API, might need to convert?) const CHARSET = 'UTF-8'; diff --git a/CRM/Event/Tokens.php b/CRM/Event/Tokens.php index 0f96ef0138..2a50255440 100644 --- a/CRM/Event/Tokens.php +++ b/CRM/Event/Tokens.php @@ -72,6 +72,11 @@ class CRM_Event_Tokens extends \Civi\Token\AbstractTokenSubscriber { && $processor->context['actionMapping']->getEntity() === 'civicrm_participant'; } + /** + * Alter action schedule query. + * + * @param \Civi\ActionSchedule\Event\MailingQueryEvent $e + */ public function alterActionScheduleQuery(\Civi\ActionSchedule\Event\MailingQueryEvent $e) { if ($e->mapping->getEntity() !== 'civicrm_participant') { return; diff --git a/CRM/Extension/Manager/Report.php b/CRM/Extension/Manager/Report.php index b7e579c13d..8f92b9a7cd 100644 --- a/CRM/Extension/Manager/Report.php +++ b/CRM/Extension/Manager/Report.php @@ -35,6 +35,9 @@ class CRM_Extension_Manager_Report extends CRM_Extension_Manager_Base { const REPORT_GROUP_NAME = 'report_template'; + /** + * CRM_Extension_Manager_Report constructor. + */ public function __construct() { parent::__construct(TRUE); $this->groupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', diff --git a/CRM/Extension/Manager/Search.php b/CRM/Extension/Manager/Search.php index 0735f41921..684d1027ca 100644 --- a/CRM/Extension/Manager/Search.php +++ b/CRM/Extension/Manager/Search.php @@ -35,6 +35,9 @@ class CRM_Extension_Manager_Search extends CRM_Extension_Manager_Base { const CUSTOM_SEARCH_GROUP_NAME = 'custom_search'; + /** + * CRM_Extension_Manager_Search constructor. + */ public function __construct() { parent::__construct(TRUE); $this->groupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', diff --git a/CRM/Financial/Page/Batch.php b/CRM/Financial/Page/Batch.php index 05741098cd..58126d73d6 100644 --- a/CRM/Financial/Page/Batch.php +++ b/CRM/Financial/Page/Batch.php @@ -53,6 +53,9 @@ class CRM_Financial_Page_Batch extends CRM_Core_Page_Basic { return 'CRM_Batch_BAO_Batch'; } + /** + * Get links. + */ public function &links() { } diff --git a/CRM/Logging/Reverter.php b/CRM/Logging/Reverter.php index 79ffb51a9f..7d838dc641 100644 --- a/CRM/Logging/Reverter.php +++ b/CRM/Logging/Reverter.php @@ -66,6 +66,11 @@ class CRM_Logging_Reverter { $this->diffs = $differ->diffsInTables($tables); } + /** + * Setter for diffs. + * + * @param array $diffs + */ public function setDiffs($diffs) { $this->diffs = $diffs; } diff --git a/CRM/Mailing/Tokens.php b/CRM/Mailing/Tokens.php index 1c777ae05b..53271bc3ef 100644 --- a/CRM/Mailing/Tokens.php +++ b/CRM/Mailing/Tokens.php @@ -64,6 +64,14 @@ class CRM_Mailing_Tokens extends \Civi\Token\AbstractTokenSubscriber { return !empty($processor->context['mailingId']) || !empty($processor->context['mailing']); } + /** + * Prefetch tokens. + * + * @param \Civi\Token\Event\TokenValueEvent $e + * + * @return array + * @throws \Exception + */ public function prefetch(\Civi\Token\Event\TokenValueEvent $e) { $processor = $e->getTokenProcessor(); $mailing = isset($processor->context['mailing']) diff --git a/CRM/Utils/File.php b/CRM/Utils/File.php index 18ad0ff799..a465f9fedb 100644 --- a/CRM/Utils/File.php +++ b/CRM/Utils/File.php @@ -438,6 +438,8 @@ class CRM_Utils_File { } /** + * Make a valid file name. + * * @param string $name * * @return string @@ -460,8 +462,10 @@ class CRM_Utils_File { } /** - * @param $path - * @param $ext + * Get files for the extension. + * + * @param string $path + * @param string $ext * * @return array */ @@ -801,6 +805,13 @@ HTACCESS; return TRUE; } + /** + * Format file. + * + * @param array $param + * @param string $fileName + * @param array $extraParams + */ public static function formatFile(&$param, $fileName, $extraParams = array()) { if (empty($param[$fileName])) { return; diff --git a/CRM/Utils/PDF/Document.php b/CRM/Utils/PDF/Document.php index 89a0ad8322..ff98f858b7 100644 --- a/CRM/Utils/PDF/Document.php +++ b/CRM/Utils/PDF/Document.php @@ -33,6 +33,9 @@ require_once 'TbsZip/tbszip.php'; +/** + * Class CRM_Utils_PDF_Document. + */ class CRM_Utils_PDF_Document { public static $ooxmlMap = array( @@ -51,6 +54,8 @@ class CRM_Utils_PDF_Document { ); /** + * Convert html to a Doc file. + * * @param array $pages * @param string $fileName * @param array|int $format diff --git a/CRM/Utils/System/Backdrop.php b/CRM/Utils/System/Backdrop.php index 34669975db..88ab5c4386 100644 --- a/CRM/Utils/System/Backdrop.php +++ b/CRM/Utils/System/Backdrop.php @@ -288,6 +288,11 @@ class CRM_Utils_System_Backdrop extends CRM_Utils_System_DrupalBase { $base_url = str_replace('http://', 'https://', $base_url); } + /** + * Get the name of the table that stores the user details. + * + * @return string + */ protected function getUsersTableName() { $userFrameworkUsersTableName = Civi::settings()->get('userFrameworkUsersTableName'); if (empty($userFrameworkUsersTableName)) { diff --git a/CRM/Utils/System/Base.php b/CRM/Utils/System/Base.php index 652a0f5baf..a66fba129e 100644 --- a/CRM/Utils/System/Base.php +++ b/CRM/Utils/System/Base.php @@ -287,6 +287,11 @@ abstract class CRM_Utils_System_Base { return 'left'; } + /** + * Get the absolute path to the site's base url. + * + * @return bool|mixed|string + */ public function getAbsoluteBaseURL() { if (!defined('CIVICRM_UF_BASEURL')) { return FALSE; @@ -304,6 +309,11 @@ abstract class CRM_Utils_System_Base { return $url; } + /** + * Get the relative path to the sites base url. + * + * @return bool + */ public function getRelativeBaseURL() { $absoluteBaseURL = $this->getAbsoluteBaseURL(); if ($absoluteBaseURL === FALSE) { diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index 8cd0f30763..54a3d0c007 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -288,6 +288,11 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase { $base_url = str_replace('http://', 'https://', $base_url); } + /** + * Get the name of the table that stores the user details. + * + * @return string + */ protected function getUsersTableName() { $userFrameworkUsersTableName = Civi::settings()->get('userFrameworkUsersTableName'); if (empty($userFrameworkUsersTableName)) { diff --git a/xml/templates/civicrm_version.tpl b/xml/templates/civicrm_version.tpl index a6778a2b44..93a062ea78 100644 --- a/xml/templates/civicrm_version.tpl +++ b/xml/templates/civicrm_version.tpl @@ -1,10 +1,12 @@ '{$db_version}', 'cms' => '{$cms}', - 'revision' => '{$svnrevision}' ); + 'revision' => '{$svnrevision}', ); {rdelim} -- 2.25.1