From 92e4c2a5fdb75c00d5a2c1ce4d39deca8b9ee08c Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 8 Jan 2015 15:01:43 -0800 Subject: [PATCH] INFRA-132 - s/(else|try){/(else|try) {/ --- CRM/Admin/Form/Setting.php | 2 +- CRM/Contact/BAO/Contact/Utils.php | 2 +- CRM/Contact/BAO/Relationship.php | 6 +++--- CRM/Contribute/BAO/Contribution/Utils.php | 2 +- CRM/Contribute/Form/Task/Invoice.php | 2 +- CRM/Core/Form.php | 4 ++-- CRM/Custom/Import/Parser/Api.php | 2 +- CRM/Member/BAO/MembershipStatus.php | 2 +- CRM/Member/Form/MembershipStatus.php | 2 +- CRM/Member/Form/MembershipType.php | 2 +- CRM/Member/Form/Task/Label.php | 2 +- CRM/Member/Import/Parser/Membership.php | 2 +- CRM/Upgrade/Incremental/php/FourFour.php | 4 ++-- CRM/Upgrade/Incremental/php/FourTwo.php | 2 +- CRM/Utils/System/Drupal6.php | 4 ++-- CRM/Utils/Token.php | 2 +- api/v3/Constant.php | 2 +- api/v3/CustomValue.php | 2 +- api/v3/EntityTag.php | 2 +- api/v3/Generic.php | 2 +- api/v3/OptionValue.php | 2 +- api/v3/Profile.php | 10 +++++----- api/v3/Setting.php | 6 +++--- api/v3/utils.php | 2 +- extern/authorizeIPN.php | 2 +- extern/ipn.php | 2 +- tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php | 2 +- tests/phpunit/api/v3/APITest.php | 4 ++-- tests/phpunit/api/v3/SyntaxConformanceTest.php | 2 +- 29 files changed, 41 insertions(+), 41 deletions(-) diff --git a/CRM/Admin/Form/Setting.php b/CRM/Admin/Form/Setting.php index 9f540bfe97..10219f991c 100644 --- a/CRM/Admin/Form/Setting.php +++ b/CRM/Admin/Form/Setting.php @@ -149,7 +149,7 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { $props['html_type'] == 'select' ? CRM_Utils_Array::value('html_attributes', $props) : NULL ); } - else{ + else { $this->$add($setting, ts($props['title'])); } $this->assign("{$setting}_description", ts($props['description'])); diff --git a/CRM/Contact/BAO/Contact/Utils.php b/CRM/Contact/BAO/Contact/Utils.php index 9cb6be8415..a5beebd286 100644 --- a/CRM/Contact/BAO/Contact/Utils.php +++ b/CRM/Contact/BAO/Contact/Utils.php @@ -88,7 +88,7 @@ class CRM_Contact_BAO_Contact_Utils { if ($addProfileOverlay) { $imageInfo[$contactType]['image'] = "
"; } - else{ + else { $imageInfo[$contactType]['image'] = "
"; } $imageInfo[$contactType]['url'] = NULL; diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index ba544051b8..cc1a029e4f 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -93,7 +93,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { $hook = 'create'; $action = CRM_Core_Action::ADD; } - else{ + else { $hook = 'edit'; $action = CRM_Core_Action::UPDATE; } @@ -240,7 +240,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { $relationship->$defaultField = 'NULL'; } } - else{ + else { $relationship->$defaultField = $params[$defaultField]; } } @@ -1738,7 +1738,7 @@ AND cc.sort_name LIKE '%$name%'"; elseif(!empty($clauses)) { return explode(' OR ', $clauses); } - else{ + else { // effectively setting it to return no results $params['relationship_type_id'] = 0; } diff --git a/CRM/Contribute/BAO/Contribution/Utils.php b/CRM/Contribute/BAO/Contribution/Utils.php index fe7119b8e1..9a4d6124bf 100644 --- a/CRM/Contribute/BAO/Contribution/Utils.php +++ b/CRM/Contribute/BAO/Contribution/Utils.php @@ -152,7 +152,7 @@ class CRM_Contribute_BAO_Contribution_Utils { // this does not return $result = $payment->doTransferCheckout($form->_params, 'contribute'); } - else{ + else { CRM_Core_Error::fatal($paymentObjError); } } diff --git a/CRM/Contribute/Form/Task/Invoice.php b/CRM/Contribute/Form/Task/Invoice.php index ca80ed7c11..c5439c4cd6 100644 --- a/CRM/Contribute/Form/Task/Invoice.php +++ b/CRM/Contribute/Form/Task/Invoice.php @@ -605,7 +605,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { 'name' ); } - else{ + else { $activityTypeID = CRM_Core_OptionGroup::getValue('activity_type', 'Emailed Invoice', 'name' diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 8ccc7fda71..c152492868 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1502,7 +1502,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { CRM_Utils_Array::value("{$fieldName}_time", $params), TRUE) ); } - else{ + else { if (isset($specs['default'])) { $params[$fieldName] = date('YmdHis', strtotime($specs['default'])); } @@ -1698,7 +1698,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @return array */ public function getProfileDefaults($profile_id = 'Billing', $contactID = NULL) { - try{ + try { $defaults = civicrm_api3('profile', 'getsingle', array( 'profile_id' => (array) $profile_id, 'contact_id' => $contactID, diff --git a/CRM/Custom/Import/Parser/Api.php b/CRM/Custom/Import/Parser/Api.php index 55b0dbe35f..b2664de6ff 100644 --- a/CRM/Custom/Import/Parser/Api.php +++ b/CRM/Custom/Import/Parser/Api.php @@ -162,7 +162,7 @@ class CRM_Custom_Import_Parser_Api extends CRM_Custom_Import_Parser { $this->_params['skipRecentView'] = TRUE; $this->_params['check_permissions'] = TRUE; $this->_params['entity_id'] = $formatted['id']; - try{ + try { civicrm_api3('custom_value', 'create', $this->_params); } catch(CiviCRM_API3_Exception $e) { diff --git a/CRM/Member/BAO/MembershipStatus.php b/CRM/Member/BAO/MembershipStatus.php index 860adfddd6..2fbd000b21 100644 --- a/CRM/Member/BAO/MembershipStatus.php +++ b/CRM/Member/BAO/MembershipStatus.php @@ -98,7 +98,7 @@ class CRM_Member_BAO_MembershipStatus extends CRM_Member_DAO_MembershipStatus { if (!empty($params['id'])) { $ids['membershipStatus'] = $params['id']; } - else{ + else { //don't allow duplicate names - if id not set $status = new CRM_Member_DAO_MembershipStatus(); $status->name = $params['name']; diff --git a/CRM/Member/Form/MembershipStatus.php b/CRM/Member/Form/MembershipStatus.php index 9af2aaa2e4..bfd765a652 100644 --- a/CRM/Member/Form/MembershipStatus.php +++ b/CRM/Member/Form/MembershipStatus.php @@ -112,7 +112,7 @@ class CRM_Member_Form_MembershipStatus extends CRM_Member_Form_MembershipConfig */ public function postProcess() { if ($this->_action & CRM_Core_Action::DELETE) { - try{ + try { CRM_Member_BAO_MembershipStatus::del($this->_id); } catch(CRM_Core_Exception $e) { diff --git a/CRM/Member/Form/MembershipType.php b/CRM/Member/Form/MembershipType.php index 4d680144fc..e365c21917 100644 --- a/CRM/Member/Form/MembershipType.php +++ b/CRM/Member/Form/MembershipType.php @@ -294,7 +294,7 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form_MembershipConfig { */ public function postProcess() { if ($this->_action & CRM_Core_Action::DELETE) { - try{ + try { CRM_Member_BAO_MembershipType::del($this->_id); } catch(CRM_Core_Exception $e) { diff --git a/CRM/Member/Form/Task/Label.php b/CRM/Member/Form/Task/Label.php index 179685e37d..41c0a2806e 100644 --- a/CRM/Member/Form/Task/Label.php +++ b/CRM/Member/Form/Task/Label.php @@ -134,7 +134,7 @@ class CRM_Member_Form_Task_Label extends CRM_Member_Form_Task { $labelRows[$id] = $rows[$membership['contact_id']]; } } - else{ + else { $labelRows = $rows; } //call function to create labels diff --git a/CRM/Member/Import/Parser/Membership.php b/CRM/Member/Import/Parser/Membership.php index 28893d64d5..590afc3c4b 100644 --- a/CRM/Member/Import/Parser/Membership.php +++ b/CRM/Member/Import/Parser/Membership.php @@ -255,7 +255,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { * @return boolean the result of this processing */ public function import($onDuplicate, &$values) { - try{ + try { // first make sure this is a valid line $response = $this->summary($values); if ($response != CRM_Import_Parser::VALID) { diff --git a/CRM/Upgrade/Incremental/php/FourFour.php b/CRM/Upgrade/Incremental/php/FourFour.php index beddb3c0f1..3fff837096 100644 --- a/CRM/Upgrade/Incremental/php/FourFour.php +++ b/CRM/Upgrade/Incremental/php/FourFour.php @@ -393,11 +393,11 @@ ALTER TABLE civicrm_dashboard self::setContactImageUrl($dao->id, CRM_Utils_System::url('civicrm/contact/imagefile', 'photo=' . $photo, TRUE, NULL, TRUE, TRUE)); } - else{ + else { $failures[$dao->id] = $dao->image_url; } } - else{ + else { $failures[$dao->id] = $dao->image_url; } } diff --git a/CRM/Upgrade/Incremental/php/FourTwo.php b/CRM/Upgrade/Incremental/php/FourTwo.php index c2c498b8ca..2eb0e4b6aa 100644 --- a/CRM/Upgrade/Incremental/php/FourTwo.php +++ b/CRM/Upgrade/Incremental/php/FourTwo.php @@ -683,7 +683,7 @@ WHERE cpf.price_set_id = %1 if (isset($result->price_set_id)) { $priceSetId = $result->price_set_id; } - else{ + else { $defaultPriceSets = CRM_Price_BAO_PriceSet::getDefaultPriceSet(); foreach ($defaultPriceSets as $key => $pSet) { if ($pSet['name'] == 'contribution_amount') { diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index 5d8f9f36eb..c3e76133c9 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -207,7 +207,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase { array(1 => $email) ); } - else{ + else { $errors[$emailName] = ts('This email %1 is already registered. Please select another email.', array(1 => $email) ); @@ -473,7 +473,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase { if (!$contactID) { return FALSE; } - else{//success + else { //success if ($loadCMSBootstrap) { $bootStrapParams = array(); if ($name && $password) { diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index 660df752bd..90fb4ce49a 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -1695,7 +1695,7 @@ class CRM_Utils_Token { break; case 'fee': - try{ + try { $value = civicrm_api3('membership_type', 'getvalue', array('id' => $membership['membership_type_id'], 'return' => 'minimum_fee')); } catch (CiviCRM_API3_Exception $e) { diff --git a/api/v3/Constant.php b/api/v3/Constant.php index ba3f964bbb..ef0a33d5d9 100644 --- a/api/v3/Constant.php +++ b/api/v3/Constant.php @@ -126,7 +126,7 @@ function civicrm_api3_constant_get($params) { } return civicrm_api3_create_success($values, $params, 'constant'); } - else{ + else { $values = call_user_func(array('CRM_Utils_PseudoConstant', 'getConstant'), $name); if (!empty($values)) { return civicrm_api3_create_success($values, $params, 'constant'); diff --git a/api/v3/CustomValue.php b/api/v3/CustomValue.php index 5aac497d5b..11433166e3 100644 --- a/api/v3/CustomValue.php +++ b/api/v3/CustomValue.php @@ -208,7 +208,7 @@ function civicrm_api3_custom_value_get($params) { $n = 0; $id = $fieldNumber; } - else{ + else { $n = $idArray[2]; $id = $fieldNumber . "." . $idArray[2]; } diff --git a/api/v3/EntityTag.php b/api/v3/EntityTag.php index 071b8051ad..09a5ec8328 100644 --- a/api/v3/EntityTag.php +++ b/api/v3/EntityTag.php @@ -53,7 +53,7 @@ function civicrm_api3_entity_tag_get($params) { if (empty($params['entity_id'])) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } - else{ + else { //do legacy non-standard behaviour $values = CRM_Core_BAO_EntityTag::getTag($params['entity_id'], $params['entity_table']); $result = array(); diff --git a/api/v3/Generic.php b/api/v3/Generic.php index 17556f86f3..55cadfad70 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -71,7 +71,7 @@ function civicrm_api3_generic_getfields($apiRequest) { $metadata['id']['api.aliases'] = array($lcase_entity . '_id'); } } - else{ + else { // really the preference would be to set the unique name in the xml // question is which is a less risky fix this close to a release - setting in xml for the known failure // (note) or setting for all api where fields is returning 'id' & we want to accept 'note_id' @ the api layer diff --git a/api/v3/OptionValue.php b/api/v3/OptionValue.php index 0a7130b820..6da326132b 100644 --- a/api/v3/OptionValue.php +++ b/api/v3/OptionValue.php @@ -88,7 +88,7 @@ function civicrm_api3_option_value_delete($params) { civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1, 'option_group_id' => $optionGroupID)); return civicrm_api3_create_success(); } - else{ + else { civicrm_api3_create_error('Could not delete OptionValue ' . $params['id']); } } diff --git a/api/v3/Profile.php b/api/v3/Profile.php index 95d0c678c7..79498d08db 100644 --- a/api/v3/Profile.php +++ b/api/v3/Profile.php @@ -124,7 +124,7 @@ function civicrm_api3_profile_get($params) { $values[$profileID][strtolower($fieldName)] = $field; } } - else{ + else { $values[$profileID] = array_fill_keys(array_keys($profileFields), ''); } } @@ -450,7 +450,7 @@ function _civicrm_api3_profile_getbillingpseudoprofile(&$params) { $values['billing_' . $fieldname . '-' . $locationTypeID] = isset($result['api.address.get.2']['values'][0][$fieldname]) ? $result['api.address.get.2']['values'][0][$fieldname] : ''; } } - else{ + else { foreach ($addressFields as $fieldname) { $values['billing_' . $fieldname . '-' . $locationTypeID] = isset($result[$fieldname]) ? $result[$fieldname] : ''; } @@ -462,7 +462,7 @@ function _civicrm_api3_profile_getbillingpseudoprofile(&$params) { elseif(!empty($result['api.email.get.2']['count'])) { $values['billing-email' . '-' . $locationTypeID] = $result['api.email.get.2']['values'][0]['email']; } - else{ + else { $values['billing-email' . '-' . $locationTypeID] = $result['email']; } // return both variants of email to reflect inconsistencies in form layer @@ -567,7 +567,7 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour = // which entity 'status_id' belongs to $fieldName = $entityGetFieldsResult[$realName]['uniqueName']; } - else{ + else { if (isset($entityGetFieldsResult[$realName]['name'])) { // this will sort out membership_type_id vs membership_type $fieldName = $entityGetFieldsResult[$realName]['name']; @@ -638,7 +638,7 @@ function _civicrm_api3_map_profile_fields_to_entity(&$field) { if ($fieldName == 'email') { $entity = 'email'; } - else{ + else { $entity = 'address'; } $fieldName .= '-' . $field['location_type_id']; diff --git a/api/v3/Setting.php b/api/v3/Setting.php index 0b107b7b61..63f16cfd3a 100644 --- a/api/v3/Setting.php +++ b/api/v3/Setting.php @@ -96,7 +96,7 @@ function civicrm_api3_setting_getdefaults(&$params) { if (array_key_exists('default', $spec) && !is_null($spec['default'])) { $defaults[$domainID][$setting] = $spec['default']; } - else{ + else { $noDefaults[$setting] = 1; } } @@ -343,14 +343,14 @@ function _civicrm_api3_setting_getDomainArray(&$params) { if (isset($domainAPIResult['values'])) { $params['domain_id'] = array_keys($domainAPIResult['values']); } - else{ + else { throw new Exception('All domains not retrieved - problem with Domain Get api call ' . $domainAPIResult['error_message']); } } if (is_array($params['domain_id'])) { $domains = $params['domain_id']; } - else{ + else { $domains = array($params['domain_id']); } return $domains; diff --git a/api/v3/utils.php b/api/v3/utils.php index a40e47ee3e..e44c1c20a7 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -1888,7 +1888,7 @@ function _civicrm_api3_validate_string(&$params, &$fieldName, &$fieldInfo, $enti if (!is_array($value)) { $value = (string) $value; } - else{ + else { //@todo what do we do about passed in arrays. For many of these fields // the missing piece of functionality is separating them to a separated string // & many save incorrectly. But can we change them wholesale? diff --git a/extern/authorizeIPN.php b/extern/authorizeIPN.php index aac00a034c..165f01acc6 100644 --- a/extern/authorizeIPN.php +++ b/extern/authorizeIPN.php @@ -39,7 +39,7 @@ $log = new CRM_Utils_SystemLogger(); $log->alert('payment_notification processor_name=AuthNet', $_REQUEST); $authorizeNetIPN = new CRM_Core_Payment_AuthorizeNetIPN($_REQUEST); -try{ +try { $authorizeNetIPN->main(); } catch(CRM_Core_Exception $e) { diff --git a/extern/ipn.php b/extern/ipn.php index f8fd101101..20a046141a 100644 --- a/extern/ipn.php +++ b/extern/ipn.php @@ -48,7 +48,7 @@ else { $paypalIPN = new CRM_Core_Payment_PayPalIPN(); // @todo upgrade standard per Pro } -try{ +try { $paypalIPN->main(); } catch(CRM_Core_Exception $e) { diff --git a/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php b/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php index 79fc643132..ac33547c83 100644 --- a/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php +++ b/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php @@ -153,7 +153,7 @@ class CRM_Core_Payment_PayPalProIPNTest extends CiviUnitTestCase { public function testIPNPaymentExpressNoError() { $this->setupRecurringPaymentProcessorTransaction(); $paypalIPN = new CRM_Core_Payment_PayPalProIPN($this->getPaypalExpressTransactionIPN()); - try{ + try { $paypalIPN->main(); } catch(CRM_Core_Exception $e) { diff --git a/tests/phpunit/api/v3/APITest.php b/tests/phpunit/api/v3/APITest.php index 427a3205cf..007a7ff822 100644 --- a/tests/phpunit/api/v3/APITest.php +++ b/tests/phpunit/api/v3/APITest.php @@ -135,7 +135,7 @@ class api_v3_APITest extends CiviUnitTestCase { * Test that calling via wrapper works */ public function testv3Wrapper() { - try{ + try { $result = civicrm_api3('contact', 'get', array()); } catch (CRM_Exception $e) { @@ -149,7 +149,7 @@ class api_v3_APITest extends CiviUnitTestCase { * Test exception is thrown */ public function testv3WrapperException() { - try{ + try { $result = civicrm_api3('contact', 'create', array('debug' => 1)); } catch (CiviCRM_API3_Exception $e) { diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index c714c1dec6..c476b2b1fd 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -1018,7 +1018,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { if ($specs['FKClassName'] == $baoString) { $entity[$fieldName] = (string) $entity2['id']; } - else{ + else { $uniqueName = CRM_Utils_Array::value('uniqueName', $specs); if (!empty($entity[$fieldName])) { $resetFKTo = array($fieldName => $entity[$fieldName]); -- 2.25.1