From: Eileen McNaughton Date: Thu, 15 Jan 2015 05:00:04 +0000 (+1300) Subject: more tidy ups X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=db7de9c1dc97c53943413d8fc3d420f4680f2309;p=civicrm-core.git more tidy ups --- diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index 0730ca850c..11fc17586b 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -52,7 +52,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { static $_importableFields = NULL; /** - * Check if there is absolute minimum of data to add the object + * Check if there is absolute minimum of data to add the object. * * @param array $params * (reference ) an assoc array of name/value pairs. @@ -1499,7 +1499,6 @@ LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND * @param int $toID * The contact id of the recipient. * @param $tokenText - * @param $tokenHtml * @param array $smsParams * The params used for sending sms. * @param int $activityID @@ -1652,7 +1651,7 @@ LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND } /** - * Combine all the importable fields from the lower levels object + * Combine all the importable fields from the lower levels object. * * The ordering is important, since currently we do not have a weight * scheme. Adding weight is super important and should be done in the @@ -1967,7 +1966,7 @@ AND id < {$activityID} } /** - * Get all prior activities of currently viewed activity + * Get all prior activities of currently viewed activity. * * @param $activityID * Current activity id. @@ -2018,7 +2017,7 @@ AND cl.modified_id = c.id } /** - * Find the latest revision of a given activity + * Find the latest revision of a given activity. * * @param int $activityID * Prior activity id. @@ -2051,7 +2050,7 @@ AND cl.modified_id = c.id } /** - * Create a follow up a given activity + * Create a follow up a given activity. * * @param int $activityId * activity id of parent activity. @@ -2142,7 +2141,7 @@ AND cl.modified_id = c.id } /** - * Get the exportable fields for Activities + * Get the exportable fields for Activities. * * @param string $name * If it is called by case $name = Case else $name = Activity. @@ -2440,13 +2439,13 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n } /** - * wrapper for ajax activity selector + * Wrapper for ajax activity selector. * * @param array $params * Associated array for params record id. * * @return array - * associated array of contact activities + * Associated array of contact activities */ public static function getContactActivitySelector(&$params) { // format the params diff --git a/CRM/Admin/Form/Setting.php b/CRM/Admin/Form/Setting.php index cafc645b66..517a9963cc 100644 --- a/CRM/Admin/Form/Setting.php +++ b/CRM/Admin/Form/Setting.php @@ -34,7 +34,6 @@ /** * This class generates form components generic to CiviCRM settings - * */ class CRM_Admin_Form_Setting extends CRM_Core_Form { @@ -113,8 +112,6 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { /** * Build the form object - * - * @return void */ public function buildQuickForm() { $session = CRM_Core_Session::singleton(); diff --git a/CRM/Campaign/Form/Gotv.php b/CRM/Campaign/Form/Gotv.php index f576b12257..e1c563cbde 100755 --- a/CRM/Campaign/Form/Gotv.php +++ b/CRM/Campaign/Form/Gotv.php @@ -49,11 +49,9 @@ class CRM_Campaign_Form_Gotv extends CRM_Core_Form { protected $_searchVoterFor; /** - * Processing needed for buildForm and later - * - * @return void + * Processing needed for buildForm and later. */ - function preProcess() { + public function preProcess() { $this->_search = CRM_Utils_Array::value('search', $_GET); $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); $this->_surveyId = CRM_Utils_Request::retrieve('sid', 'Positive', $this); diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 428d173dfb..d49f64cd7e 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -1615,8 +1615,8 @@ WHERE id={$id}; "; $returnProperties = self::makeHierReturnProperties($fields, $contactId); - // we dont know the contents of return properties, but we need the lower level ids of the contact - // so add a few fields + // We don't know the contents of return properties, but we need the lower level ids of the contact + // so add a few fields. $returnProperties['first_name'] = $returnProperties['organization_name'] = $returnProperties['household_name'] = @@ -1626,15 +1626,16 @@ WHERE id={$id}; "; } /** - * Given a set of flat profile style field names, create a hierarchy - * for query to use and crete the right sql + * Given a set of flat profile style field names, create a hierarchy. + * + * This is for the query to use, create the right sql. * * @param $fields * @param int $contactId * Contact id. * * @return array - * a hierarchical property tree if appropriate + * A hierarchical property tree if appropriate */ public static function &makeHierReturnProperties($fields, $contactId = NULL) { $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); @@ -2529,8 +2530,7 @@ AND civicrm_openid.is_primary = 1"; } /** - * Given the component name and returns - * the count of participation of contact + * Given the component name and returns the count of participation of contact. * * @param string $component * Input component name. @@ -2616,8 +2616,6 @@ AND civicrm_openid.is_primary = 1"; * Contact object after save. * @param bool $useDefaults * Use default greeting values. - * - * @return void */ public static function processGreetings(&$contact, $useDefaults = FALSE) { if ($useDefaults) { @@ -3191,7 +3189,7 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id ) } /** - * Get a list of triggers for the contact table + * Get a list of triggers for the contact table. * * @see hook_civicrm_triggerInfo * @see CRM_Core_DAO::triggerRebuild @@ -3255,8 +3253,7 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id ) } /** - * Check if contact is being used in civicrm_domain - * based on $contactId + * Check if contact is being used in civicrm_domain based on $contactId. * * @param int $contactId * Contact id. @@ -3265,8 +3262,9 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id ) * true if present else false. */ public static function checkDomainContact($contactId) { - if (!$contactId) + if (!$contactId) { return FALSE; + } $domainId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain', $contactId, 'id', 'contact_id'); if ($domainId) { @@ -3279,6 +3277,7 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id ) /** * Get options for a given contact field. + * * @see CRM_Core_DAO::buildOptions * * TODO: Should we always assume chainselect? What fn should be responsible for controlling that flow? @@ -3314,12 +3313,13 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id ) } /** - * Delete a contact-related object that has an 'is_primary' field + * Delete a contact-related object that has an 'is_primary' field. + * * Ensures that is_primary gets assigned to another object if available * Also calls pre/post hooks * - * @var $type : object type - * @var $id : object id + * @var object $type + * @var int $id * @return bool */ public static function deleteObjectWithPrimary($type, $id) { diff --git a/CRM/Contact/Form/RelatedContact.php b/CRM/Contact/Form/RelatedContact.php index 6885bcc14b..e3543b6538 100644 --- a/CRM/Contact/Form/RelatedContact.php +++ b/CRM/Contact/Form/RelatedContact.php @@ -38,7 +38,6 @@ * It delegates the work to lower level subclasses and integrates the changes * back in. It also uses a lot of functionality with the CRM API's, so any change * made here could potentially affect the API etc. Be careful, be aware, use unit tests. - * */ class CRM_Contact_Form_RelatedContact extends CRM_Core_Form { @@ -162,7 +161,7 @@ class CRM_Contact_Form_RelatedContact extends CRM_Core_Form { foreach (array( 'phone', 'email', - 'address' + 'address', ) as $locFld) { if (!empty($this->_defaults[$locFld]) && $this->_defaults[$locFld][1]['location_type_id']) { $params[$locFld][1]['is_primary'] = $this->_defaults[$locFld][1]['is_primary']; diff --git a/CRM/Contact/Form/Task.php b/CRM/Contact/Form/Task.php index a7f572badf..7321c95e72 100644 --- a/CRM/Contact/Form/Task.php +++ b/CRM/Contact/Form/Task.php @@ -254,7 +254,6 @@ class CRM_Contact_Form_Task extends CRM_Core_Form { } } - if (CRM_Utils_Array::value('radio_ts', self::$_searchFormValues) == 'ts_sel' && ($form->_action != CRM_Core_Action::COPY) ) { diff --git a/CRM/Contact/Selector/Custom.php b/CRM/Contact/Selector/Custom.php index 5445b08d25..16f033c448 100644 --- a/CRM/Contact/Selector/Custom.php +++ b/CRM/Contact/Selector/Custom.php @@ -115,7 +115,7 @@ class CRM_Contact_Selector_Custom extends CRM_Contact_Selector { * * @return \CRM_Contact_Selector_Custom */ - function __construct( + public function __construct( $customSearchClass, $formValues = NULL, $params = NULL, @@ -152,8 +152,8 @@ class CRM_Contact_Selector_Custom extends CRM_Contact_Selector { /** * 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 * @@ -212,8 +212,9 @@ class CRM_Contact_Selector_Custom extends CRM_Contact_Selector { } /** - * Returns the column headers as an array of tuples: - * (name, sortName (key to the sort array)) + * Returns the column headers as an array of tuples. + * + * Keys are name, sortName, key to the sort array. * * @param string $action * The action being performed. diff --git a/CRM/Core/Controller/Simple.php b/CRM/Core/Controller/Simple.php index 0f03b56030..332cf17268 100644 --- a/CRM/Core/Controller/Simple.php +++ b/CRM/Core/Controller/Simple.php @@ -41,8 +41,9 @@ class CRM_Core_Controller_Simple extends CRM_Core_Controller { * Constructor. * * @param null $path + * The class Path of the form being implemented * @param bool $title - * @param string path the class Path of the form being implemented + * @param string $mode * @param bool $imageUpload * @param bool $addSequence * Should we add a unique sequence number to the end of the key. @@ -50,7 +51,6 @@ class CRM_Core_Controller_Simple extends CRM_Core_Controller { * Should we not set a qfKey for this controller (for standalone forms). * @param bool $attachUpload * - * * @return \CRM_Core_Controller_Simple */ function __construct( @@ -107,6 +107,8 @@ class CRM_Core_Controller_Simple extends CRM_Core_Controller { } /** + * Set parent. + * * @param $parent */ public function setParent($parent) { diff --git a/CRM/Dedupe/BAO/QueryBuilder/IndividualSupervised.php b/CRM/Dedupe/BAO/QueryBuilder/IndividualSupervised.php index c04fa9894c..bd31575094 100644 --- a/CRM/Dedupe/BAO/QueryBuilder/IndividualSupervised.php +++ b/CRM/Dedupe/BAO/QueryBuilder/IndividualSupervised.php @@ -7,7 +7,7 @@ class CRM_Dedupe_BAO_QueryBuilder_IndividualSupervised extends CRM_Dedupe_BAO_QueryBuilder { /** - * Record - what do I do? + * Record - what do I do. * * @param object $rg * diff --git a/CRM/SMS/Form/Provider.php b/CRM/SMS/Form/Provider.php index 86df3cec8a..5c773d8212 100644 --- a/CRM/SMS/Form/Provider.php +++ b/CRM/SMS/Form/Provider.php @@ -123,15 +123,8 @@ class CRM_SMS_Form_Provider extends CRM_Core_Form { } /** - * This virtual function is used to set the default values of - * various form elements + * Set the default values of various form elements * - * access public - * - * @return array - * reference to the array of default values - */ - /** * @return array */ public function setDefaultValues() { @@ -152,8 +145,9 @@ class CRM_SMS_Form_Provider extends CRM_Core_Form { $dao = new CRM_SMS_DAO_Provider(); $dao->id = $this->_id; - if ($name) + if ($name) { $dao->name = $name; + } if (!$dao->find(TRUE)) { return $defaults; diff --git a/tests/phpunit/CRM/Contact/BAO/ContactTest.php b/tests/phpunit/CRM/Contact/BAO/ContactTest.php index 77be6e2d69..eeec7c878a 100644 --- a/tests/phpunit/CRM/Contact/BAO/ContactTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ContactTest.php @@ -495,8 +495,9 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { } /** - * Test case for resolveDefaults( ) - * test all pseudoConstant, stateProvince, country. + * Test case for resolveDefaults( ). + * + * Test all pseudoConstant, stateProvince, country. */ public function testResolveDefaults() { $params = array( diff --git a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php index 3cf45d7cd4..00218f5a6e 100644 --- a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php +++ b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php @@ -69,25 +69,25 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'is_override' => 'NULL', ); - $this->fixtures['phonecall'] = array(// createTestObject + $this->fixtures['phonecall'] = array( 'status_id' => 1, 'activity_type_id' => 2, 'activity_date_time' => '20120615100000', 'is_current_revision' => 1, 'is_deleted' => 0, ); - $this->fixtures['contact'] = array(// API + $this->fixtures['contact'] = array( 'is_deceased' => 0, 'contact_type' => 'Individual', 'email' => 'test-member@example.com', ); - $this->fixtures['contact_birthdate'] = array(// API + $this->fixtures['contact_birthdate'] = array( 'is_deceased' => 0, 'contact_type' => 'Individual', 'email' => 'test-bday@example.com', 'birth_date' => '20050707', ); - $this->fixtures['sched_activity_1day'] = array(// create() + $this->fixtures['sched_activity_1day'] = array( 'name' => 'One_Day_Phone_Call_Notice', 'title' => 'One Day Phone Call Notice', 'limit_to' => '1', diff --git a/tests/phpunit/CRM/Extension/Container/AllTests.php b/tests/phpunit/CRM/Extension/Container/AllTests.php index 6948c09426..f4db10030f 100644 --- a/tests/phpunit/CRM/Extension/Container/AllTests.php +++ b/tests/phpunit/CRM/Extension/Container/AllTests.php @@ -48,21 +48,19 @@ class CRM_Extension_Container_AllTests extends CiviTestSuite { */ private static function getInstance() { if (is_null(self::$instance)) { - self::$instance = new self; + self::$instance = new self(); } return self::$instance; } /** - * Build test suite dynamically + * Build test suite dynamically. */ public static function suite() { $inst = self::getInstance(); return $inst->implSuite(__FILE__); } } -// class CRM_Core_AllTests - // -- set Emacs parameters -- // Local variables: // mode: php; diff --git a/tests/phpunit/CRM/Utils/QueryFormatterTest.php b/tests/phpunit/CRM/Utils/QueryFormatterTest.php index 89dc6ceb64..fb8c9af054 100644 --- a/tests/phpunit/CRM/Utils/QueryFormatterTest.php +++ b/tests/phpunit/CRM/Utils/QueryFormatterTest.php @@ -8,7 +8,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase { public function dataProvider() { - $cases = array(); // array(0=>$inputText, 1=>$language, 2=>$options, 3=>$expectedText) + // Array(0=>$inputText, 1=>$language, 2=>$options, 3=>$expectedText). + $cases = array(); $cases[] = array( 'first second', @@ -125,13 +126,13 @@ class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase { 'first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_WILDWORDS, - '*first* *second*' + '*first* *second*', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, - 'first* second*' + 'first* second*', ); // if user supplies wildcards, then ignore mode @@ -139,7 +140,7 @@ class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase { CRM_Utils_QueryFormatter::MODE_NONE, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, CRM_Utils_QueryFormatter::MODE_WILDWORDS, - CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX + CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, ) as $mode) { $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first% second'); $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first* second'); diff --git a/tests/phpunit/WebTest/Event/MultiprofileEventTest.php b/tests/phpunit/WebTest/Event/MultiprofileEventTest.php index ee2a2babad..7ec493e19b 100644 --- a/tests/phpunit/WebTest/Event/MultiprofileEventTest.php +++ b/tests/phpunit/WebTest/Event/MultiprofileEventTest.php @@ -410,14 +410,16 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { } /** - * @param $profilefield + * Test profile creation. + * +*@param $profileField * @param int $location * @param $type * * @return null */ - public function _testCreateProfile($profilefield, $location = 0, $type) { - $locationfields = array( + public function _testCreateProfile($profileField, $location = 0, $type) { + $locationFields = array( 'supplemental_address_1', 'supplemental_address_2', 'city', @@ -429,22 +431,22 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { ); // Add new profile. - $profilename = "Profile_" . substr(sha1(rand()), 0, 7); + $profileName = "Profile_" . substr(sha1(rand()), 0, 7); $this->openCiviPage("admin/uf/group", "reset=1"); $this->click('newCiviCRMProfile-top'); $this->waitForElementPresent('_qf_Group_next-top'); //Name of profile - $this->type('title', $profilename); + $this->type('title', $profileName); $this->click('uf_group_type_Profile'); $this->click('_qf_Group_next-top'); $this->waitForPageToLoad($this->getTimeoutMsec()); $profileId = $this->urlArg('gid'); //Add field to profile_testCreateProfile - foreach ($profilefield as $key => $value) { + foreach ($profileField as $key => $value) { $this->openCiviPage("admin/uf/group/field/add", "reset=1&action=add&gid=$profileId"); - if (in_array($value, $locationfields)) { + if (in_array($value, $locationFields)) { $this->select("field_name[0]", "value={$type}"); $this->select("field_name[1]", "value={$value}"); $this->select("field_name[2]", "value={$location}"); diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 30213f51bf..d956242fa9 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -66,8 +66,8 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { ); /* they are two types of missing APIs: - - Those that are to be implemented - (in some future version when someone steps in -hint hint-). List the entities in toBeImplemented[ {$action} ] + - Those that are to be implemented + (in some future version when someone steps in -hint hint-). List the entities in toBeImplemented[ {$action} ] Those that don't exist and that will never exist (eg an obsoleted Entity they need to be returned by the function toBeSkipped_{$action} (because it has to be a static method and therefore couldn't access a this->toBeSkipped) @@ -83,7 +83,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { 'Extension', 'ReportTemplate', 'System', - 'Setting' + 'Setting', ); $this->toBeImplemented['create'] = array( 'SurveyRespondant', @@ -94,7 +94,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { 'CustomSearch', 'Extension', 'ReportTemplate', - 'System' + 'System', ); $this->toBeImplemented['delete'] = array( 'MembershipPayment', @@ -104,7 +104,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { 'UFMatch', 'Extension', 'LocationType', - 'System' + 'System', ); $this->onlyIDNonZeroCount['get'] = array('ActivityType', 'Entity', 'Domain', 'Setting'); $this->deprecatedAPI = array('Location', 'ActivityType', 'SurveyRespondant'); @@ -120,11 +120,14 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { } /** - * @param null $skip + * Generate list of all entities. + * + * @param array $skip + * Entities to skip. * * @return array */ - public static function entities($skip = NULL) { + public static function entities($skip = array()) { // The order of operations in here is screwy. In the case where SYNTAX_CONFORMANCE_ENTITIES is // defined, we should be able to parse+return it immediately. However, some weird dependency // crept into the system where civicrm_api('Entity','get') must be called as part of entities() @@ -149,6 +152,8 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { } /** + * Get list of entities for get test. + * * @return array */ public static function entities_get() {