From 3d469574e13392d036253fb6f89e48ba2b5f5601 Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Fri, 23 Oct 2015 18:09:14 +1300 Subject: [PATCH] comment fixes --- CRM/Event/BAO/Event.php | 20 ++++---- CRM/Logging/Schema.php | 56 ++++++++++++++-------- CRM/Member/Selector/Search.php | 19 ++++---- CRM/UF/Form/Inline/Preview.php | 7 --- CRM/Utils/API/AbstractFieldCoder.php | 16 +++++-- CRM/Utils/API/HTMLInputCoder.php | 5 +- CRM/Utils/API/MatchOption.php | 2 + CRM/Utils/Hook/UnitTests.php | 4 +- CRM/Utils/Hook/WordPress.php | 1 + CRM/Utils/SQL/Select.php | 2 + CRM/Utils/System.php | 43 +++++++++++++---- tests/phpunit/CRM/Utils/Cache/AllTests.php | 4 +- tests/phpunit/CRM/Utils/FileTest.php | 4 ++ 13 files changed, 121 insertions(+), 62 deletions(-) diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index cd8a27bb0b..cce8709032 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -47,7 +47,7 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { * @param array $defaults * (reference ) an assoc array to hold the flattened values. * - * @return CRM_Event_BAO_ManageEvent + * @return CRM_Event_DAO_Event */ public static function retrieve(&$params, &$defaults) { $event = new CRM_Event_DAO_Event(); @@ -80,8 +80,7 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { * @param array $params * Reference array contains the values submitted by the form. * - * - * @return object + * @return CRM_Event_DAO_Event */ public static function add(&$params) { CRM_Utils_System::flushCache(); @@ -228,7 +227,6 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { * Location block id to be deleted. * @param int $eventId * Event with which loc block is associated. - * */ public static function deleteEventLocBlock($locBlockId, $eventId = NULL) { $query = "SELECT count(ce.id) FROM civicrm_event ce WHERE ce.loc_block_id = $locBlockId"; @@ -597,7 +595,6 @@ $event_summary_limit * @param bool $role consider counted( is filter role) participant. * Consider counted( is filter role) participant. * - * * @return array * array with count of participants for each event based on status/role */ @@ -1035,7 +1032,7 @@ WHERE civicrm_event.is_active = 1 * * @param int $id * - * @return + * @return bool */ public static function isMonetary($id) { static $isMonetary = array(); @@ -1256,17 +1253,18 @@ WHERE civicrm_event.is_active = 1 } /** - * Add the custom fields OR array of participant's - * profile info + * Add the custom fields OR array of participant's profile info. * * @param int $id * @param string $name * @param int $cid - * @param $template + * @param string $template * @param int $participantId - * @param $isTest + * @param bool $isTest * @param bool $isCustomProfile * @param array $participantParams + * + * @return array|null */ public static function buildCustomDisplay( $id, @@ -1713,7 +1711,7 @@ WHERE id = $cfID } /** - * Build the array for Additional participant's information array of priamry and additional Ids + * Build the array for Additional participant's information array of primary and additional Ids. * * @param int $participantId * Id of Primary participant. diff --git a/CRM/Logging/Schema.php b/CRM/Logging/Schema.php index 0725ae270b..0861dd4689 100644 --- a/CRM/Logging/Schema.php +++ b/CRM/Logging/Schema.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ class CRM_Logging_Schema { private $logs = array(); @@ -53,10 +51,11 @@ class CRM_Logging_Schema { ); /** - * (Setting Callback - Validate) + * Setting Callback - Validate. * * @param mixed $value * @param array $fieldSpec + * * @return bool * @throws API_Exception */ @@ -70,7 +69,8 @@ class CRM_Logging_Schema { } /** - * (Setting Callback - On Change) + * Setting Callback - On Change. + * * Respond to changes in the "logging" setting. Set up or destroy * triggers, etal. * @@ -118,7 +118,8 @@ AND TABLE_NAME LIKE 'civicrm_%' $this->tables = preg_grep('/_cache$/', $this->tables, PREG_GREP_INVERT); $this->tables = preg_grep('/_log/', $this->tables, PREG_GREP_INVERT); $this->tables = preg_grep('/^civicrm_queue_/', $this->tables, PREG_GREP_INVERT); - $this->tables = preg_grep('/^civicrm_menu/', $this->tables, PREG_GREP_INVERT); //CRM-14672 + //CRM-14672 + $this->tables = preg_grep('/^civicrm_menu/', $this->tables, PREG_GREP_INVERT); $this->tables = preg_grep('/_temp_/', $this->tables, PREG_GREP_INVERT); // do not log civicrm_mailing_event* tables, CRM-12300 @@ -234,9 +235,7 @@ AND TABLE_NAME LIKE 'log_civicrm_%' } /** - * Enable sitewide logging. - * - * @return void + * Enable site-wide logging. */ public function enableLogging() { $this->fixSchemaDifferences(TRUE); @@ -247,8 +246,6 @@ AND TABLE_NAME LIKE 'log_civicrm_%' * Sync log tables and rebuild triggers. * * @param bool $enableLogging : Ensure logging is enabled - * - * @return void */ public function fixSchemaDifferences($enableLogging = FALSE) { $config = CRM_Core_Config::singleton(); @@ -272,7 +269,7 @@ AND TABLE_NAME LIKE 'log_civicrm_%' * @param bool $rebuildTrigger * should we rebuild the triggers. * - * @return void + * @return bool */ public function fixSchemaDifferencesFor($table, $cols = array(), $rebuildTrigger = FALSE) { if (empty($table)) { @@ -316,7 +313,9 @@ AND TABLE_NAME LIKE 'log_civicrm_%' } /** - * @param $table + * Get query table. + * + * @param string $table * * @return array */ @@ -328,8 +327,10 @@ AND TABLE_NAME LIKE 'log_civicrm_%' } /** - * @param $col - * @param $createQuery + * Get column query. + * + * @param string $col + * @param bool $createQuery * * @return array|mixed|string */ @@ -342,6 +343,8 @@ AND TABLE_NAME LIKE 'log_civicrm_%' } /** + * Fix schema differences. + * * @param bool $rebuildTrigger */ public function fixSchemaDifferencesForAll($rebuildTrigger = FALSE) { @@ -366,11 +369,13 @@ AND TABLE_NAME LIKE 'log_civicrm_%' } /** + * Fix timestamp. + * * Log_civicrm_contact.modified_date for example would always be copied from civicrm_contact.modified_date, * so there's no need for a default timestamp and therefore we remove such default timestamps * also eliminate the NOT NULL constraint, since we always copy and schema can change down the road) * - * @param $query + * @param string $query * * @return mixed */ @@ -382,6 +387,9 @@ AND TABLE_NAME LIKE 'log_civicrm_%' return $query; } + /** + * Add reports. + */ private function addReports() { $titles = array( 'logging/contact/detail' => ts('Logging Details'), @@ -414,7 +422,7 @@ AND TABLE_NAME LIKE 'log_civicrm_%' /** * Get an array of column names of the given table. * - * @param string$table + * @param string $table * @param bool $force * * @return array @@ -484,8 +492,10 @@ WHERE table_schema IN ('{$this->db}', '{$civiDB}')"; } /** - * @param $civiTable - * @param $logTable + * Get columns that have changed. + * + * @param string $civiTable + * @param string $logTable * * @return array */ @@ -588,6 +598,9 @@ COLS; $this->logs[$table] = "log_$table"; } + /** + * Delete reports. + */ private function deleteReports() { // disable logging templates CRM_Core_DAO::executeQuery(" @@ -635,7 +648,9 @@ COLS; } /** - * @param $info + * Get trigger info. + * + * @param array $info * @param null $tableName * @param bool $force */ @@ -724,10 +739,11 @@ COLS; } /** + * Disable logging temporarily. + * * This allow logging to be temporarily disabled for certain cases * where we want to do a mass cleanup but dont want to bother with * an audit trail - * */ public static function disableLoggingForThisConnection() { // do this only if logging is enabled diff --git a/CRM/Member/Selector/Search.php b/CRM/Member/Selector/Search.php index 9bb9f496bb..6bfb3a6a58 100644 --- a/CRM/Member/Selector/Search.php +++ b/CRM/Member/Selector/Search.php @@ -29,15 +29,12 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** * This class is used to retrieve and display a range of * contacts that match the given criteria (specifically for * results of advanced search options. - * */ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_Core_Selector_API { @@ -176,13 +173,14 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C /** * This method returns the links that are given for each search row. - * currently the links added for each row are + * + * Currently the links added for each row are * * - View * - Edit * * @param string $status - * @param null $isPaymentProcessor + * @param bool $isPaymentProcessor * @param null $accessContribution * @param null $qfKey * @param null $context @@ -270,7 +268,7 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C /** * Getter for array of the parameters required for creating pager. * - * @param $action + * @param int $action * @param array $params */ public function getPagerParams($action, &$params) { @@ -290,7 +288,7 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C /** * Returns total number of rows for the query. * - * @param int $action. + * @param int $action * * @return int * Total number of rows @@ -472,7 +470,8 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C } /** - * Returns the column headers as an array of tuples: + * Returns the column headers as an array of tuples. + * * (name, sortName (key to the sort array)) * * @param string $action @@ -538,6 +537,8 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C } /** + * Alphabet query. + * * @return mixed */ public function alphabetQuery() { @@ -545,6 +546,8 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C } /** + * Get query. + * * @return string */ public function &getQuery() { diff --git a/CRM/UF/Form/Inline/Preview.php b/CRM/UF/Form/Inline/Preview.php index a8982fc09e..07e3b64457 100644 --- a/CRM/UF/Form/Inline/Preview.php +++ b/CRM/UF/Form/Inline/Preview.php @@ -29,14 +29,11 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 - * $Id$ - * */ /** * This class generates form components * for previewing Civicrm Profile Group - * */ class CRM_UF_Form_Inline_Preview extends CRM_UF_Form_AbstractPreview { @@ -44,10 +41,6 @@ class CRM_UF_Form_Inline_Preview extends CRM_UF_Form_AbstractPreview { * Pre processing work done here. * * gets session variables for group or field id - * - * @param - * - * @return void */ public function preProcess() { if ($_SERVER['REQUEST_METHOD'] != 'POST') { diff --git a/CRM/Utils/API/AbstractFieldCoder.php b/CRM/Utils/API/AbstractFieldCoder.php index 2101844d1d..7108fbab85 100644 --- a/CRM/Utils/API/AbstractFieldCoder.php +++ b/CRM/Utils/API/AbstractFieldCoder.php @@ -36,18 +36,23 @@ require_once 'api/Wrapper.php'; /** - * Class CRM_Utils_API_AbstractFieldCoder + * Class CRM_Utils_API_AbstractFieldCoder. */ abstract class CRM_Utils_API_AbstractFieldCoder implements API_Wrapper { /** - * @return array list of field names + * Get skipped fields. + * + * @return array + * List of field names */ public function getSkipFields() { return NULL; } /** + * Is field skipped. + * * @param string $fldName * @return bool * TRUE if encoding should be skipped for this field @@ -77,15 +82,16 @@ abstract class CRM_Utils_API_AbstractFieldCoder implements API_Wrapper { } /** - * going to filter the - * submitted values. + * Going to filter the submitted values. * * @param array|string $values the field value from the API */ public abstract function encodeInput(&$values); /** - * @param $values + * Decode output. + * + * @param string $values * * @return mixed */ diff --git a/CRM/Utils/API/HTMLInputCoder.php b/CRM/Utils/API/HTMLInputCoder.php index 309ddf6829..c7534415a2 100644 --- a/CRM/Utils/API/HTMLInputCoder.php +++ b/CRM/Utils/API/HTMLInputCoder.php @@ -56,7 +56,10 @@ class CRM_Utils_API_HTMLInputCoder extends CRM_Utils_API_AbstractFieldCoder { } /** - * @return array list of field names + * Get skipped fields. + * + * @return array + * list of field names */ public function getSkipFields() { if ($this->skipFields === NULL) { diff --git a/CRM/Utils/API/MatchOption.php b/CRM/Utils/API/MatchOption.php index d1549668d1..43f5a57ee6 100644 --- a/CRM/Utils/API/MatchOption.php +++ b/CRM/Utils/API/MatchOption.php @@ -65,6 +65,8 @@ class CRM_Utils_API_MatchOption implements API_Wrapper { private static $_singleton = NULL; /** + * Singleton function. + * * @return CRM_Utils_API_MatchOption */ public static function singleton() { diff --git a/CRM/Utils/Hook/UnitTests.php b/CRM/Utils/Hook/UnitTests.php index 60a03581eb..5105476d04 100644 --- a/CRM/Utils/Hook/UnitTests.php +++ b/CRM/Utils/Hook/UnitTests.php @@ -49,8 +49,10 @@ class CRM_Utils_Hook_UnitTests extends CRM_Utils_Hook { } /** - * Use a unit-testing mock object to handle hook invocations + * Use a unit-testing mock object to handle hook invocations. + * * e.g. hook_civicrm_foo === $mockObject->foo() + * * @param object $mockObject */ public function setMock($mockObject) { diff --git a/CRM/Utils/Hook/WordPress.php b/CRM/Utils/Hook/WordPress.php index 765830560f..f92dcc8b7c 100644 --- a/CRM/Utils/Hook/WordPress.php +++ b/CRM/Utils/Hook/WordPress.php @@ -163,6 +163,7 @@ class CRM_Utils_Hook_WordPress extends CRM_Utils_Hook { /** * Build the list of plugins ("modules" in CiviCRM terminology) to be processed for hooks. + * * We need to do this to preserve the CiviCRM hook signatures for hooks that require * a return value, since the WordPress Plugin API seems to be incompatible with them. * diff --git a/CRM/Utils/SQL/Select.php b/CRM/Utils/SQL/Select.php index 70c9f32fc8..f7e1777e64 100644 --- a/CRM/Utils/SQL/Select.php +++ b/CRM/Utils/SQL/Select.php @@ -145,6 +145,8 @@ class CRM_Utils_SQL_Select implements ArrayAccess { } /** + * Merge something or other. + * * @param CRM_Utils_SQL_Select $other * @param array|NULL $parts * ex: 'joins', 'wheres' diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index f9071770d1..2ca8294c62 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -1111,7 +1111,7 @@ class CRM_Utils_System { } /** - * Gives the first two parts of the version string E.g. 6.1 + * Gives the first two parts of the version string E.g. 6.1. * * @return string */ @@ -1125,6 +1125,7 @@ class CRM_Utils_System { * * @param string $version * Version string to be checked. + * * @return bool */ public static function isVersionFormatValid($version) { @@ -1157,6 +1158,11 @@ class CRM_Utils_System { return $headers; } + /** + * Get request headers. + * + * @return array|false + */ public static function getRequestHeaders() { if (function_exists('apache_request_headers')) { return apache_request_headers(); @@ -1179,6 +1185,13 @@ class CRM_Utils_System { strtolower($_SERVER['HTTPS']) != 'off') ? TRUE : FALSE; } + /** + * Redirect to SSL. + * + * @param bool|FALSE $abort + * + * @throws \Exception + */ public static function redirectToSSL($abort = FALSE) { $config = CRM_Core_Config::singleton(); $req_headers = self::getRequestHeaders(); @@ -1488,7 +1501,7 @@ class CRM_Utils_System { * @param bool $loadUser * Boolean load user or not. * @param bool $throwError - * @param $realPath + * @param string $realPath */ public static function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) { if (!is_array($params)) { @@ -1569,6 +1582,7 @@ class CRM_Utils_System { * Given a URL, return a relative URL if possible. * * @param string $url + * * @return string */ public static function relativeURL($url) { @@ -1617,7 +1631,7 @@ class CRM_Utils_System { } /** - * Clean url, replaces first '&' with '?' + * Clean url, replaces first '&' with '?'. * * @param string $url * @@ -1657,8 +1671,9 @@ class CRM_Utils_System { } /** - * Append the contents of an 'extra' smarty template file if it is present in - * the custom template directory. This does not work if there are + * Append the contents of an 'extra' smarty template file. + * + * It must be present in the custom template directory. This does not work if there are * multiple custom template directories * * @param string $fileName @@ -1688,8 +1703,9 @@ class CRM_Utils_System { } /** - * Get a list of all files that are found within the directories - * that are the result of appending the provided relative path to + * Get a list of all files that are found within the directories. + * + * Files must be the result of appending the provided relative path to * each component of the PHP include path. * * @author Ken Zalewski @@ -1721,7 +1737,9 @@ class CRM_Utils_System { } /** - * Get a list of all "plugins" (PHP classes that implement a piece of + * Get a list of all "plugins". + * + * (PHP classes that implement a piece of * functionality using a well-defined interface) that are found in a * particular CiviCRM directory (both custom and core are searched). * @@ -1755,6 +1773,9 @@ class CRM_Utils_System { return $plugins; } + /** + * Execute scheduled jobs. + */ public static function executeScheduledJobs() { $facility = new CRM_Core_JobManager(); $facility->execute(FALSE); @@ -1772,6 +1793,7 @@ class CRM_Utils_System { * Evaluate any tokens in a URL. * * @param string|FALSE $url + * * @return string|FALSE */ public static function evalUrl($url) { @@ -1825,6 +1847,8 @@ class CRM_Utils_System { } /** + * Is in upgrade mode. + * * @return bool */ public static function isInUpgradeMode() { @@ -1849,6 +1873,7 @@ class CRM_Utils_System { * - action: int, CRM_Core_Action::UPDATE or CRM_Core_Action::VIEW [default: VIEW] * - entity_table: string, eg "civicrm_contact" * - entity_id: int + * * @return array|NULL * NULL if unavailable, or an array. array has keys: * - path: string @@ -1891,6 +1916,8 @@ class CRM_Utils_System { } /** + * Set http header. + * * @param string $name * @param string $value */ diff --git a/tests/phpunit/CRM/Utils/Cache/AllTests.php b/tests/phpunit/CRM/Utils/Cache/AllTests.php index 7c092bbef8..bb523abcf5 100644 --- a/tests/phpunit/CRM/Utils/Cache/AllTests.php +++ b/tests/phpunit/CRM/Utils/Cache/AllTests.php @@ -1,6 +1,8 @@