From 57507ae66f0dd2212c35b6cbdadd752c9b4c5137 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 15 Jan 2015 17:06:51 +1300 Subject: [PATCH] more code tidy ups --- CRM/Activity/BAO/Activity.php | 11 +++--- CRM/Admin/Form/Setting.php | 1 - CRM/Campaign/Form/Gotv.php | 1 - CRM/Contact/BAO/Contact.php | 34 ++++++++++--------- CRM/Contact/Form/Edit/Phone.php | 1 - CRM/Contact/Form/RelatedContact.php | 5 +-- CRM/Contact/Form/Task.php | 21 +++--------- CRM/Contact/Selector/Custom.php | 1 - .../Controller/ContributionPage.php | 1 - CRM/Core/Controller/Simple.php | 1 - .../BAO/QueryBuilder/IndividualSupervised.php | 8 +++-- CRM/SMS/Form/Provider.php | 3 +- api/v3/MailingEventConfirm.php | 3 +- .../CRM/Core/BAO/ActionScheduleTest.php | 2 +- .../CRM/Extension/Container/AllTests.php | 1 + .../phpunit/CRM/Utils/QueryFormatterTest.php | 26 +++++++------- 16 files changed, 52 insertions(+), 68 deletions(-) diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index 71d9810cb6..50e65192e3 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -30,7 +30,6 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id$ - * */ /** @@ -1711,7 +1710,7 @@ LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND } /** - * get the Activities of a target contact + * Get the Activities of a target contact. * * @param int $contactId * Id of the contact whose activities need to find. @@ -1784,7 +1783,7 @@ WHERE activity.id IN ($activityIds)"; } /** - * Add activity for Membership/Event/Contribution + * Add activity for Membership/Event/Contribution. * * @param object $activity * (reference) particular component object. @@ -1903,13 +1902,13 @@ SELECT display_name } /** - * Get Parent activity for currently viewed activity + * Get Parent activity for currently viewed activity. * * @param int $activityId * Current activity id. * * @return int - * $parentId Id of parent activity otherwise false. + * Id of parent activity otherwise false. */ public static function getParentActivity($activityId) { static $parentActivities = array(); @@ -1931,7 +1930,7 @@ SELECT display_name } /** - * Get total count of prior revision of currently viewd activity + * Get total count of prior revision of currently viewed activity. * * @param $activityID * Current activity id. diff --git a/CRM/Admin/Form/Setting.php b/CRM/Admin/Form/Setting.php index 35a60e44c8..0740797e8a 100644 --- a/CRM/Admin/Form/Setting.php +++ b/CRM/Admin/Form/Setting.php @@ -30,7 +30,6 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id$ - * */ /** diff --git a/CRM/Campaign/Form/Gotv.php b/CRM/Campaign/Form/Gotv.php index dd2fb7833b..f576b12257 100755 --- a/CRM/Campaign/Form/Gotv.php +++ b/CRM/Campaign/Form/Gotv.php @@ -30,7 +30,6 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id$ - * */ /** diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 2689c3ed56..428d173dfb 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -1698,7 +1698,7 @@ WHERE id={$id}; "; } /** - * Return the primary location type of a contact + * Return the primary location type of a contact. * * $params int $contactId contact_id * $params boolean $isPrimaryExist if true, return primary contact location type otherwise null @@ -1766,7 +1766,7 @@ WHERE civicrm_contact.id = %1 "; } /** - * Get the display name, primary email and location type of a contact + * Get the display name, primary email and location type of a contact. * * @param int $id * Id of the contact. @@ -1822,7 +1822,7 @@ ORDER BY civicrm_email.is_primary DESC"; * Specifies the default group to which contact is added. * @param int $ufGroupId * Uf group id (profile id). - * @param ctype + * @param string $ctype * @param bool $visibility * Basically lets us know where this request is coming from. * if via a profile from web, we restrict what groups are changed @@ -1830,7 +1830,7 @@ ORDER BY civicrm_email.is_primary DESC"; * @return int * contact id created/edited */ - static function createProfileContact( + public static function createProfileContact( &$params, &$fields, $contactID = NULL, @@ -1922,6 +1922,8 @@ ORDER BY civicrm_email.is_primary DESC"; } /** + * Format profile contact parameters. + * * @param array $params * @param $fields * @param int $contactID @@ -1931,7 +1933,7 @@ ORDER BY civicrm_email.is_primary DESC"; * * @return array */ - static function formatProfileContactParams( + public static function formatProfileContactParams( &$params, &$fields, $contactID = NULL, @@ -2292,9 +2294,10 @@ ORDER BY civicrm_email.is_primary DESC"; } /** - * Find the get contact details - * does not respect ACLs for now, which might need to be rectified at some - * stage based on how its used + * Find the get contact details. + * + * This function does not respect ACLs for now, which might need to be rectified at some + * stage based on how its used. * * @param string $mail * Primary email address of the contact. @@ -2315,7 +2318,6 @@ SELECT civicrm_contact.id as contact_id, FROM civicrm_contact INNER JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id )"; - if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, 'uniq_email_per_site')) { // try to find a match within a site (multisite). $groups = CRM_Core_BAO_Domain::getChildGroupIds(); @@ -2346,7 +2348,7 @@ WHERE civicrm_email.email = %1 AND civicrm_contact.is_deleted=0"; } /** - * Find the contact details associated with an OpenID + * Find the contact details associated with an OpenID. * * @param string $openId * OpenId of the contact. @@ -2385,13 +2387,13 @@ WHERE civicrm_openid.openid = %1"; } /** - * Funtion to get primary email of the contact + * Get primary email of the contact. * * @param int $contactID * Contact id. * * @return string - * >email email address if present else null + * Email address if present else null */ public static function getPrimaryEmail($contactID) { // fetch the primary email @@ -2413,7 +2415,7 @@ LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id ) } /** - * Funtion to get primary OpenID of the contact + * Function to get primary OpenID of the contact. * * @param int $contactID * Contact id. @@ -2441,15 +2443,15 @@ AND civicrm_openid.is_primary = 1"; } /** - * Given the list of params in the params array, fetch the object - * and store the values in the values array + * Fetch the object and store the values in the values array. * * @param array $params * Input parameters to find object. * @param array $values * Output values of the object. * - * @return CRM_Contact_BAO_Contact|null the found object or null + * @return CRM_Contact_BAO_Contact|null + * The found object or null */ public static function getValues(&$params, &$values) { $contact = new CRM_Contact_BAO_Contact(); diff --git a/CRM/Contact/Form/Edit/Phone.php b/CRM/Contact/Form/Edit/Phone.php index 71c48d2b27..b48758e50d 100644 --- a/CRM/Contact/Form/Edit/Phone.php +++ b/CRM/Contact/Form/Edit/Phone.php @@ -30,7 +30,6 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id$ - * */ /** diff --git a/CRM/Contact/Form/RelatedContact.php b/CRM/Contact/Form/RelatedContact.php index 5ef9d24927..487da255cb 100644 --- a/CRM/Contact/Form/RelatedContact.php +++ b/CRM/Contact/Form/RelatedContact.php @@ -30,7 +30,6 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id$ - * */ /** @@ -65,9 +64,7 @@ class CRM_Contact_Form_RelatedContact extends CRM_Core_Form { protected $_defaults = array(); /** - * Build all the data structures needed to build the form - * - * @return void + * Build all the data structures needed to build the form. */ public function preProcess() { // reset action from the session diff --git a/CRM/Contact/Form/Task.php b/CRM/Contact/Form/Task.php index 134c696520..e9ca3c6cac 100644 --- a/CRM/Contact/Form/Task.php +++ b/CRM/Contact/Form/Task.php @@ -30,7 +30,6 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id$ - * */ /** @@ -89,9 +88,7 @@ class CRM_Contact_Form_Task extends CRM_Core_Form { /** * Build all the data structures needed to build the form * - * @param - * - * @return void + * @param object $this */ public function preProcess() { self::preProcessCommon($this); @@ -338,17 +335,13 @@ class CRM_Contact_Form_Task extends CRM_Core_Form { } /** - * add the rules for form. - * - * @return void + * Add the rules for form. */ public function addRules() { } /** * Build the form object - * - * @return void */ public function buildQuickForm() { $this->addDefaultButtons(ts('Confirm Action')); @@ -356,16 +349,14 @@ class CRM_Contact_Form_Task extends CRM_Core_Form { /** * Process the form after the input has been submitted and validated - * - * - * @return void */ public function postProcess() { } /** - * Simple shell that derived classes can call to add buttons to - * the form with a customized title for the main Submit + * Simple shell that derived classes can call to add form buttons. + * + * Allows customized title for the main Submit * * @param string $title * Title of the main button. @@ -373,8 +364,6 @@ class CRM_Contact_Form_Task extends CRM_Core_Form { * Button type for the form after processing. * @param string $backType * @param bool $submitOnce - * - * @return void */ public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) { $this->addButtons(array( diff --git a/CRM/Contact/Selector/Custom.php b/CRM/Contact/Selector/Custom.php index 7cefaae357..4e8eed51e4 100644 --- a/CRM/Contact/Selector/Custom.php +++ b/CRM/Contact/Selector/Custom.php @@ -30,7 +30,6 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id: Selector.php 11510 2007-09-18 09:21:34Z lobo $ - * */ /** diff --git a/CRM/Contribute/Controller/ContributionPage.php b/CRM/Contribute/Controller/ContributionPage.php index 821173bde7..12d8b8d15a 100644 --- a/CRM/Contribute/Controller/ContributionPage.php +++ b/CRM/Contribute/Controller/ContributionPage.php @@ -30,7 +30,6 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id$ - * */ /** diff --git a/CRM/Core/Controller/Simple.php b/CRM/Core/Controller/Simple.php index 0c7a4addfb..7606058132 100644 --- a/CRM/Core/Controller/Simple.php +++ b/CRM/Core/Controller/Simple.php @@ -34,7 +34,6 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id$ - * */ class CRM_Core_Controller_Simple extends CRM_Core_Controller { diff --git a/CRM/Dedupe/BAO/QueryBuilder/IndividualSupervised.php b/CRM/Dedupe/BAO/QueryBuilder/IndividualSupervised.php index 973242b41f..c04fa9894c 100644 --- a/CRM/Dedupe/BAO/QueryBuilder/IndividualSupervised.php +++ b/CRM/Dedupe/BAO/QueryBuilder/IndividualSupervised.php @@ -7,7 +7,9 @@ class CRM_Dedupe_BAO_QueryBuilder_IndividualSupervised extends CRM_Dedupe_BAO_QueryBuilder { /** - * @param $rg + * Record - what do I do? + * + * @param object $rg * * @return array */ @@ -35,7 +37,9 @@ class CRM_Dedupe_BAO_QueryBuilder_IndividualSupervised extends CRM_Dedupe_BAO_Qu } /** - * @param $rg + * Internal - what do I do. + * + * @param object $rg * * @return array */ diff --git a/CRM/SMS/Form/Provider.php b/CRM/SMS/Form/Provider.php index c6e532a617..e3d1910624 100644 --- a/CRM/SMS/Form/Provider.php +++ b/CRM/SMS/Form/Provider.php @@ -30,11 +30,10 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id: $ - * */ /** - * + * SMS Form. */ class CRM_SMS_Form_Provider extends CRM_Core_Form { protected $_id = NULL; diff --git a/api/v3/MailingEventConfirm.php b/api/v3/MailingEventConfirm.php index 902ab77489..60a34522e4 100644 --- a/api/v3/MailingEventConfirm.php +++ b/api/v3/MailingEventConfirm.php @@ -36,7 +36,7 @@ */ /** - * Handle a confirm event + * Handle a confirm event. * * @param array $params * Associative array of property. @@ -45,7 +45,6 @@ * @throws Exception * @return array * api result array - * {@getfields mailing_event_confirm_create} */ function civicrm_api3_mailing_event_confirm_create($params) { diff --git a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php index 76f4a7bd5f..3cf45d7cd4 100644 --- a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php +++ b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php @@ -43,7 +43,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { require_once 'CiviTest/CiviMailUtils.php'; $this->mut = new CiviMailUtils($this, TRUE); - $this->fixtures['rolling_membership'] = array(// createTestObject + $this->fixtures['rolling_membership'] = array( 'membership_type_id' => array( 'period_type' => 'rolling', 'duration_unit' => 'month', diff --git a/tests/phpunit/CRM/Extension/Container/AllTests.php b/tests/phpunit/CRM/Extension/Container/AllTests.php index 2eee6875bf..6948c09426 100644 --- a/tests/phpunit/CRM/Extension/Container/AllTests.php +++ b/tests/phpunit/CRM/Extension/Container/AllTests.php @@ -44,6 +44,7 @@ class CRM_Extension_Container_AllTests extends CiviTestSuite { private static $instance = NULL; /** + * Get instance. */ private static function getInstance() { if (is_null(self::$instance)) { diff --git a/tests/phpunit/CRM/Utils/QueryFormatterTest.php b/tests/phpunit/CRM/Utils/QueryFormatterTest.php index 574dd79f0a..89dc6ceb64 100644 --- a/tests/phpunit/CRM/Utils/QueryFormatterTest.php +++ b/tests/phpunit/CRM/Utils/QueryFormatterTest.php @@ -14,81 +14,81 @@ class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase { 'first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_NONE, - '%first second%' + '%first second%', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_PHRASE, - '%first second%' + '%first second%', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, - '%first second%' + '%first second%', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_WILDWORDS, - '%first%second%' + '%first%second%', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, - '%first%second%' + '%first%second%', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_NONE, - 'first second' + 'first second', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_PHRASE, - '"first second"' + '"first second"', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, - '"*first second*"' + '"*first second*"', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_WILDWORDS, - '*first* *second*' + '*first* *second*', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, - 'first* second*' + 'first* second*', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_NONE, - '+first +second' + '+first +second', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_PHRASE, - '+"first second"' + '+"first second"', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, - '+"*first second*"' + '+"*first second*"', ); $cases[] = array( 'first second', -- 2.25.1