From cd5823ae452708e6d0a5fb899b2c3eb3f63be640 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 2 Feb 2015 10:27:57 +1300 Subject: [PATCH] add a few comment blocks --- CRM/Case/BAO/CaseType.php | 8 ++++++++ CRM/Case/ManagedEntities.php | 3 +++ CRM/Contact/Form/Search/Custom/DateAdded.php | 8 ++++++++ .../Search/Custom/FullText/AbstractPartialQuery.php | 2 ++ CRM/Contact/Form/Search/Custom/FullText/Activity.php | 6 ++++++ CRM/Contact/Form/Search/Custom/FullText/Case.php | 3 +++ CRM/Contact/Form/Search/Custom/FullText/Contact.php | 3 +++ .../Form/Search/Custom/FullText/Contribution.php | 3 +++ .../Form/Search/Custom/FullText/Membership.php | 3 +++ api/v3/Acl.php | 12 +++--------- api/v3/Generic/Getactions.php | 2 ++ api/v3/Generic/Update.php | 4 +++- api/v3/Im.php | 12 +++++------- api/v3/Job.php | 2 +- api/v3/utils.php | 2 ++ bin/cli.class.php | 9 ++++++++- tests/phpunit/CRM/Utils/QueryFormatterTest.php | 5 +++++ 17 files changed, 68 insertions(+), 19 deletions(-) diff --git a/CRM/Case/BAO/CaseType.php b/CRM/Case/BAO/CaseType.php index 3a787eee87..f8f601f36b 100644 --- a/CRM/Case/BAO/CaseType.php +++ b/CRM/Case/BAO/CaseType.php @@ -86,6 +86,14 @@ class CRM_Case_BAO_CaseType extends CRM_Case_DAO_CaseType { return $caseTypeDAO->save(); } + /** + * Generate and assign an arbitrary value to a field of a test object. + * + * @param string $fieldName + * @param array $fieldDef + * @param int $counter + * The globally-unique ID of the test object. + */ protected function assignTestValue($fieldName, &$fieldDef, $counter) { if ($fieldName == 'definition') { $this->{$fieldName} = "TestCaseType{$counter}"; diff --git a/CRM/Case/ManagedEntities.php b/CRM/Case/ManagedEntities.php index ae9906b7d0..4cef93581c 100644 --- a/CRM/Case/ManagedEntities.php +++ b/CRM/Case/ManagedEntities.php @@ -1,5 +1,8 @@ all($offset, $rowcount, $sort, FALSE, TRUE); } diff --git a/CRM/Contact/Form/Search/Custom/FullText/AbstractPartialQuery.php b/CRM/Contact/Form/Search/Custom/FullText/AbstractPartialQuery.php index 9d2ecd4141..a1cdfa8fd1 100644 --- a/CRM/Contact/Form/Search/Custom/FullText/AbstractPartialQuery.php +++ b/CRM/Contact/Form/Search/Custom/FullText/AbstractPartialQuery.php @@ -45,6 +45,8 @@ abstract class CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery { protected $label; /** + * Class constructor. + * * @param string $name * @param string $label */ diff --git a/CRM/Contact/Form/Search/Custom/FullText/Activity.php b/CRM/Contact/Form/Search/Custom/FullText/Activity.php index f45da6be62..a8e122111f 100644 --- a/CRM/Contact/Form/Search/Custom/FullText/Activity.php +++ b/CRM/Contact/Form/Search/Custom/FullText/Activity.php @@ -34,10 +34,16 @@ */ class CRM_Contact_Form_Search_Custom_FullText_Activity extends CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery { + /** + * Class constructor. + */ public function __construct() { parent::__construct('Activity', ts('Activities')); } + /** + * @return bool + */ public function isActive() { return CRM_Core_Permission::check('view all activities'); } diff --git a/CRM/Contact/Form/Search/Custom/FullText/Case.php b/CRM/Contact/Form/Search/Custom/FullText/Case.php index 29dd5f0dc9..a291ce5065 100644 --- a/CRM/Contact/Form/Search/Custom/FullText/Case.php +++ b/CRM/Contact/Form/Search/Custom/FullText/Case.php @@ -38,6 +38,9 @@ class CRM_Contact_Form_Search_Custom_FullText_Case extends CRM_Contact_Form_Sear parent::__construct('Case', ts('Cases')); } + /** + * @return bool + */ public function isActive() { $config = CRM_Core_Config::singleton(); return in_array('CiviCase', $config->enableComponents); diff --git a/CRM/Contact/Form/Search/Custom/FullText/Contact.php b/CRM/Contact/Form/Search/Custom/FullText/Contact.php index f9290c8767..85631655e7 100644 --- a/CRM/Contact/Form/Search/Custom/FullText/Contact.php +++ b/CRM/Contact/Form/Search/Custom/FullText/Contact.php @@ -41,6 +41,9 @@ class CRM_Contact_Form_Search_Custom_FullText_Contact extends CRM_Contact_Form_S parent::__construct('Contact', ts('Contacts')); } + /** + * @return bool + */ public function isActive() { return CRM_Core_Permission::check('view all contacts'); } diff --git a/CRM/Contact/Form/Search/Custom/FullText/Contribution.php b/CRM/Contact/Form/Search/Custom/FullText/Contribution.php index 6ef97a2179..d68719760a 100644 --- a/CRM/Contact/Form/Search/Custom/FullText/Contribution.php +++ b/CRM/Contact/Form/Search/Custom/FullText/Contribution.php @@ -41,6 +41,9 @@ class CRM_Contact_Form_Search_Custom_FullText_Contribution extends CRM_Contact_F parent::__construct('Contribution', ts('Contributions')); } + /** + * @return bool + */ public function isActive() { $config = CRM_Core_Config::singleton(); return in_array('CiviContribute', $config->enableComponents) && diff --git a/CRM/Contact/Form/Search/Custom/FullText/Membership.php b/CRM/Contact/Form/Search/Custom/FullText/Membership.php index aea55a1bbf..250aeb044a 100644 --- a/CRM/Contact/Form/Search/Custom/FullText/Membership.php +++ b/CRM/Contact/Form/Search/Custom/FullText/Membership.php @@ -41,6 +41,9 @@ class CRM_Contact_Form_Search_Custom_FullText_Membership extends CRM_Contact_For parent::__construct('Membership', ts('Memberships')); } + /** + * @return bool + */ public function isActive() { $config = CRM_Core_Config::singleton(); return in_array('CiviMember', $config->enableComponents) && diff --git a/api/v3/Acl.php b/api/v3/Acl.php index 9bc52f32fb..5e6018b72e 100644 --- a/api/v3/Acl.php +++ b/api/v3/Acl.php @@ -33,7 +33,7 @@ */ /** - * Save an acl + * Save an acl. * * {@getfields acl_create} * @example aclCreate.php @@ -48,10 +48,7 @@ function civicrm_api3_acl_create($params) { } /** - * Get an acl - * - * {@getfields acl_get} - * @example aclCreate.php + * Get an acl. * * @param array $params * @@ -63,10 +60,7 @@ function civicrm_api3_acl_get($params) { } /** - * Delete an acl - * - * {@getfields acl_delete} - * @example aclCreate.php + * Delete an acl. * * @param array $params * diff --git a/api/v3/Generic/Getactions.php b/api/v3/Generic/Getactions.php index d8b7fb4adb..bdefaa0682 100644 --- a/api/v3/Generic/Getactions.php +++ b/api/v3/Generic/Getactions.php @@ -26,6 +26,8 @@ */ /** + * Get available api actions. + * * @param array $apiRequest * * @return array diff --git a/api/v3/Generic/Update.php b/api/v3/Generic/Update.php index 095018bc1b..3ccfece1ec 100644 --- a/api/v3/Generic/Update.php +++ b/api/v3/Generic/Update.php @@ -26,7 +26,9 @@ */ /** - * Update function is basically a hack to get around issues listed in + * Update function is basically a hack. + * + * We want to remove it but must resolve issues in * http://issues.civicrm.org/jira/browse/CRM-12144 * * It is not recommended & if update doesn't work & fix does then update will not be fixed diff --git a/api/v3/Im.php b/api/v3/Im.php index 8101cb32e7..448b337481 100644 --- a/api/v3/Im.php +++ b/api/v3/Im.php @@ -35,10 +35,7 @@ */ /** - * Add an IM for a contact - * - * Allowed @params array keys are: - * {@getfields im_create} + * Add an IM for a contact. * * @param array $params * @@ -50,9 +47,10 @@ function civicrm_api3_im_create($params) { } /** - * Adjust Metadata for Create action + * Adjust Metadata for Create action. + * + * The metadata is used for setting defaults, documentation & validation. * - * The metadata is used for setting defaults, documentation & validation * @param array $params * Array or parameters determined by getfields. */ @@ -61,7 +59,7 @@ function _civicrm_api3_im_create_spec(&$params) { } /** - * Deletes an existing IM + * Deletes an existing IM. * * @param array $params * diff --git a/api/v3/Job.php b/api/v3/Job.php index f1cc4997de..65436f8d48 100644 --- a/api/v3/Job.php +++ b/api/v3/Job.php @@ -315,7 +315,7 @@ function civicrm_api3_job_process_mailing($params) { } /** - * Process sms queue + * Process sms queue. * * @param array $params * diff --git a/api/v3/utils.php b/api/v3/utils.php index c2ada33f33..0e1cde62b9 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -73,6 +73,8 @@ function civicrm_api3_verify_one_mandatory($params, $daoName = NULL, $keyoptions * @param array $keys * List of required fields. A value can be an array denoting that either this or that is required. * @param bool $verifyDAO + * + * @throws \API_Exception */ function civicrm_api3_verify_mandatory($params, $daoName = NULL, $keys = array(), $verifyDAO = TRUE) { diff --git a/bin/cli.class.php b/bin/cli.class.php index 10bb27db0d..f7999d383a 100644 --- a/bin/cli.class.php +++ b/bin/cli.class.php @@ -77,6 +77,11 @@ class civicrm_cli { return TRUE; } + /** + * Ensure function is being run from the cli. + * + * @return bool + */ public function _accessing_from_cli() { if (PHP_SAPI === 'cli') { return TRUE; @@ -370,6 +375,9 @@ class civicrm_cli_csv_file extends civicrm_cli { parent::initialize(); } + /** + * Run CLI function. + */ public function run() { $this->row = 1; $handle = fopen($this->_file, "r"); @@ -402,7 +410,6 @@ class civicrm_cli_csv_file extends civicrm_cli { $this->processLine($params); } fclose($handle); - return NULL; } /* return a params as expected */ diff --git a/tests/phpunit/CRM/Utils/QueryFormatterTest.php b/tests/phpunit/CRM/Utils/QueryFormatterTest.php index 79e34ed6d5..b57308c239 100644 --- a/tests/phpunit/CRM/Utils/QueryFormatterTest.php +++ b/tests/phpunit/CRM/Utils/QueryFormatterTest.php @@ -7,6 +7,11 @@ require_once 'CiviTest/CiviUnitTestCase.php'; */ class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase { + /** + * Generate data for tests to iterate through. + * + * @return array + */ public function dataProvider() { // Array(0=>$inputText, 1=>$language, 2=>$options, 3=>$expectedText). $cases = array(); -- 2.25.1