From: Tim Otten Date: Wed, 7 Jan 2015 03:51:55 +0000 (-0800) Subject: INFRA-132 - Add space before "{" X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9b87335839c446578688c73f95ed44ae984ce8e9;p=civicrm-core.git INFRA-132 - Add space before "{" --- diff --git a/CRM/ACL/BAO/Cache.php b/CRM/ACL/BAO/Cache.php index 3c5b01f941..da9c7210a0 100644 --- a/CRM/ACL/BAO/Cache.php +++ b/CRM/ACL/BAO/Cache.php @@ -163,7 +163,7 @@ WHERE modified_date IS NULL // CRM_Core_DAO::singleValueQuery("TRUNCATE TABLE civicrm_acl_contact_cache"); // No, force-commits transaction // CRM_Core_DAO::singleValueQuery("DELETE FROM civicrm_acl_contact_cache"); // Transaction-safe if (CRM_Core_Transaction::isActive()) { - CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, function(){ + CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, function() { CRM_Core_DAO::singleValueQuery("TRUNCATE TABLE civicrm_acl_contact_cache"); }); } diff --git a/CRM/ACL/Form/WordPress/Permissions.php b/CRM/ACL/Form/WordPress/Permissions.php index 21ad5f077c..efbf0b041b 100644 --- a/CRM/ACL/Form/WordPress/Permissions.php +++ b/CRM/ACL/Form/WordPress/Permissions.php @@ -116,7 +116,7 @@ class CRM_ACL_Form_WordPress_Permissions extends CRM_Core_Form { $roleObj = $wp_roles->get_role($role); //Remove all civicrm capabilities for the role, as there may be some capabilities checkbox unticked - foreach ($permissionsArray as $key => $capability){ + foreach ($permissionsArray as $key => $capability) { $roleObj->remove_cap($key); } @@ -172,7 +172,7 @@ class CRM_ACL_Form_WordPress_Permissions extends CRM_Core_Form { * * @return array civicrm permissions */ - public static function getPermissionArray(){ + public static function getPermissionArray() { global $civicrm_root; $permissions = CRM_Core_Permission::basicPermissions(); diff --git a/CRM/Activity/Form/Task/Batch.php b/CRM/Activity/Form/Task/Batch.php index 1f8c6278eb..2f9993b1da 100755 --- a/CRM/Activity/Form/Task/Batch.php +++ b/CRM/Activity/Form/Task/Batch.php @@ -84,7 +84,7 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task { ); $readOnlyFields['assignee_display_name'] = ts('Assigned to'); if (!empty($contactDetails)) { - foreach ($contactDetails as $key => $value){ + foreach ($contactDetails as $key => $value) { $assignee = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId($key); foreach ($assignee as $keys => $values) { $assigneeContact[] = CRM_Contact_BAO_Contact::displayname($values); diff --git a/CRM/Admin/Form/Setting.php b/CRM/Admin/Form/Setting.php index fdbf570755..9f540bfe97 100644 --- a/CRM/Admin/Form/Setting.php +++ b/CRM/Admin/Form/Setting.php @@ -94,7 +94,7 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { '1' => 1) + $cRSearchFields; // we can handle all the ones defined in the metadata here. Others to be converted - foreach ($this->_settings as $setting => $group){ + foreach ($this->_settings as $setting => $group) { $settingMetaData = civicrm_api('setting', 'getfields', array('version' => 3, 'name' => $setting)); $this->_defaults[$setting] = civicrm_api('setting', 'getvalue', array( 'version' => 3, @@ -135,12 +135,12 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { ) ); - foreach ($this->_settings as $setting => $group){ + foreach ($this->_settings as $setting => $group) { $settingMetaData = civicrm_api('setting', 'getfields', array('version' => 3, 'name' => $setting)); $props = $settingMetaData['values'][$setting]; - if (isset($props['quick_form_type'])){ + if (isset($props['quick_form_type'])) { $add = 'add' . $props['quick_form_type']; - if ($add == 'addElement'){ + if ($add == 'addElement') { $this->$add( $props['html_type'], $setting, @@ -153,11 +153,11 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { $this->$add($setting, ts($props['title'])); } $this->assign("{$setting}_description", ts($props['description'])); - if ($setting == 'max_attachments'){ + if ($setting == 'max_attachments') { //temp hack @todo fix to get from metadata $this->addRule('max_attachments', ts('Value should be a positive number'), 'positiveInteger'); } - if ($setting == 'maxFileSize'){ + if ($setting == 'maxFileSize') { //temp hack $this->addRule('maxFileSize', ts('Value should be a positive number'), 'positiveInteger'); } @@ -261,7 +261,7 @@ AND time_format <> '' } $settings = array_intersect_key($params, $this->_settings); $result = civicrm_api('setting', 'create', $settings + array('version' => 3)); - foreach ($settings as $setting => $settingGroup){ + foreach ($settings as $setting => $settingGroup) { //@todo array_diff this unset($params[$setting]); } diff --git a/CRM/Campaign/BAO/Survey.php b/CRM/Campaign/BAO/Survey.php index fc12cb4a12..40dc56dee3 100644 --- a/CRM/Campaign/BAO/Survey.php +++ b/CRM/Campaign/BAO/Survey.php @@ -409,7 +409,7 @@ SELECT survey.id as id, return NULL; } $reportId = CRM_Campaign_BAO_Survey::getReportID($id); - if ($reportId){ + if ($reportId) { CRM_Report_BAO_ReportInstance::del($reportId); } $dao = new CRM_Campaign_DAO_Survey(); diff --git a/CRM/Campaign/Form/Task/Interview.php b/CRM/Campaign/Form/Task/Interview.php index a6d5f0ceed..e8880a9c5c 100755 --- a/CRM/Campaign/Form/Task/Interview.php +++ b/CRM/Campaign/Form/Task/Interview.php @@ -307,7 +307,7 @@ WHERE {$clause} foreach ($this->_contactIds as $contactId) { //build the profile fields. foreach ($this->_surveyFields as $name => $field) { - if ($field){ + if ($field) { CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $contactId); } } diff --git a/CRM/Contact/BAO/Contact/Utils.php b/CRM/Contact/BAO/Contact/Utils.php index 915191fb7a..9cb6be8415 100644 --- a/CRM/Contact/BAO/Contact/Utils.php +++ b/CRM/Contact/BAO/Contact/Utils.php @@ -851,7 +851,7 @@ Group By componentId"; // make sure you preserve specific form values like location type, is_primary_ is_billing, master_id // CRM-10336: Also empty any fields from the existing address block if they don't exist in master (otherwise they will persist) foreach ($values as $field => $submittedValue) { - if (!in_array($field, $skipFields)){ + if (!in_array($field, $skipFields)) { if (isset($masterAddress->$field)) { $values[$field] = $masterAddress->$field; } diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index ab2bf906c1..6611bda45d 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -585,7 +585,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { elseif ($groupType == 'Access') { $value = CRM_Core_DAO::VALUE_SEPARATOR . '1' . CRM_Core_DAO::VALUE_SEPARATOR; } - elseif (!empty($groupType)){ + elseif (!empty($groupType)) { // ie we have been given the group key $value = CRM_Core_DAO::VALUE_SEPARATOR . $groupType . CRM_Core_DAO::VALUE_SEPARATOR; } diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index ebc7a081d5..c023513d29 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -89,7 +89,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { $relationshipId = CRM_Utils_Array::value('relationship', $ids, CRM_Utils_Array::value('id', $params)); //CRM-9015 - the hooks are called here & in add (since add doesn't call create) // but in future should be tidied per ticket - if (empty($relationshipId)){ + if (empty($relationshipId)) { $hook = 'create'; $action = CRM_Core_Action::ADD; } @@ -232,11 +232,11 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { $dateFields = array('end_date', 'start_date'); - foreach (self::getdefaults() as $defaultField => $defaultValue){ - if (isset($params[$defaultField])){ - if (in_array($defaultField, $dateFields)){ + foreach (self::getdefaults() as $defaultField => $defaultValue) { + if (isset($params[$defaultField])) { + if (in_array($defaultField, $dateFields)) { $relationship->$defaultField = CRM_Utils_Date::format(CRM_Utils_Array::value($defaultField, $params)); - if (!$relationship->$defaultField){ + if (!$relationship->$defaultField) { $relationship->$defaultField = 'NULL'; } } @@ -244,7 +244,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { $relationship->$defaultField = $params[$defaultField]; } } - elseif(!$relationshipId){ + elseif(!$relationshipId) { $relationship->$defaultField = $defaultValue; } } @@ -766,9 +766,9 @@ WHERE relationship_type_id = " . CRM_Utils_Type::escape($type, 'Integer'); */ $dateFields = array('end_date', 'start_date'); - foreach ($dateFields as $dateField){ + foreach ($dateFields as $dateField) { if (array_key_exists($dateField, $params)) { - if (empty($params[$dateField]) || $params[$dateField] == 'null'){ + if (empty($params[$dateField]) || $params[$dateField] == 'null') { //this is most likely coming from an api call & probably loaded // from the DB to deal with some of the // other myriad of excessive checks still in place both in @@ -776,7 +776,7 @@ WHERE relationship_type_id = " . CRM_Utils_Type::escape($type, 'Integer'); $queryString .= " AND $dateField IS NULL"; continue; } - elseif (is_array($params[$dateField])){ + elseif (is_array($params[$dateField])) { $queryString .= " AND $dateField = " . CRM_Utils_Type::escape(CRM_Utils_Date::format($params[$dateField]), 'Date'); } diff --git a/CRM/Contribute/Form/ContributionPage/AddProduct.php b/CRM/Contribute/Form/ContributionPage/AddProduct.php index c4694e42c5..60b71ace50 100644 --- a/CRM/Contribute/Form/ContributionPage/AddProduct.php +++ b/CRM/Contribute/Form/ContributionPage/AddProduct.php @@ -189,12 +189,12 @@ class CRM_Contribute_Form_ContributionPage_AddProduct extends CRM_Contribute_For 'account_relationship = 7' ); $productFinancialType = array_intersect($costFinancialType, $premiumFinancialType); - foreach ($financialType as $key => $financialTypeName ){ + foreach ($financialType as $key => $financialTypeName ) { if (!in_array( $key, $productFinancialType)) { unset( $financialType[$key] ); } } - if (count( $financialType ) ){ + if (count( $financialType ) ) { $this->assign( 'financialType', $financialType ); } $this->add( diff --git a/CRM/Contribute/Form/ManagePremiums.php b/CRM/Contribute/Form/ManagePremiums.php index 0a135e6d00..2cf4195a7b 100644 --- a/CRM/Contribute/Form/ManagePremiums.php +++ b/CRM/Contribute/Form/ManagePremiums.php @@ -167,12 +167,12 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { 'account_relationship = 7' ); $productFinancialType = array_intersect($costFinancialType, $premiumFinancialType); - foreach ($financialType as $key => $financialTypeName ){ + foreach ($financialType as $key => $financialTypeName ) { if (!in_array( $key, $productFinancialType)) { unset( $financialType[$key] ); } } - if (count( $financialType ) ){ + if (count( $financialType ) ) { $this->assign( 'financialType', $financialType ); } $this->add( diff --git a/CRM/Contribute/Import/Parser.php b/CRM/Contribute/Import/Parser.php index 1787bb1da0..0aa448c89a 100644 --- a/CRM/Contribute/Import/Parser.php +++ b/CRM/Contribute/Import/Parser.php @@ -451,7 +451,7 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser { $params[$this->_activeFields[$i]->_name] = array(); } $params[$this->_activeFields[$i]->_name][$i][$this->_activeFields[$i]->_softCreditField] = $this->_activeFields[$i]->_value; - if (isset($this->_activeFields[$i]->_softCreditType)){ + if (isset($this->_activeFields[$i]->_softCreditType)) { $params[$this->_activeFields[$i]->_name][$i]['soft_credit_type_id'] = $this->_activeFields[$i]->_softCreditType; } } diff --git a/CRM/Contribute/Import/Parser/Contribution.php b/CRM/Contribute/Import/Parser/Contribution.php index 5f0acf6264..1363ddd189 100644 --- a/CRM/Contribute/Import/Parser/Contribution.php +++ b/CRM/Contribute/Import/Parser/Contribution.php @@ -399,8 +399,8 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa //Delete all existing soft Contribution from contribution_soft table for pcp_id is_null $existingSoftCredit = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($dupeSoftCredit['contribution_id']); - if (isset($existingSoftCredit['soft_credit']) && !empty($existingSoftCredit['soft_credit'])){ - foreach ($existingSoftCredit['soft_credit'] as $key => $existingSoftCreditValues){ + if (isset($existingSoftCredit['soft_credit']) && !empty($existingSoftCredit['soft_credit'])) { + foreach ($existingSoftCredit['soft_credit'] as $key => $existingSoftCreditValues) { if (!empty($existingSoftCreditValues['soft_credit_id'])) { $deleteParams = array( 'id' => $existingSoftCreditValues['soft_credit_id'], diff --git a/CRM/Contribute/Page/ManagePremiums.php b/CRM/Contribute/Page/ManagePremiums.php index 9e3a6832b1..1f3f9aa8b2 100644 --- a/CRM/Contribute/Page/ManagePremiums.php +++ b/CRM/Contribute/Page/ManagePremiums.php @@ -170,7 +170,7 @@ class CRM_Contribute_Page_ManagePremiums extends CRM_Core_Page_Basic { $dao->id ); //Financial Type - if (!empty( $dao->financial_type_id ) ){ + if (!empty( $dao->financial_type_id ) ) { require_once 'CRM/Core/DAO.php'; $premiums[$dao->id]['financial_type_id'] = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_FinancialType', $dao->financial_type_id, 'name' ); } diff --git a/CRM/Contribute/Task.php b/CRM/Contribute/Task.php index 47904af7d0..f2855036c7 100644 --- a/CRM/Contribute/Task.php +++ b/CRM/Contribute/Task.php @@ -125,7 +125,7 @@ class CRM_Contribute_Task { unset(self::$_tasks[1]); } //CRM-12920 - check for edit permission - if (!CRM_Core_Permission::check('edit contributions') ){ + if (!CRM_Core_Permission::check('edit contributions') ) { unset(self::$_tasks[4], self::$_tasks[6]); } diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index fa1262af5a..d78f98b9b6 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -1025,7 +1025,7 @@ SELECT is_primary, if ($count > 2) { break; } - if (count($first_names) == 1){ + if (count($first_names) == 1) { $family = $first_names[current(array_keys($first_names))]['addressee_display']; } else { diff --git a/CRM/Core/BAO/Block.php b/CRM/Core/BAO/Block.php index 93ac3a3d98..23a2e22678 100644 --- a/CRM/Core/BAO/Block.php +++ b/CRM/Core/BAO/Block.php @@ -468,7 +468,7 @@ class CRM_Core_BAO_Block { $sql = "UPDATE $table SET is_primary = 0 WHERE contact_id = %1"; $sqlParams = array(1 => array($contactId, 'Integer')); // we don't want to create unecessary entries in the log_ tables so exclude the one we are working on - if (!empty($params['id'])){ + if (!empty($params['id'])) { $sql .= " AND id <> %2"; $sqlParams[2] = array($params['id'], 'Integer'); } @@ -513,7 +513,7 @@ class CRM_Core_BAO_Block { * @param array $locations * */ - public static function sortPrimaryFirst(&$locations){ + public static function sortPrimaryFirst(&$locations) { uasort($locations, 'self::primaryComparison'); } @@ -524,7 +524,7 @@ class CRM_Core_BAO_Block { * @param array $location2 * @return number */ - public static function primaryComparison($location1, $location2){ + public static function primaryComparison($location1, $location2) { $l1 = CRM_Utils_Array::value('is_primary', $location1); $l2 = CRM_Utils_Array::value('is_primary', $location2); if ($l1 == $l2) { diff --git a/CRM/Core/BAO/Email.php b/CRM/Core/BAO/Email.php index b009369d38..e9d3b1f138 100644 --- a/CRM/Core/BAO/Email.php +++ b/CRM/Core/BAO/Email.php @@ -90,7 +90,7 @@ UPDATE civicrm_email SET is_bulkmail = 0 WHERE contact_id = {$params['contact_id']} "; - if ($hook == 'edit'){ + if ($hook == 'edit') { $sql .= " AND id <> {$params['id']}"; } CRM_Core_DAO::executeQuery($sql); diff --git a/CRM/Core/BAO/FinancialTrxn.php b/CRM/Core/BAO/FinancialTrxn.php index bcb0c089c7..c885df5530 100644 --- a/CRM/Core/BAO/FinancialTrxn.php +++ b/CRM/Core/BAO/FinancialTrxn.php @@ -281,7 +281,7 @@ WHERE lt.entity_id = %1 "; $sqlParams = array(1 => array($entity_id, 'Integer'), 2 => array($entity_table, 'String')); $dao = CRM_Core_DAO::executeQuery($query, $sqlParams); - while ($dao->fetch()){ + while ($dao->fetch()) { $result[$dao->financial_trxn_id][$dao->id] = $dao->amount; } if (!empty($result)) { diff --git a/CRM/Core/BAO/OptionGroup.php b/CRM/Core/BAO/OptionGroup.php index a6db9f9887..3c3000ed9b 100644 --- a/CRM/Core/BAO/OptionGroup.php +++ b/CRM/Core/BAO/OptionGroup.php @@ -90,7 +90,7 @@ class CRM_Core_BAO_OptionGroup extends CRM_Core_DAO_OptionGroup { * @return object */ public static function add(&$params, $ids = array()) { - if (empty($params['id'])){ + if (empty($params['id'])) { $params['id'] = CRM_Utils_Array::value('optionGroup', $ids); } diff --git a/CRM/Core/BAO/OptionValue.php b/CRM/Core/BAO/OptionValue.php index 21dedd8b4a..336ff380fc 100644 --- a/CRM/Core/BAO/OptionValue.php +++ b/CRM/Core/BAO/OptionValue.php @@ -51,7 +51,7 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue { * @return object */ public static function create($params) { - if (empty($params['id'])){ + if (empty($params['id'])) { self::setDefaults($params); } $ids = array(); @@ -73,17 +73,17 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue { * * @param array $params */ - public static function setDefaults(&$params){ - if (CRM_Utils_Array::value('label', $params, NULL) === NULL){ + public static function setDefaults(&$params) { + if (CRM_Utils_Array::value('label', $params, NULL) === NULL) { $params['label'] = $params['name']; } - if (CRM_Utils_Array::value('name', $params, NULL) === NULL){ + if (CRM_Utils_Array::value('name', $params, NULL) === NULL) { $params['name'] = $params['label']; } - if (CRM_Utils_Array::value('weight', $params, NULL) === NULL){ + if (CRM_Utils_Array::value('weight', $params, NULL) === NULL) { $params['weight'] = self::getDefaultWeight($params); } - if (CRM_Utils_Array::value('value', $params, NULL) === NULL){ + if (CRM_Utils_Array::value('value', $params, NULL) === NULL) { $params['value'] = self::getDefaultValue($params); } } @@ -98,7 +98,7 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue { * * @return int */ - public static function getDefaultWeight($params){ + public static function getDefaultWeight($params) { return (int) CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', array('option_group_id' => $params['option_group_id'])); } @@ -110,10 +110,10 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue { * more complex decision making * @param array $params */ - public static function getDefaultValue($params){ + public static function getDefaultValue($params) { $bao = new CRM_Core_BAO_OptionValue(); $bao->option_group_id = $params['option_group_id']; - if (isset($params['domain_id'])){ + if (isset($params['domain_id'])) { $bao->domain_id = $params['domain_id']; } $bao->selectAdd(); diff --git a/CRM/Core/BAO/Setting.php b/CRM/Core/BAO/Setting.php index 0071309590..28e5a7c980 100644 --- a/CRM/Core/BAO/Setting.php +++ b/CRM/Core/BAO/Setting.php @@ -117,7 +117,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { * Allow key o be cleared * @param string $cacheKey */ - public static function flushCache($cacheKey){ + public static function flushCache($cacheKey) { unset(self::$_cache[$cacheKey]); $globalCache = CRM_Utils_Cache::singleton(); $globalCache->delete($cacheKey); @@ -283,22 +283,22 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { $fields = $result = array(); $fieldsToGet = self::validateSettingsInput(array_flip($settingsToReturn), $fields, FALSE); foreach ($domains as $domainID) { - if ($domainID != CRM_Core_Config::domainID()){ + if ($domainID != CRM_Core_Config::domainID()) { $reloadConfig = TRUE; CRM_Core_BAO_Domain::setDomain($domainID); } $config = CRM_Core_Config::singleton($reloadConfig, $reloadConfig); $result[$domainID] = array(); foreach ($fieldsToGet as $name => $value) { - if (!empty($fields['values'][$name]['prefetch'])){ + if (!empty($fields['values'][$name]['prefetch'])) { if (isset($params['filters']) && isset($params['filters']['prefetch']) - && $params['filters']['prefetch'] == 0){ + && $params['filters']['prefetch'] == 0) { // we are filtering out the prefetches from the return array // so we will skip continue; } $configKey = CRM_Utils_Array::value('config_key', $fields['values'][$name], $name); - if (isset($config->$configKey)){ + if (isset($config->$configKey)) { $setting = $config->$configKey; } } @@ -476,13 +476,13 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { } foreach ($domains as $domainID) { - if ($domainID != CRM_Core_Config::domainID()){ + if ($domainID != CRM_Core_Config::domainID()) { $reloadConfig = TRUE; CRM_Core_BAO_Domain::setDomain($domainID); } $result[$domainID] = array(); foreach ($fieldsToSet as $name => $value) { - if (empty($fields['values'][$name]['config_only'])){ + if (empty($fields['values'][$name]['config_only'])) { CRM_Core_BAO_Setting::_setItem( $fields['values'][$name], $value, @@ -494,22 +494,22 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { $domainID ); } - if (!empty($fields['values'][$name]['prefetch'])){ - if (!empty($fields['values'][$name]['config_key'])){ + if (!empty($fields['values'][$name]['prefetch'])) { + if (!empty($fields['values'][$name]['config_key'])) { $name = $fields['values'][$name]['config_key']; } $config_keys[$name] = $value; } $result[$domainID][$name] = $value; } - if ($reloadConfig){ + if ($reloadConfig) { CRM_Core_Config::singleton($reloadConfig, $reloadConfig); } - if (!empty($config_keys)){ + if (!empty($config_keys)) { CRM_Core_BAO_ConfigSetting::create($config_keys); } - if ($reloadConfig){ + if ($reloadConfig) { CRM_Core_BAO_Domain::resetDomain(); } } @@ -582,7 +582,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { * @fieldSpec array Metadata for given field (drawn from the xml) */ public static function validateSetting(&$value, $fieldSpec) { - if ($fieldSpec['type'] == 'String' && is_array($value)){ + if ($fieldSpec['type'] == 'String' && is_array($value)) { $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,$value) . CRM_Core_DAO::VALUE_SEPARATOR; } if (empty($fieldSpec['validate_callback'])) { @@ -802,7 +802,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { $spec = self::getSettingSpecification(NULL, array('name' => $name), $domainID); $configKey = CRM_Utils_Array::value('config_key', $spec[$name], CRM_Utils_Array::value('legacy_key', $spec[$name], $name)); //if the key is set to config_only we don't need to do anything - if (empty($spec[$name]['config_only'])){ + if (empty($spec[$name]['config_only'])) { if (!empty($values[$configKey])) { civicrm_api('setting', 'create', array('version' => 3, $name => $values[$configKey], 'domain_id' => $domainID)); } diff --git a/CRM/Core/CodeGen/Specification.php b/CRM/Core/CodeGen/Specification.php index 1e5e18af31..acbffbb0c9 100644 --- a/CRM/Core/CodeGen/Specification.php +++ b/CRM/Core/CodeGen/Specification.php @@ -377,13 +377,13 @@ class CRM_Core_CodeGen_Specification { ); $field['html'] = array(); foreach ($validOptions as $htmlOption) { - if (!empty($fieldXML->html->$htmlOption)){ + if (!empty($fieldXML->html->$htmlOption)) { $field['html'][$htmlOption] = $this->value($htmlOption, $fieldXML->html); } } } $field['pseudoconstant'] = $this->value('pseudoconstant', $fieldXML); - if (!empty($field['pseudoconstant'])){ + if (!empty($field['pseudoconstant'])) { //ok this is a bit long-winded but it gets there & is consistent with above approach $field['pseudoconstant'] = array(); $validOptions = array( @@ -402,7 +402,7 @@ class CRM_Core_CodeGen_Specification { 'callback', ); foreach ($validOptions as $pseudoOption) { - if (!empty($fieldXML->pseudoconstant->$pseudoOption)){ + if (!empty($fieldXML->pseudoconstant->$pseudoOption)) { $field['pseudoconstant'][$pseudoOption] = $this->value($pseudoOption, $fieldXML->pseudoconstant); } } diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index f40baf7826..12cd0557fd 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -814,7 +814,7 @@ LIKE %1 */ public static function schemaRequiresRebuilding($tables = array("civicrm_contact")) { $show = array(); - foreach ($tables as $tableName){ + foreach ($tables as $tableName) { if (!array_key_exists($tableName, $show)) { $query = "SHOW CREATE TABLE $tableName"; $dao = CRM_Core_DAO::executeQuery($query); @@ -828,7 +828,7 @@ LIKE %1 } $result = preg_match("/\bCONSTRAINT\b\s/i", $show[$tableName]) ? TRUE : FALSE; - if ($result == TRUE){ + if ($result == TRUE) { continue; } else { diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index c74529baca..17d8cab18d 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1486,9 +1486,9 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @todo standardise the format which dates are passed to the BAO layer in & remove date * handling from BAO */ - public function convertDateFieldsToMySQL(&$params){ - foreach ($this->_dateFields as $fieldName => $specs){ - if (!empty($params[$fieldName])){ + public function convertDateFieldsToMySQL(&$params) { + foreach ($this->_dateFields as $fieldName => $specs) { + if (!empty($params[$fieldName])) { $params[$fieldName] = CRM_Utils_Date::isoToMysql( CRM_Utils_Date::processDate( $params[$fieldName], @@ -1496,7 +1496,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { ); } else{ - if (isset($specs['default'])){ + if (isset($specs['default'])) { $params[$fieldName] = date('YmdHis', strtotime($specs['default'])); } } diff --git a/CRM/Core/OptionGroup.php b/CRM/Core/OptionGroup.php index eaf729749e..93e0993345 100644 --- a/CRM/Core/OptionGroup.php +++ b/CRM/Core/OptionGroup.php @@ -645,7 +645,7 @@ WHERE v.option_group_id = g.id * @param $name * @param array $params */ - public static function flush($name, $params = array()){ + public static function flush($name, $params = array()) { $defaults = array( 'flip' => FALSE, 'grouping' => FALSE, diff --git a/CRM/Core/Payment/AuthorizeNet.php b/CRM/Core/Payment/AuthorizeNet.php index 4719890b32..ddb2169ff8 100644 --- a/CRM/Core/Payment/AuthorizeNet.php +++ b/CRM/Core/Payment/AuthorizeNet.php @@ -285,7 +285,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment { * the date we entered to be respected */ $minDate = date_create('now', new DateTimeZone(self::TIMEZONE)); - if (strtotime($startDate->format('Y-m-d')) < strtotime($minDate->format('Y-m-d'))){ + if (strtotime($startDate->format('Y-m-d')) < strtotime($minDate->format('Y-m-d'))) { $startDate->setTimezone(new DateTimeZone(self::TIMEZONE)); } diff --git a/CRM/Core/Payment/AuthorizeNetIPN.php b/CRM/Core/Payment/AuthorizeNetIPN.php index adac3ac24d..276aa491d0 100644 --- a/CRM/Core/Payment/AuthorizeNetIPN.php +++ b/CRM/Core/Payment/AuthorizeNetIPN.php @@ -263,7 +263,7 @@ INNER JOIN civicrm_contribution co ON co.contribution_recur_id = cr.id $contRecur = CRM_Core_DAO::executeQuery($sql); $contRecur->fetch(); $ids['contributionRecur'] = $contRecur->id; - if ($ids['contact'] != $contRecur->contact_id){ + if ($ids['contact'] != $contRecur->contact_id) { CRM_Core_Error::debug_log_message("Recurring contribution appears to have been re-assigned from id {$ids['contact']} to {$contRecur->contact_id} Continuing with {$contRecur->contact_id} "); diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index c46a367833..9499243306 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -380,7 +380,7 @@ class CRM_Core_Payment_BaseIPN { $values['receipt_from_name'] = $domainValues[0]; $values['receipt_from_email'] = $domainValues[1]; } - if ($recurContrib && $recurContrib->id){ + if ($recurContrib && $recurContrib->id) { //CRM-13273 - is_email_receipt setting on recurring contribution should take precedence over contribution page setting $values['is_email_receipt'] = $recurContrib->is_email_receipt; } @@ -924,7 +924,7 @@ LIMIT 1;"; // we have a pledge now we need to get the oldest unpaid payment $paymentDetails = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($pledgeId); - if (empty($paymentDetails['id'])){ + if (empty($paymentDetails['id'])) { // we can assume this pledge is now completed // return now so we don't create a core error & roll back return; diff --git a/CRM/Core/Payment/Form.php b/CRM/Core/Payment/Form.php index 2264f41fd1..cd42687044 100644 --- a/CRM/Core/Payment/Form.php +++ b/CRM/Core/Payment/Form.php @@ -253,7 +253,7 @@ class CRM_Core_Payment_Form { * * @return bool */ - public static function buildPaymentForm($form, $processor, $isBillingDataOptional){ + public static function buildPaymentForm($form, $processor, $isBillingDataOptional) { //if the form has address fields assign to the template so the js can decide what billing fields to show $profileAddressFields = $form->get('profileAddressFields'); if (!empty($profileAddressFields)) { diff --git a/CRM/Core/Smarty/plugins/compiler.continue.php b/CRM/Core/Smarty/plugins/compiler.continue.php index 706ad47df5..2c4b202110 100644 --- a/CRM/Core/Smarty/plugins/compiler.continue.php +++ b/CRM/Core/Smarty/plugins/compiler.continue.php @@ -3,6 +3,6 @@ /** * Skip remaining logic in the current iteration of a loop. */ -function smarty_compiler_continue($contents, &$smarty){ +function smarty_compiler_continue($contents, &$smarty) { return 'continue;'; } diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 565c685cff..c698a3254e 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -849,7 +849,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m 'communication_style_id' => $value, ); - if (!empty($contact['preferred_communication_method'])){ + if (!empty($contact['preferred_communication_method'])) { // api 3 returns pref_comm_method as an array, which breaks the lookup; so we reconstruct $prefCommList = is_array($specialValues[$moniker]['preferred_communication_method']) ? implode(CRM_Core_DAO::VALUE_SEPARATOR, $specialValues[$moniker]['preferred_communication_method']) : $specialValues[$moniker]['preferred_communication_method']; $specialValues[$moniker]['preferred_communication_method'] = CRM_Core_DAO::VALUE_SEPARATOR . $prefCommList . CRM_Core_DAO::VALUE_SEPARATOR; diff --git a/CRM/Event/Form/ManageEvent/Fee.php b/CRM/Event/Form/ManageEvent/Fee.php index b2513a9c6e..94965bf0b8 100644 --- a/CRM/Event/Form/ManageEvent/Fee.php +++ b/CRM/Event/Form/ManageEvent/Fee.php @@ -761,7 +761,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { //create discount priceset $priceField = CRM_Price_BAO_PriceField::create($fieldParams); if (!empty($discountFieldIDs[$j])) { - foreach ($discountFieldIDs[$j] as $fID){ + foreach ($discountFieldIDs[$j] as $fID) { CRM_Price_BAO_PriceFieldValue::setIsActive($fID, '0'); } } diff --git a/CRM/Event/Form/ParticipantFeeSelection.php b/CRM/Event/Form/ParticipantFeeSelection.php index a88596a293..66e3099d64 100644 --- a/CRM/Event/Form/ParticipantFeeSelection.php +++ b/CRM/Event/Form/ParticipantFeeSelection.php @@ -240,7 +240,7 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { CRM_Event_BAO_Participant::changeFeeSelections($params, $this->_participantId, $this->_contributionId, $feeBlock, $lineItems, $this->_paidAmount, $params['priceSetId']); $this->contributionAmt = CRM_Core_DAO::getFieldValue('CRM_Contribute_BAO_Contribution', $this->_contributionId, 'total_amount'); // email sending - if (CRM_Utils_Array::value('send_receipt', $params)){ + if (CRM_Utils_Array::value('send_receipt', $params)) { $fetchParticipantVals = array('id' => $this->_participantId); CRM_Event_BAO_Participant::getValues($fetchParticipantVals, $participantDetails, CRM_Core_DAO::$_nullArray); $participantParams = array_merge($params, $participantDetails[$this->_participantId]); diff --git a/CRM/Event/Task.php b/CRM/Event/Task.php index cd0ac30fcf..fa9b877582 100644 --- a/CRM/Event/Task.php +++ b/CRM/Event/Task.php @@ -139,7 +139,7 @@ class CRM_Event_Task { unset(self::$_tasks[1]); } //CRM-12920 - check for edit permission - if (!CRM_Core_Permission::check('edit event participants') ){ + if (!CRM_Core_Permission::check('edit event participants') ) { unset(self::$_tasks[4], self::$_tasks[5], self::$_tasks[15]); } } diff --git a/CRM/Financial/BAO/PaymentProcessor.php b/CRM/Financial/BAO/PaymentProcessor.php index 3797908d43..6b9354bfa9 100644 --- a/CRM/Financial/BAO/PaymentProcessor.php +++ b/CRM/Financial/BAO/PaymentProcessor.php @@ -243,7 +243,7 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces * @param array_type $processor2 * @return number */ - public static function defaultComparison($processor1, $processor2){ + public static function defaultComparison($processor1, $processor2) { $p1 = CRM_Utils_Array::value('is_default', $processor1); $p2 = CRM_Utils_Array::value('is_default', $processor2); if ($p1 == $p2) { diff --git a/CRM/Financial/Page/AJAX.php b/CRM/Financial/Page/AJAX.php index 8f3491c78d..65d9682fbc 100644 --- a/CRM/Financial/Page/AJAX.php +++ b/CRM/Financial/Page/AJAX.php @@ -79,7 +79,7 @@ class CRM_Financial_Page_AJAX { ) ); - if (!empty($result)){ + if (!empty($result)) { foreach ($result as $id => $name) { $selectedArray = array(); if ($id == $defaultId) { @@ -128,7 +128,7 @@ class CRM_Financial_Page_AJAX { if (!empty($result)) { foreach ($result as $id => $name) { if (in_array($id, $financialAccountType[$financialAccountTypeId]) && $_GET['_value'] != 'select') { - if ($countResult != 1){ + if ($countResult != 1) { $elements[] = array( 'name' => $name, 'value' => $id, @@ -142,7 +142,7 @@ class CRM_Financial_Page_AJAX { ); } } - elseif ($_GET['_value'] == 'select'){ + elseif ($_GET['_value'] == 'select') { $elements[] = array( 'name' => $name, 'value' => $id, diff --git a/CRM/Financial/Page/FinancialType.php b/CRM/Financial/Page/FinancialType.php index a7add5d117..15269c3827 100644 --- a/CRM/Financial/Page/FinancialType.php +++ b/CRM/Financial/Page/FinancialType.php @@ -149,7 +149,7 @@ class CRM_Financial_Page_FinancialType extends CRM_Core_Page_Basic { $params['entity_table'] = 'civicrm_financial_type'; CRM_Financial_BAO_FinancialTypeAccount::retrieve($params, CRM_Core_DAO::$_nullArray, $financialAccountIds); - foreach ($financialAccountIds as $key => $values){ + foreach ($financialAccountIds as $key => $values) { if (!empty($financialAccounts[$values['financial_account_id']])) { $financialAccountId[$values['financial_account_id']] = CRM_Utils_Array::value( $values['financial_account_id'], $financialAccounts ); diff --git a/CRM/Grant/BAO/Grant.php b/CRM/Grant/BAO/Grant.php index 7873796c18..4eba56bb94 100644 --- a/CRM/Grant/BAO/Grant.php +++ b/CRM/Grant/BAO/Grant.php @@ -208,7 +208,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { $grantTypes = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'grant_type_id'); if (empty($params['skipRecentView'])) { - if (!isset($grant->contact_id) || !isset($grant->grant_type_id)){ + if (!isset($grant->contact_id) || !isset($grant->grant_type_id)) { $grant->find(TRUE); } $title = CRM_Contact_BAO_Contact::displayName($grant->contact_id) . ' - ' . ts('Grant') . ': ' . $grantTypes[$grant->grant_type_id]; diff --git a/CRM/Mailing/Form/Schedule.php b/CRM/Mailing/Form/Schedule.php index b59b388657..24a8d71114 100644 --- a/CRM/Mailing/Form/Schedule.php +++ b/CRM/Mailing/Form/Schedule.php @@ -55,7 +55,7 @@ class CRM_Mailing_Form_Schedule extends CRM_Core_Form { $ssID = $this->get('ssID'); $this->assign('ssid', $ssID); $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context')); - if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID){ + if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID) { $params = array(); $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts(); $this->assign("value", $result); diff --git a/CRM/Mailing/Form/Settings.php b/CRM/Mailing/Form/Settings.php index 824284858a..2c409047e4 100644 --- a/CRM/Mailing/Form/Settings.php +++ b/CRM/Mailing/Form/Settings.php @@ -48,7 +48,7 @@ class CRM_Mailing_Form_Settings extends CRM_Core_Form { $ssID = $this->get('ssID'); $this->assign('ssid', $ssID); $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context')); - if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID){ + if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID) { $params = array(); $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts(); $this->assign("value", $result); diff --git a/CRM/Mailing/Form/Test.php b/CRM/Mailing/Form/Test.php index 30bb49ab5f..d77e7507c9 100644 --- a/CRM/Mailing/Form/Test.php +++ b/CRM/Mailing/Form/Test.php @@ -48,7 +48,7 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form { $ssID = $this->get('ssID'); $this->assign('ssid', $ssID); $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context')); - if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID){ + if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID) { $params = array(); $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts(); $this->assign("value", $result); diff --git a/CRM/Mailing/Form/Upload.php b/CRM/Mailing/Form/Upload.php index ee11d3a02c..dfd088ddaa 100644 --- a/CRM/Mailing/Form/Upload.php +++ b/CRM/Mailing/Form/Upload.php @@ -50,7 +50,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { $ssID = $this->get('ssID'); $this->assign('ssid', $ssID); $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context')); - if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID){ + if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID) { $params = array(); $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts(); $this->assign("value", $result); diff --git a/CRM/Member/BAO/MembershipStatus.php b/CRM/Member/BAO/MembershipStatus.php index a679e9a8ce..860adfddd6 100644 --- a/CRM/Member/BAO/MembershipStatus.php +++ b/CRM/Member/BAO/MembershipStatus.php @@ -93,9 +93,9 @@ class CRM_Member_BAO_MembershipStatus extends CRM_Member_DAO_MembershipStatus { * @return CRM_Member_BAO_MembershipStatus object * @static */ - public static function create($params){ + public static function create($params) { $ids = array(); - if (!empty($params['id'])){ + if (!empty($params['id'])) { $ids['membershipStatus'] = $params['id']; } else{ diff --git a/CRM/Member/BAO/MembershipType.php b/CRM/Member/BAO/MembershipType.php index 9eb1d699b7..1edeb1609e 100644 --- a/CRM/Member/BAO/MembershipType.php +++ b/CRM/Member/BAO/MembershipType.php @@ -393,7 +393,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { // Check if we are on or after rollover day of the month - CRM-10585 // If so, set fixed_period_rollover TRUE so we increment end_date month below. $dateParts = explode('-', $actualStartDate); - if ($dateParts[2] >= $membershipTypeDetails['fixed_period_rollover_day']){ + if ($dateParts[2] >= $membershipTypeDetails['fixed_period_rollover_day']) { $fixed_period_rollover = TRUE; } @@ -756,7 +756,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { * @param integer financial type id */ public static function updateAllPriceFieldValue($membershipTypeId, $params) { - if (!empty($params['minimum_fee'])){ + if (!empty($params['minimum_fee'])) { $amount = $params['minimum_fee']; } else { diff --git a/CRM/Member/Form.php b/CRM/Member/Form.php index c3b9dcda01..36b2284077 100644 --- a/CRM/Member/Form.php +++ b/CRM/Member/Form.php @@ -198,7 +198,7 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment { * - contact_id * - soft_credit_contact_id */ - public function storeContactFields($formValues){ + public function storeContactFields($formValues) { // in a 'standalone form' (contact id not in the url) the contact will be in the form values if (!empty($formValues['contact_id'])) { $this->_contactID = $formValues['contact_id']; diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 33b3329494..519e078f56 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -374,7 +374,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $this->assign('currency', $config->defaultCurrencySymbol); $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); - if (isset($invoicing)){ + if (isset($invoicing)) { $this->assign('taxTerm', CRM_Utils_Array::value('tax_term', $invoiceSettings)); } // build price set form. diff --git a/CRM/Member/Form/MembershipBlock.php b/CRM/Member/Form/MembershipBlock.php index 43884b48f1..1a8a3e123c 100644 --- a/CRM/Member/Form/MembershipBlock.php +++ b/CRM/Member/Form/MembershipBlock.php @@ -431,7 +431,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa } $priceField = CRM_Price_BAO_PriceField::create($fieldParams); } - elseif (!$priceSetID){ + elseif (!$priceSetID) { $deletePriceSet = 1; } diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index c5ca5d063c..56c3879ef0 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -698,9 +698,9 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } //assign contribution contact id to the field expected by recordMembershipContribution - if ($this->_contributorContactID != $this->_contactID){ + if ($this->_contributorContactID != $this->_contactID) { $formValues['contribution_contact_id'] = $this->_contributorContactID; - if (!empty($this->_params['soft_credit_type_id'])){ + if (!empty($this->_params['soft_credit_type_id'])) { $formValues['soft_credit'] = array( 'soft_credit_type_id' => $this->_params['soft_credit_type_id'], 'contact_id' => $this->_contactID, diff --git a/CRM/Member/Form/MembershipType.php b/CRM/Member/Form/MembershipType.php index 9d7423c1a6..85545ecc5d 100644 --- a/CRM/Member/Form/MembershipType.php +++ b/CRM/Member/Form/MembershipType.php @@ -374,7 +374,7 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form_MembershipConfig { $dat = ($dat < 10) ? '0' . $dat : $dat; $params[$per] = $mon . $dat; } - else if($per == 'fixed_period_rollover_day' && !empty($params['month_fixed_period_rollover_day'])){ + else if($per == 'fixed_period_rollover_day' && !empty($params['month_fixed_period_rollover_day'])) { $params['fixed_period_rollover_day'] = $params['month_fixed_period_rollover_day']['d']; unset($params['month_fixed_period_rollover_day']); } diff --git a/CRM/Member/Task.php b/CRM/Member/Task.php index 2509e040e5..6032645fb8 100644 --- a/CRM/Member/Task.php +++ b/CRM/Member/Task.php @@ -118,7 +118,7 @@ class CRM_Member_Task { unset(self::$_tasks[1]); } //CRM-12920 - check for edit permission - if (!CRM_Core_Permission::check('edit memberships') ){ + if (!CRM_Core_Permission::check('edit memberships') ) { unset(self::$_tasks[5]); } } diff --git a/CRM/Price/Page/Option.php b/CRM/Price/Page/Option.php index 0e538d2206..a4da057bf9 100644 --- a/CRM/Price/Page/Option.php +++ b/CRM/Price/Page/Option.php @@ -145,7 +145,7 @@ class CRM_Price_Page_Option extends CRM_Core_Page { $taxAmount = CRM_Contribute_BAO_Contribution_Utils::calculateTaxAmount($customOption[$id]['amount'], $customOption[$id]['tax_rate']); $customOption[$id]['tax_amount'] = $taxAmount['tax_amount']; } - if (!empty($values['financial_type_id'])){ + if (!empty($values['financial_type_id'])) { $customOption[$id]['financial_type_id'] = $financialType[$values['financial_type_id']]; } // update enable/disable links depending on price_field properties. diff --git a/CRM/Profile/Selector/Listings.php b/CRM/Profile/Selector/Listings.php index bdb01b7e07..e9025d246c 100644 --- a/CRM/Profile/Selector/Listings.php +++ b/CRM/Profile/Selector/Listings.php @@ -684,7 +684,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR // pass record id param to view url for multi record view if ($multiRecordTableId && $newLinks) { - if ($result->$multiRecordTableId){ + if ($result->$multiRecordTableId) { if ($newLinks[CRM_Core_Action::VIEW]['url'] == 'civicrm/profile/view') { $newLinks[CRM_Core_Action::VIEW]['qs'] .= "&multiRecord=view&recordId=%%recordId%%&allFields=1"; $params['recordId'] = $result->$multiRecordTableId; diff --git a/CRM/Queue/ErrorPolicy.php b/CRM/Queue/ErrorPolicy.php index afc762ee6d..817e112069 100644 --- a/CRM/Queue/ErrorPolicy.php +++ b/CRM/Queue/ErrorPolicy.php @@ -31,7 +31,7 @@ * * @code * $errorContainer = new CRM_Queue_ErrorPolicy(); - * $errorContainer->call(function(){ + * $errorContainer->call(function() { * ...include some files, do some work, etc... * }); * @endcode diff --git a/CRM/Report/Form/Instance.php b/CRM/Report/Form/Instance.php index b3e76d0e41..6352f86179 100644 --- a/CRM/Report/Form/Instance.php +++ b/CRM/Report/Form/Instance.php @@ -214,7 +214,7 @@ class CRM_Report_Form_Instance { $instanceID = $form->getVar('_id'); $navigationDefaults = array(); - if (!isset($defaults['permission'])){ + if (!isset($defaults['permission'])) { $permissions = array_flip(CRM_Core_Permission::basicPermissions( )); $defaults['permission'] = $permissions['CiviReport: access CiviReport']; } @@ -285,7 +285,7 @@ class CRM_Report_Form_Instance { if (!empty($params['is_navigation'])) { $params['navigation'] = $form->_navigation; } - elseif ($instanceID){ + elseif ($instanceID) { //delete navigation if exists $navId = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_ReportInstance', $instanceID, 'navigation_id', 'id'); if ($navId) { diff --git a/CRM/SMS/Page/Callback.php b/CRM/SMS/Page/Callback.php index 015fef0a6a..734652ea5a 100644 --- a/CRM/SMS/Page/Callback.php +++ b/CRM/SMS/Page/Callback.php @@ -36,10 +36,10 @@ class CRM_SMS_Page_Callback { - public function run(){ + public function run() { $provider = CRM_SMS_Provider::singleton($_REQUEST); - if (array_key_exists('status',$_REQUEST)){ + if (array_key_exists('status',$_REQUEST)) { $provider->callback(); } else { diff --git a/CRM/UF/Page/ProfileEditor.php b/CRM/UF/Page/ProfileEditor.php index d1875fff47..73d6f3bf69 100644 --- a/CRM/UF/Page/ProfileEditor.php +++ b/CRM/UF/Page/ProfileEditor.php @@ -19,7 +19,7 @@ class CRM_UF_Page_ProfileEditor extends CRM_Core_Page { $loaded = TRUE; CRM_Core_Resources::singleton() - ->addSettingsFactory(function(){ + ->addSettingsFactory(function() { return array( 'PseudoConstant' => array( 'locationType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), diff --git a/CRM/Upgrade/Incremental/php/FourFour.php b/CRM/Upgrade/Incremental/php/FourFour.php index 4bd43d2ef0..8f08205e46 100644 --- a/CRM/Upgrade/Incremental/php/FourFour.php +++ b/CRM/Upgrade/Incremental/php/FourFour.php @@ -105,7 +105,7 @@ WHERE ceft.entity_table = 'civicrm_contribution' AND cft.payment_instrument_id I $postUpgradeMessage .= '

' . ts('Your database contains %1 financial transaction records with no payment instrument (Paid By is empty). If you use the Accounting Batches feature this may result in unbalanced transactions. If you do not use this feature, you can ignore the condition (although you will be required to select a Paid By value for new transactions). You can review steps to correct transactions with missing payment instruments on the wiki.', array(1 => $dao->N, 2 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Fixing+Transactions+Missing+a+Payment+Instrument+-+4.4.3+Upgrades')) . ''; } } - if ($rev == '4.4.6'){ + if ($rev == '4.4.6') { $postUpgradeMessage .= '

'. ts('Your contact image urls have been upgraded. If your contact image urls did not follow the standard format for image Urls they have not been upgraded. Please check the log to see image urls that were not upgraded.'); } } @@ -335,7 +335,7 @@ ALTER TABLE civicrm_dashboard /** * @param $rev */ - public function upgrade_4_4_6($rev){ + public function upgrade_4_4_6($rev) { $sql = "SELECT count(*) AS count FROM INFORMATION_SCHEMA.STATISTICS where ". "TABLE_SCHEMA = database() AND INDEX_NAME = 'index_image_url' AND TABLE_NAME = 'civicrm_contact';"; $dao = CRM_Core_DAO::executeQuery($sql); @@ -376,18 +376,18 @@ ALTER TABLE civicrm_dashboard $this->addTask(ts('Update saved search information'), 'changeSavedSearch'); } - public static function upgradeImageUrls(CRM_Queue_TaskContext $ctx, $startId, $endId){ + public static function upgradeImageUrls(CRM_Queue_TaskContext $ctx, $startId, $endId) { $dao = self::findContactImageUrls($startId, $endId); $failures = array(); - while ($dao->fetch()){ + while ($dao->fetch()) { $imageURL = $dao->image_url; $baseurl = CIVICRM_UF_BASEURL; $baselen = strlen($baseurl); - if (substr($imageURL, 0, $baselen) == $baseurl){ + if (substr($imageURL, 0, $baselen) == $baseurl) { $photo = basename($dao->image_url); $config = CRM_Core_Config::singleton(); $fullpath = $config->customFileUploadDir.$photo; - if (file_exists($fullpath)){ + if (file_exists($fullpath)) { // For anyone who upgraded 4.4.6 release (eg 4.4.0=>4.4.6), the $newImageUrl incorrectly used backend URLs. // For anyone who skipped 4.4.6 (eg 4.4.0=>4.4.7), the $newImageUrl correctly uses frontend URLs self::setContactImageUrl($dao->id, diff --git a/CRM/Upgrade/Incremental/php/FourThree.php b/CRM/Upgrade/Incremental/php/FourThree.php index 95f4466156..6496c4e663 100644 --- a/CRM/Upgrade/Incremental/php/FourThree.php +++ b/CRM/Upgrade/Incremental/php/FourThree.php @@ -905,7 +905,7 @@ AND TABLE_SCHEMA = %1 "; $params = array(1 => array($dbUf['database'], 'String')); $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, NULL, FALSE, FALSE); - foreach ($tables as $columnName => $value){ + foreach ($tables as $columnName => $value) { if ($value['tableName'] == 'civicrm_membership_type' || $value['tableName'] == 'civicrm_contribution_recur') { $foreignKeyExists = CRM_Core_DAO::checkConstraintExists($value['tableName'], $value['fkey']); $fKey = $value['fkey']; diff --git a/CRM/Upgrade/Incremental/php/FourTwo.php b/CRM/Upgrade/Incremental/php/FourTwo.php index ce76d29358..5761a637ee 100644 --- a/CRM/Upgrade/Incremental/php/FourTwo.php +++ b/CRM/Upgrade/Incremental/php/FourTwo.php @@ -62,7 +62,7 @@ class CRM_Upgrade_Incremental_php_FourTwo { public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) { if ($rev == '4.2.alpha1') { $tables = array('civicrm_contribution_page', 'civicrm_event', 'civicrm_group', 'civicrm_contact'); - if (!CRM_Core_DAO::schemaRequiresRebuilding($tables)){ + if (!CRM_Core_DAO::schemaRequiresRebuilding($tables)) { $errors = ts("The upgrade has identified some schema integrity issues in the database. It seems some of your constraints are missing. You will have to rebuild your schema before re-trying the upgrade. Please refer to %1.", array(1 => CRM_Utils_System::docURL2("Ensuring Schema Integrity on Upgrades", FALSE, "Ensuring Schema Integrity on Upgrades", NULL, NULL, "wiki"))); CRM_Core_Error::fatal($errors); return FALSE; @@ -181,9 +181,9 @@ INNER JOIN civicrm_price_set cps ON cps.id = cpf.price_set_id AND cps.name <>'de 'civicrm_event' => 'FK_civicrm_event_payment_processor_id', 'civicrm_group' => 'FK_civicrm_group_saved_search_id', ); - foreach ($tables as $tableName => $fKey){ + foreach ($tables as $tableName => $fKey) { $foreignKeyExists = CRM_Core_DAO::checkConstraintExists($tableName, $fKey); - if ($foreignKeyExists){ + if ($foreignKeyExists) { CRM_Core_DAO::executeQuery("ALTER TABLE {$tableName} DROP FOREIGN KEY {$fKey}", $params, TRUE, NULL, FALSE, FALSE); CRM_Core_DAO::executeQuery("ALTER TABLE {$tableName} DROP INDEX {$fKey}", $params, TRUE, NULL, FALSE, FALSE); } @@ -370,7 +370,7 @@ HAVING COUNT(cpse.price_set_id) > 1 AND MIN(cpse1.id) <> cpse.id "; } } - public function convertContribution(){ + public function convertContribution() { $minContributionId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(min(id),0) FROM civicrm_contribution'); $maxContributionId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(max(id),0) FROM civicrm_contribution'); for ($startId = $minContributionId; $startId <= $maxContributionId; $startId += self::BATCH_SIZE) { @@ -680,13 +680,13 @@ WHERE cpf.price_set_id = %1 //CRM-12273 //check if price_set_id is exist, if not use the default contribution amount - if (isset($result->price_set_id)){ + if (isset($result->price_set_id)) { $priceSetId = $result->price_set_id; } else{ $defaultPriceSets = CRM_Price_BAO_PriceSet::getDefaultPriceSet(); foreach ($defaultPriceSets as $key => $pSet) { - if ($pSet['name'] == 'contribution_amount'){ + if ($pSet['name'] == 'contribution_amount') { $priceSetId = $pSet['setID']; } } diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index 25a7c0d4ba..4bf12d17c8 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -991,7 +991,7 @@ function _civicrm_api3_deprecated_add_formatted_location_blocks(&$values, &$para continue; } - if ($name == 'phone_ext'){ + if ($name == 'phone_ext') { $block = 'Phone'; } diff --git a/CRM/Utils/PDF/Utils.php b/CRM/Utils/PDF/Utils.php index 9197ef0169..1332284b7e 100644 --- a/CRM/Utils/PDF/Utils.php +++ b/CRM/Utils/PDF/Utils.php @@ -136,7 +136,7 @@ class CRM_Utils_PDF_Utils { $pdf = new TCPDF($orientation, 'pt', $paper_size_arr); $pdf->Open(); - if (is_readable($stationery_path)){ + if (is_readable($stationery_path)) { $pdf->SetStationery( $stationery_path ); } diff --git a/CRM/Utils/REST.php b/CRM/Utils/REST.php index d0e62a291f..09abcf5e3b 100644 --- a/CRM/Utils/REST.php +++ b/CRM/Utils/REST.php @@ -483,7 +483,7 @@ class CRM_Utils_REST { $tpl = 'CRM/'.$entity.'/Page/Inline/'.$tplfile.'.tpl'; $smarty = CRM_Core_Smarty::singleton( ); CRM_Utils_System::setTitle( "$entity::$tplfile inline $tpl" ); - if (!$smarty->template_exists($tpl) ){ + if (!$smarty->template_exists($tpl) ) { header("Status: 404 Not Found"); die ("Can't find the requested template file templates/$tpl"); } diff --git a/CRM/Utils/SoapServer.php b/CRM/Utils/SoapServer.php index 1dca58014c..9287b9e127 100644 --- a/CRM/Utils/SoapServer.php +++ b/CRM/Utils/SoapServer.php @@ -129,7 +129,7 @@ class CRM_Utils_SoapServer { public function authenticate($name, $pass, $loadCMSBootstrap = FALSE) { require_once str_replace('_', DIRECTORY_SEPARATOR, $this->ufClass) . '.php'; - if ($this->ufClass == 'CRM_Utils_System_Joomla'){ + if ($this->ufClass == 'CRM_Utils_System_Joomla') { $loadCMSBootstrap = TRUE; } diff --git a/CRM/Utils/System/Base.php b/CRM/Utils/System/Base.php index d978060828..f06d6c3732 100644 --- a/CRM/Utils/System/Base.php +++ b/CRM/Utils/System/Base.php @@ -238,15 +238,15 @@ abstract class CRM_Utils_System_Base { * * FIXME: Document values accepted/required by $params */ - public function userLoginFinalize($params = array()){ + public function userLoginFinalize($params = array()) { } /** * Set timezone in mysql so that timestamp fields show the correct time */ - public function setMySQLTimeZone(){ + public function setMySQLTimeZone() { $timeZoneOffset = $this->getTimeZoneOffset(); - if ($timeZoneOffset){ + if ($timeZoneOffset) { $sql = "SET time_zone = '$timeZoneOffset'"; CRM_Core_DAO::executequery($sql); } @@ -258,7 +258,7 @@ abstract class CRM_Utils_System_Base { * * @return string|false|null */ - public function getTimeZoneOffset(){ + public function getTimeZoneOffset() { $timezone = $this->getTimeZoneString(); if ($timezone) { $tzObj = new DateTimeZone($timezone); diff --git a/CRM/Utils/System/Drupal.php b/CRM/Utils/System/Drupal.php index 0dd24bb0b1..39c250d697 100644 --- a/CRM/Utils/System/Drupal.php +++ b/CRM/Utils/System/Drupal.php @@ -64,7 +64,7 @@ class CRM_Utils_System_Drupal extends CRM_Utils_System_DrupalBase { $form_state['input']['pass'] = array('pass1' => $params['cms_pass'], 'pass2' => $params['cms_pass']); } - if (!empty($params['notify'])){ + if (!empty($params['notify'])) { $form_state['input']['notify'] = $params['notify']; } @@ -569,7 +569,7 @@ AND u.status = 1 * * FIXME: Document values accepted/required by $params */ - public function userLoginFinalize($params = array()){ + public function userLoginFinalize($params = array()) { user_login_finalize($params); } @@ -964,7 +964,7 @@ AND u.status = 1 * @param int $drupalID * Drupal User ID. */ - public function og_membership_create($ogID, $drupalID){ + public function og_membership_create($ogID, $drupalID) { if (function_exists('og_entity_query_alter')) { // sort-of-randomly chose a function that only exists in the // 7.x-2.x branch // diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index b7bf37554d..2adddbf9a1 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -933,7 +933,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase { * @param int $drupalID * Drupal User ID. */ - public function og_membership_create($ogID, $drupalID){ + public function og_membership_create($ogID, $drupalID) { og_save_subscription( $ogID, $drupalID, array( 'is_active' => 1 ) ); } diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index df77f22ac5..afeaf0c5bb 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -66,7 +66,7 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { * - $siteName, * - $siteRoot */ - public function getDefaultSiteSettings($dir){ + public function getDefaultSiteSettings($dir) { $config = CRM_Core_Config::singleton(); $siteName = $siteRoot = NULL; $matches = array(); @@ -473,7 +473,7 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { * FIXME: Document values accepted/required by $params * */ - public function userLoginFinalize($params = array()){ + public function userLoginFinalize($params = array()) { user_login_finalize($params); } diff --git a/CRM/Utils/System/Joomla.php b/CRM/Utils/System/Joomla.php index 05135adfa3..9d999fa346 100644 --- a/CRM/Utils/System/Joomla.php +++ b/CRM/Utils/System/Joomla.php @@ -834,7 +834,7 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { * - $siteName, * - $siteRoot */ - public function getDefaultSiteSettings($dir){ + public function getDefaultSiteSettings($dir) { $config = CRM_Core_Config::singleton(); $url = preg_replace( '|/administrator|', diff --git a/api/api.php b/api/api.php index 32a036fca4..93e63cc2a6 100644 --- a/api/api.php +++ b/api/api.php @@ -41,7 +41,7 @@ function civicrm_api($entity, $action, $params, $extra = NULL) { function civicrm_api3($entity, $action, $params = array()) { $params['version'] = 3; $result = civicrm_api($entity, $action, $params); - if (is_array($result) && !empty($result['is_error'])){ + if (is_array($result) && !empty($result['is_error'])) { throw new CiviCRM_API3_Exception($result['error_message'], CRM_Utils_Array::value('error_code', $result, 'undefined'), $result); } return $result; @@ -178,7 +178,7 @@ function _civicrm_api_get_entity_name_from_camel($entity) { * DAO being passed in. * @return string */ -function _civicrm_api_get_entity_name_from_dao($bao){ +function _civicrm_api_get_entity_name_from_dao($bao) { $daoName = str_replace("BAO", "DAO", get_class($bao)); return _civicrm_api_get_entity_name_from_camel(CRM_Core_DAO_AllCoreTables::getBriefName($daoName)); } diff --git a/api/v3/Constant.php b/api/v3/Constant.php index 21a429d036..ba3f964bbb 100644 --- a/api/v3/Constant.php +++ b/api/v3/Constant.php @@ -128,7 +128,7 @@ function civicrm_api3_constant_get($params) { } else{ $values = call_user_func(array('CRM_Utils_PseudoConstant', 'getConstant'), $name); - if (!empty($values)){ + if (!empty($values)) { return civicrm_api3_create_success($values, $params, 'constant'); } } diff --git a/api/v3/Contribution.php b/api/v3/Contribution.php index 5916409c5e..749ec6ce70 100644 --- a/api/v3/Contribution.php +++ b/api/v3/Contribution.php @@ -152,16 +152,16 @@ function _civicrm_api3_contribution_create_spec(&$params) { * the core code or schema - this means we have to provide support for api calls (where possible) * across schema changes. */ -function _civicrm_api3_contribution_create_legacy_support_45(&$params){ +function _civicrm_api3_contribution_create_legacy_support_45(&$params) { //legacy soft credit handling - recommended approach is chaining - if (!empty($params['soft_credit_to'])){ + if (!empty($params['soft_credit_to'])) { $params['soft_credit'][] = array( 'contact_id' => $params['soft_credit_to'], 'amount' => $params['total_amount'], 'soft_credit_type_id' => CRM_Core_OptionGroup::getDefaultValue("soft_credit_type") ); } - if (!empty($params['honor_contact_id'])){ + if (!empty($params['honor_contact_id'])) { $params['soft_credit'][] = array( 'contact_id' => $params['honor_contact_id'], 'amount' => $params['total_amount'], @@ -224,7 +224,7 @@ function civicrm_api3_contribution_get($params) { $contribution_details = $query->store($dao); $softContribution = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($dao->contribution_id, TRUE); $contribution[$dao->contribution_id] = array_merge($contribution_details, $softContribution); - if (isset($contribution[$dao->contribution_id]['financial_type_id'])){ + if (isset($contribution[$dao->contribution_id]['financial_type_id'])) { $contribution[$dao->contribution_id]['financial_type_id'] = $contribution[$dao->contribution_id]['financial_type_id']; } // format soft credit for backward compatibility @@ -423,11 +423,11 @@ function civicrm_api3_contribution_completetransaction(&$params) { $contribution = new CRM_Contribute_BAO_Contribution(); $contribution->id = $params['id']; $contribution->find(TRUE); - if (!$contribution->id == $params['id']){ + if (!$contribution->id == $params['id']) { throw new API_Exception('A valid contribution ID is required', 'invalid_data'); } try { - if (!$contribution->loadRelatedObjects($input, $ids, FALSE, TRUE)){ + if (!$contribution->loadRelatedObjects($input, $ids, FALSE, TRUE)) { throw new API_Exception('failed to load related objects'); } elseif ($contribution->contribution_status_id == CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name')) { @@ -439,7 +439,7 @@ function civicrm_api3_contribution_completetransaction(&$params) { $input['is_test'] = $contribution->is_test; $input['trxn_id'] = !empty($params['trxn_id']) ? $params['trxn_id'] : $contribution->trxn_id; $input['amount'] = $contribution->total_amount; - if (isset($params['is_email_receipt'])){ + if (isset($params['is_email_receipt'])) { $input['is_email_receipt'] = $params['is_email_receipt']; } // @todo required for base ipn but problematic as api layer handles this diff --git a/api/v3/CustomField.php b/api/v3/CustomField.php index 2b7578444f..dfad615799 100644 --- a/api/v3/CustomField.php +++ b/api/v3/CustomField.php @@ -86,7 +86,7 @@ function civicrm_api3_custom_field_create($params) { /** * Flush static caches in functions that might have stored available custom fields */ -function _civicrm_api3_custom_field_flush_static_caches(){ +function _civicrm_api3_custom_field_flush_static_caches() { civicrm_api('custom_field', 'getfields', array('version' => 3, 'cache_clear' => 1)); CRM_Core_BAO_UFField::getAvailableFieldsFlat(TRUE); } diff --git a/api/v3/Domain.php b/api/v3/Domain.php index a71b15826a..0ddaaac26a 100644 --- a/api/v3/Domain.php +++ b/api/v3/Domain.php @@ -60,7 +60,7 @@ function civicrm_api3_domain_get($params) { $domains = _civicrm_api3_dao_to_array($bao, $params, TRUE, 'domain'); foreach ($domains as $domain) { - if (!empty($domain['contact_id'])){ + if (!empty($domain['contact_id'])) { $values = array(); $locparams = array( 'contact_id' => $domain['contact_id'] diff --git a/api/v3/Event.php b/api/v3/Event.php index 629e8eddf5..687f2655a4 100644 --- a/api/v3/Event.php +++ b/api/v3/Event.php @@ -90,8 +90,8 @@ function _civicrm_api3_event_create_spec(&$params) { * the core code or schema - this means we have to provide support for api calls (where possible) * across schema changes. */ -function _civicrm_api3_event_create_legacy_support_42(&$params){ - if (!empty($params['payment_processor_id'])){ +function _civicrm_api3_event_create_legacy_support_42(&$params) { + if (!empty($params['payment_processor_id'])) { $params['payment_processor'] = CRM_Core_DAO::VALUE_SEPARATOR . $params['payment_processor_id'] . CRM_Core_DAO::VALUE_SEPARATOR; } } @@ -175,10 +175,10 @@ function _civicrm_api3_event_get_spec(&$params) { * the core code or schema - this means we have to provide support for api calls (where possible) * across schema changes. */ -function _civicrm_api3_event_get_legacy_support_42(&$event, $event_id){ - if (!empty($event[$event_id]['payment_processor'])){ +function _civicrm_api3_event_get_legacy_support_42(&$event, $event_id) { + if (!empty($event[$event_id]['payment_processor'])) { $processors = explode(CRM_Core_DAO::VALUE_SEPARATOR, $event[$event_id]['payment_processor']); - if (count($processors) == 3 ){ + if (count($processors) == 3 ) { $event[$event_id]['payment_processor_id'] = $processors[1]; } } diff --git a/api/v3/Generic.php b/api/v3/Generic.php index 362c1c4388..80ea3f3d95 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -25,12 +25,12 @@ function civicrm_api3_generic_getfields($apiRequest) { $results = array(); // we will also clear pseudoconstants here - should potentially be moved to relevant BAO classes CRM_Core_PseudoConstant::flush(); - if (!empty($apiRequest['params']['fieldname'])){ + if (!empty($apiRequest['params']['fieldname'])) { CRM_Utils_PseudoConstant::flushConstant($apiRequest['params']['fieldname']); } - if (!empty($apiRequest['params']['option_group_id'])){ + if (!empty($apiRequest['params']['option_group_id'])) { $optionGroupName = civicrm_api('option_group', 'getvalue', array('version' => 3, 'id' => $apiRequest['params']['option_group_id'], 'return' => 'name') ); - if (is_string($optionGroupName)){ + if (is_string($optionGroupName)) { CRM_Utils_PseudoConstant::flushConstant(_civicrm_api_get_camel_name($optionGroupName)); } } @@ -63,7 +63,7 @@ function civicrm_api3_generic_getfields($apiRequest) { case 'getsingle': case 'getcount': $metadata = _civicrm_api_get_fields($apiRequest['entity'], $unique, $apiRequest['params']); - if (empty($metadata['id'])){ + if (empty($metadata['id'])) { // if id is not set we will set it eg. 'id' from 'case_id', case_id will be an alias if (!empty($metadata[strtolower($apiRequest['entity']) . '_id'])) { $metadata['id'] = $metadata[$lcase_entity . '_id']; @@ -315,7 +315,7 @@ function civicrm_api3_generic_getoptions($apiRequest) { * @param array $fieldsToResolve * Anny field resolutions specifically requested. */ -function _civicrm_api3_generic_get_metadata_options(&$metadata, $apiRequest, $fieldname, $fieldSpec, $fieldsToResolve){ +function _civicrm_api3_generic_get_metadata_options(&$metadata, $apiRequest, $fieldname, $fieldSpec, $fieldsToResolve) { if (empty($fieldSpec['pseudoconstant']) && empty($fieldSpec['option_group_id'])) { return; } diff --git a/api/v3/Generic/Update.php b/api/v3/Generic/Update.php index 41a87cfb23..2a3d1ceaee 100644 --- a/api/v3/Generic/Update.php +++ b/api/v3/Generic/Update.php @@ -54,7 +54,7 @@ function civicrm_api3_generic_update($apiRequest) { // @fixme // tests show that contribution works better with create // this is horrible but to make it work we'll just handle it separately - if (strtolower($apiRequest['entity']) == 'contribution'){ + if (strtolower($apiRequest['entity']) == 'contribution') { return civicrm_api($apiRequest['entity'], 'create', $apiRequest['params']); } $seek = array($key_id => $apiRequest['params'][$key_id], 'version' => $apiRequest['version']); diff --git a/api/v3/MailingContact.php b/api/v3/MailingContact.php index 85362a1208..4ca17da256 100644 --- a/api/v3/MailingContact.php +++ b/api/v3/MailingContact.php @@ -61,8 +61,8 @@ function civicrm_api3_mailing_contact_get($params) { * @param bool $count * @throws Exception */ -function _civicrm_api3_mailing_contact_getresults($params, $count){ - if (empty($params['type'])){ +function _civicrm_api3_mailing_contact_getresults($params, $count) { + if (empty($params['type'])) { //ie. because the api is an anomoly & passing in id is not valid throw new Exception('This api call does not accept api as a parameter'); } diff --git a/api/v3/OptionValue.php b/api/v3/OptionValue.php index 0067508464..0a7130b820 100644 --- a/api/v3/OptionValue.php +++ b/api/v3/OptionValue.php @@ -84,7 +84,7 @@ function _civicrm_api3_option_value_create_spec(&$params) { function civicrm_api3_option_value_delete($params) { // we will get the option group id before deleting so we can flush pseudoconstants $optionGroupID = civicrm_api('option_value', 'getvalue', array('version' => 3, 'id' => $params['id'], 'return' => 'option_group_id')); - if (CRM_Core_BAO_OptionValue::del((int) $params['id'])){ + if (CRM_Core_BAO_OptionValue::del((int) $params['id'])) { civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1, 'option_group_id' => $optionGroupID)); return civicrm_api3_create_success(); } diff --git a/api/v3/Participant.php b/api/v3/Participant.php index 0dea44820a..790b3d16f0 100644 --- a/api/v3/Participant.php +++ b/api/v3/Participant.php @@ -70,7 +70,7 @@ function civicrm_api3_participant_create($params) { $participantBAO = CRM_Event_BAO_Participant::create($params); - if (empty($params['price_set_id']) && empty($params['id']) && !empty($params['fee_level'])){ + if (empty($params['price_set_id']) && empty($params['id']) && !empty($params['fee_level'])) { _civicrm_api3_participant_createlineitem($params, $participantBAO); } _civicrm_api3_object_to_array($participantBAO, $participant[$participantBAO->id]); @@ -81,7 +81,7 @@ function civicrm_api3_participant_create($params) { /** * Create a default participant line item */ -function _civicrm_api3_participant_createlineitem(&$params, $participant){ +function _civicrm_api3_participant_createlineitem(&$params, $participant) { // it is possible that a fee level contains information about multiple // price field values. diff --git a/api/v3/PledgePayment.php b/api/v3/PledgePayment.php index 57fc142477..2041d47eb2 100644 --- a/api/v3/PledgePayment.php +++ b/api/v3/PledgePayment.php @@ -68,7 +68,7 @@ function civicrm_api3_pledge_payment_create($params) { } $dao = CRM_Pledge_BAO_PledgePayment::add($paymentParams); - if (empty($dao->pledge_id)){ + if (empty($dao->pledge_id)) { $dao->find(TRUE); } _civicrm_api3_object_to_array($dao, $result[$dao->id]); diff --git a/api/v3/PriceFieldValue.php b/api/v3/PriceFieldValue.php index 74c444cc88..2b80d4579c 100644 --- a/api/v3/PriceFieldValue.php +++ b/api/v3/PriceFieldValue.php @@ -49,7 +49,7 @@ */ function civicrm_api3_price_field_value_create($params) { $ids = array(); - if (!empty($params['id'])){ + if (!empty($params['id'])) { $ids['id'] = $params['id']; } diff --git a/api/v3/Profile.php b/api/v3/Profile.php index cf17237085..2ff39b940d 100644 --- a/api/v3/Profile.php +++ b/api/v3/Profile.php @@ -118,7 +118,7 @@ function civicrm_api3_profile_get($params) { } elseif(!empty($params['contact_id'])) { $ufGroupBAO->setProfileDefaults($params['contact_id'], $profileFields, $values[$profileID], TRUE); - foreach ($values[$profileID] as $fieldName => $field){ + foreach ($values[$profileID] as $fieldName => $field) { // we should return 'Primary' with & without capitalisation. it is more consistent with api to not // capitalise, but for form support we need it for now. Hopefully we can move away from it $values[$profileID][strtolower($fieldName)] = $field; @@ -297,7 +297,7 @@ function civicrm_api3_profile_submit($params) { * * @return string BAO Field Name */ -function _civicrm_api3_profile_translate_fieldnames_for_bao($fieldName){ +function _civicrm_api3_profile_translate_fieldnames_for_bao($fieldName) { $fieldName = str_replace('url', 'URL', $fieldName); return str_replace('primary', 'Primary', $fieldName); } diff --git a/api/v3/Setting.php b/api/v3/Setting.php index c223be15b9..0b107b7b61 100644 --- a/api/v3/Setting.php +++ b/api/v3/Setting.php @@ -36,7 +36,7 @@ */ function civicrm_api3_setting_getfields($params) { - if (!empty($params['action']) && strtolower($params['action']) == 'getvalue'){ + if (!empty($params['action']) && strtolower($params['action']) == 'getvalue') { $result = array( 'name' => array( 'title' => 'name of setting field', @@ -50,7 +50,7 @@ function civicrm_api3_setting_getfields($params) { ); return civicrm_api3_create_success($result, $params, 'setting', 'getfields'); } - if (!empty($params['name'])){ + if (!empty($params['name'])) { //am of two minds about special handling for 'name' as opposed to other filters - but is does make most common //usage really easy $params['filters']['name'] = $params['name']; @@ -62,7 +62,7 @@ function civicrm_api3_setting_getfields($params) { CRM_Utils_Array::value('profile', $params, NULL) ); // find any supplemental information - if (!empty($params['action'])){ + if (!empty($params['action'])) { $specFunction = '_civicrm_api3_setting_' . strtolower($params['action']) . '_spec'; if (function_exists($specFunction)) { $specFunction($result); @@ -85,22 +85,22 @@ function _civicrm_api3_setting_getfields_spec(&$params) { * as we will be creating the option for a function rather than an value to be in the defaults * Note that is not in place as yet */ -function civicrm_api3_setting_getdefaults(&$params){ +function civicrm_api3_setting_getdefaults(&$params) { $settings = civicrm_api3('setting', 'getfields', $params); $domains = _civicrm_api3_setting_getDomainArray($params); $defaults = array(); - foreach ($domains as $domainID){ + foreach ($domains as $domainID) { $defaults[$domainID] = array(); $noDefaults = array(); - foreach ($settings['values'] as $setting => $spec){ - if (array_key_exists('default', $spec) && !is_null($spec['default'])){ + foreach ($settings['values'] as $setting => $spec) { + if (array_key_exists('default', $spec) && !is_null($spec['default'])) { $defaults[$domainID][$setting] = $spec['default']; } else{ $noDefaults[$setting] = 1; } } - if (!empty($params['debug'])){ + if (!empty($params['debug'])) { // we are only tracking 'noDefaults' to help us check the xml print_r($noDefaults); } @@ -125,15 +125,15 @@ function _civicrm_api3_setting_getdefaults_spec(&$params) { /** * Revert settings to defaults */ -function civicrm_api3_setting_revert(&$params){ +function civicrm_api3_setting_revert(&$params) { $defaults = civicrm_api('setting', 'getdefaults', $params); $fields = civicrm_api('setting', 'getfields', $params); $fields = $fields['values']; $domains = _civicrm_api3_setting_getDomainArray($params); $result = array(); - foreach ($domains as $domainID){ + foreach ($domains as $domainID) { $valuesToRevert = array_intersect_key($defaults['values'][$domainID], $fields); - if (!empty($valuesToRevert)){ + if (!empty($valuesToRevert)) { $valuesToRevert['version'] = $params['version']; $valuesToRevert['domain_id'] = $domainID; // note that I haven't looked at how the result would appear with multiple domains in play @@ -161,18 +161,18 @@ function _civicrm_api3_setting_revert_spec(&$params) { /** * Revert settings to defaults */ -function civicrm_api3_setting_fill(&$params){ +function civicrm_api3_setting_fill(&$params) { $defaults = civicrm_api3('setting', 'getdefaults', $params); $domains = _civicrm_api3_setting_getDomainArray($params); $result = array(); - foreach ($domains as $domainID){ + foreach ($domains as $domainID) { $apiArray = array( 'version' => $params['version'], 'domain_id' => $domainID ); $existing = civicrm_api3('setting', 'get', $apiArray); $valuesToFill = array_diff_key($defaults['values'][$domainID], $existing['values'][$domainID]); - if (!empty($valuesToFill)){ + if (!empty($valuesToFill)) { $result = array_merge($result, civicrm_api('setting', 'create', $valuesToFill + $apiArray)); } } @@ -277,7 +277,7 @@ function _civicrm_api3_setting_get_spec(&$params) { */ function civicrm_api3_setting_getvalue($params) { $config = CRM_Core_Config::singleton(); - if (isset($config->$params['name'])){ + if (isset($config->$params['name'])) { return $config->$params['name']; } return CRM_Core_BAO_Setting::getItem( @@ -329,16 +329,16 @@ function _civicrm_api3_setting_getvalue_spec(&$params) { * using crm-editable will pass an id & default won't be applied * we did talk about id being a pseudonym for domain_id in this api so applying it here */ -function _civicrm_api3_setting_getDomainArray(&$params){ - if (empty($params['domain_id']) && isset($params['id'])){ +function _civicrm_api3_setting_getDomainArray(&$params) { + if (empty($params['domain_id']) && isset($params['id'])) { $params['domain_id'] = $params['id']; } - if ($params['domain_id'] == 'current_domain'){ + if ($params['domain_id'] == 'current_domain') { $params['domain_id'] = CRM_Core_Config::domainID(); } - if ($params['domain_id'] == 'all'){ + if ($params['domain_id'] == 'all') { $domainAPIResult = civicrm_api('domain', 'get', array('version' => 3, 'return' => 'id')); if (isset($domainAPIResult['values'])) { $params['domain_id'] = array_keys($domainAPIResult['values']); @@ -347,7 +347,7 @@ function _civicrm_api3_setting_getDomainArray(&$params){ throw new Exception('All domains not retrieved - problem with Domain Get api call ' . $domainAPIResult['error_message']); } } - if (is_array($params['domain_id'])){ + if (is_array($params['domain_id'])) { $domains = $params['domain_id']; } else{ diff --git a/api/v3/System.php b/api/v3/System.php index c0a7563fb8..d88a1f22a1 100644 --- a/api/v3/System.php +++ b/api/v3/System.php @@ -66,7 +66,7 @@ function civicrm_api3_system_flush($params) { * @param array $params * Array or parameters determined by getfields. */ -function _civicrm_api3_system_flush_spec(&$params){ +function _civicrm_api3_system_flush_spec(&$params) { $params['triggers'] = array('title' => 'rebuild triggers (boolean)'); $params['session'] = array('title' => 'refresh sessions (boolean)'); } diff --git a/api/v3/utils.php b/api/v3/utils.php index 268f196d03..2807a75c74 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -180,11 +180,11 @@ function civicrm_api3_create_success($values = 1, $params = array(), $entity = N if (empty($item['id']) && !empty($item[$entity . "_id"])) { $values[$key]['id'] = $item[$entity . "_id"]; } - if (!empty($item['financial_type_id'])){ + if (!empty($item['financial_type_id'])) { //4.3 legacy handling $values[$key]['contribution_type_id'] = $item['financial_type_id']; } - if (!empty($item['next_sched_contribution_date'])){ + if (!empty($item['next_sched_contribution_date'])) { // 4.4 legacy handling $values[$key]['next_sched_contribution'] = $item['next_sched_contribution_date']; } @@ -403,7 +403,7 @@ function _civicrm_api3_separate_values(&$values) { * @param array $params * @param array $values */ -function _civicrm_api3_filter_fields_for_bao($entity, &$params, &$values){ +function _civicrm_api3_filter_fields_for_bao($entity, &$params, &$values) { $fields = civicrm_api($entity, 'getfields', array('version' => 3, 'action' => 'create')); $fields = $fields['values']; _civicrm_api3_store_values($fields, $params, $values); @@ -449,7 +449,7 @@ function _civicrm_api3_store_values(&$fields, &$params, &$values) { * * @return */ -function _civicrm_api3_get_using_query_object($entity, $params, $additional_options = array(), $getCount = NULL){ +function _civicrm_api3_get_using_query_object($entity, $params, $additional_options = array(), $getCount = NULL) { // Convert id to e.g. contact_id if (empty($params[$entity . '_id']) && isset($params['id'])) { @@ -467,17 +467,17 @@ function _civicrm_api3_get_using_query_object($entity, $params, $additional_opti CRM_Utils_Array::value('return', $options, array()), CRM_Utils_Array::value('return', $additional_options, array()) ); - if (empty($returnProperties)){ + if (empty($returnProperties)) { $returnProperties = NULL; } - if (!empty($params['check_permissions'])){ + if (!empty($params['check_permissions'])) { // we will filter query object against getfields $fields = civicrm_api($entity, 'getfields', array('version' => 3, 'action' => 'get')); // we need to add this in as earlier in this function 'id' was unset in favour of $entity_id $fields['values'][$entity . '_id'] = array(); $varsToFilter = array('returnProperties', 'inputParams'); - foreach ($varsToFilter as $varToFilter){ - if (!is_array($$varToFilter)){ + foreach ($varsToFilter as $varToFilter) { + if (!is_array($$varToFilter)) { continue; } //I was going to throw an exception rather than silently filter out - but @@ -493,7 +493,7 @@ function _civicrm_api3_get_using_query_object($entity, $params, $additional_opti $limit = CRM_Utils_Array::value('limit', $options, NULL); $smartGroupCache = CRM_Utils_Array::value('smartGroupCache', $params); - if ($getCount){ + if ($getCount) { $limit = NULL; $returnProperties = NULL; } @@ -655,7 +655,7 @@ function _civicrm_api3_dao_set_filter(&$dao, $params, $unique = TRUE, $entity) { $unmatchedFields, array_flip($allfields)// but a match for the field keys ); - foreach ($returnUniqueMatched as $uniqueVal){ + foreach ($returnUniqueMatched as $uniqueVal) { $dao->selectAdd($allfields[$uniqueVal]); } } @@ -680,11 +680,11 @@ function _civicrm_api3_apply_filters_to_dao($filterField, $filterValue, &$dao) { $fieldName = substr($filterField, 0, -4); $dao->whereAdd("($fieldName >= $filterValue )"); } - if ($filterField == 'is_current' && $filterValue == 1){ + if ($filterField == 'is_current' && $filterValue == 1) { $todayStart = date('Ymd000000', strtotime('now')); $todayEnd = date('Ymd235959', strtotime('now')); $dao->whereAdd("(start_date <= '$todayStart' OR start_date IS NULL) AND (end_date >= '$todayEnd' OR end_date IS NULL)"); - if (property_exists($dao, 'is_active')){ + if (property_exists($dao, 'is_active')) { $dao->whereAdd('is_active = 1'); } } @@ -745,7 +745,7 @@ function _civicrm_api3_get_options_from_params(&$params, $queryObject = FALSE, $ $returnProperties[$entity . '_id'] = 1; unset($returnProperties['id']); } - switch (trim(strtolower($sort))){ + switch (trim(strtolower($sort))) { case 'id': case 'id desc': case 'id asc': @@ -825,7 +825,7 @@ function _civicrm_api3_apply_options_to_dao(&$params, &$dao, $entity) { function _civicrm_api3_build_fields_array(&$bao, $unique = TRUE) { $fields = $bao->fields(); if ($unique) { - if (empty($fields['id'])){ + if (empty($fields['id'])) { $entity = _civicrm_api_get_entity_name_from_dao($bao); $fields['id'] = $fields[$entity . '_id']; unset($fields[$entity . '_id']); @@ -1816,7 +1816,7 @@ function _civicrm_api3_validate_integer(&$params, &$fieldName, &$fieldInfo, $ent // Check our field length if (is_string($params[$fieldName]) && !empty($fieldInfo['maxlength']) && strlen($params[$fieldName]) > $fieldInfo['maxlength'] - ){ + ) { throw new API_Exception( $params[$fieldName] . " is " . strlen($params[$fieldName]) . " characters - longer than $fieldName length" . $fieldInfo['maxlength'] . ' characters', 2100, array('field' => $fieldName, "max_length" => $fieldInfo['maxlength']) ); @@ -1885,7 +1885,7 @@ function _civicrm_api3_validate_html(&$params, &$fieldName, $fieldInfo) { function _civicrm_api3_validate_string(&$params, &$fieldName, &$fieldInfo, $entity) { // If fieldname exists in params $value = CRM_Utils_Array::value($fieldName, $params, ''); - if (!is_array($value)){ + if (!is_array($value)) { $value = (string) $value; } else{ diff --git a/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php b/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php index 4750ebeb58..3125eb1f25 100644 --- a/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php +++ b/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php @@ -364,7 +364,7 @@ class CRM_Core_Payment_BaseIPNTest extends CiviUnitTestCase { * fully but the calls to the POST happen in more than one function * keeping this as good example of data to bring back to life later - public function testMainFunctionActions(){ + public function testMainFunctionActions() { $ids = $objects = array( ); $input['component'] = 'Contribute'; $postedParams = array( diff --git a/tests/phpunit/CRM/Utils/JSTest.php b/tests/phpunit/CRM/Utils/JSTest.php index 5b29148516..768f3d625c 100644 --- a/tests/phpunit/CRM/Utils/JSTest.php +++ b/tests/phpunit/CRM/Utils/JSTest.php @@ -64,7 +64,7 @@ class CRM_Utils_JSTest extends CiviUnitTestCase { ' public function whits() { for (a in b) { - mitts("wallaby", function(zoo){ + mitts("wallaby", function(zoo) { alert(zoo + ts("Hello")) }); } diff --git a/tests/phpunit/Utils.php b/tests/phpunit/Utils.php index c07429131d..8a6d2c18ab 100644 --- a/tests/phpunit/Utils.php +++ b/tests/phpunit/Utils.php @@ -104,7 +104,7 @@ class Utils { $backtrace = debug_backtrace(); $dir_name = dirname( __FILE__ ); $cwd_len = strlen( $dir_name ) + 1; - foreach ($backtrace as $frame ){ + foreach ($backtrace as $frame ) { echo " "; if ( array_key_exists( 'class', $frame ) ) { echo " class {$frame['class']}"; diff --git a/tests/phpunit/WebTest/Contact/CustomDataAddTest.php b/tests/phpunit/WebTest/Contact/CustomDataAddTest.php index 0e73c825a6..b874177b2b 100644 --- a/tests/phpunit/WebTest/Contact/CustomDataAddTest.php +++ b/tests/phpunit/WebTest/Contact/CustomDataAddTest.php @@ -235,7 +235,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->verifyText("xpath=//div[@id='custom-set-content-{$customFieldsetId}']/div/div[2]/div[2]", '12,345,678.98'); } - public function testCustomDataChangeLog(){ + public function testCustomDataChangeLog() { $this->webtestLogin(); //enable logging diff --git a/tests/phpunit/WebTest/Contact/MergeContactsTest.php b/tests/phpunit/WebTest/Contact/MergeContactsTest.php index 94bdd06cff..4072c16e89 100644 --- a/tests/phpunit/WebTest/Contact/MergeContactsTest.php +++ b/tests/phpunit/WebTest/Contact/MergeContactsTest.php @@ -499,7 +499,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->assertTrue($this->isElementPresent("xpath=//div[@id='phone-block']/div/div/div[3]/div[2][contains(text(), '9876543210')]")); } - public function testBatchMerge(){ + public function testBatchMerge() { $this->webtestLogin(); // add contact1 and its duplicate diff --git a/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php b/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php index dc70445f81..827cfd5931 100644 --- a/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php +++ b/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php @@ -61,7 +61,7 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { } - public function testIndividualSearchPage(){ + public function testIndividualSearchPage() { $this->webtestLogin(); $this->openCiviPage("contribute/search", "reset=1"); diff --git a/tests/phpunit/WebTest/Export/ContactTest.php b/tests/phpunit/WebTest/Export/ContactTest.php index b244c7178d..72ebb4a37a 100644 --- a/tests/phpunit/WebTest/Export/ContactTest.php +++ b/tests/phpunit/WebTest/Export/ContactTest.php @@ -35,7 +35,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { parent::setUp(); } - public function testPrefixGenderSuffix(){ + public function testPrefixGenderSuffix() { $this->webtestLogin(); // Create new group @@ -462,7 +462,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { * * @return array|int */ - public function getOptionLabel($optionGroupName, $optionValue){ + public function getOptionLabel($optionGroupName, $optionValue) { $params = array( 'version' => 3, 'sequential' => 1, diff --git a/tests/phpunit/WebTest/Import/AddressImportTest.php b/tests/phpunit/WebTest/Import/AddressImportTest.php index cdede18d47..a04925b129 100644 --- a/tests/phpunit/WebTest/Import/AddressImportTest.php +++ b/tests/phpunit/WebTest/Import/AddressImportTest.php @@ -59,7 +59,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $this->click("css=ul.ui-autocomplete li"); $this->waitForPageToLoad($this->getTimeoutMsec()); - foreach ($customDataParams['customFields'] as $key => $value){ + foreach ($customDataParams['customFields'] as $key => $value) { $this->assertTrue($this->isElementPresent("xpath=//div[@class='crm-summary-row']/div[@class='crm-label'][contains(text(), '$key')]")); $this->assertElementContainsText('address-block-1', "$value"); } @@ -84,7 +84,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { 'state' => 'State', 'country' => 'Country', ); - foreach ($customDataParams['headers'] as $key => $value){ + foreach ($customDataParams['headers'] as $key => $value) { $headers[$key] = $value; } @@ -294,7 +294,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { * * @return array */ - public function _createMultipleValueCustomField($customFieldName, $type){ + public function _createMultipleValueCustomField($customFieldName, $type) { $this->type('label', $customFieldName); $this->select("data_type[0]", "value=0"); $this->select("data_type[1]", "value=".$type); diff --git a/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php b/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php index 678bc213f8..37ff8aea7a 100644 --- a/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php +++ b/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php @@ -127,7 +127,7 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa ), ); $i = 2; - foreach ($options as $index => $values){ + foreach ($options as $index => $values) { $this->select("membership_type_id_{$index}", "value={$values['membership_type_id']}"); // Because it tends to cause problems, all uses of sleep() must be justified in comments // Sleep should never be used for wait for anything to load from the server @@ -136,7 +136,7 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input", $values['membership_num_terms']); $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input", $values['label']); $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input", $values['amount']); - if ($i > 3){ + if ($i > 3) { $this->click('link=another choice'); } $i++; @@ -384,7 +384,7 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa * @param $memTypeTitle1 * @param $term */ - public function _testMultilpeTermsMembershipRegistration($sid, $contactParams, $memTypeTitle1, $term){ + public function _testMultilpeTermsMembershipRegistration($sid, $contactParams, $memTypeTitle1, $term) { //build the membership dates. require_once 'CRM/Core/Config.php'; require_once 'CRM/Utils/Array.php'; diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php index f61d9b937b..9f14229fbe 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php @@ -139,14 +139,14 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas ); $i = 2; - foreach ($options as $index => $values){ + foreach ($options as $index => $values) { $this->select("membership_type_id_{$index}", "value={$values['membership_type_id']}"); $this->waitForElementPresent("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input"); $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input", $values['membership_num_terms']); $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input", $values['label']); $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input", $values['amount']); - if ($i > 3){ + if ($i > 3) { $this->click('link=another choice'); } $i++; @@ -418,8 +418,8 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas * @param $term * @param bool $renew */ - public function _testMultilpeTermsMembershipRegistration($pageId, $contactParams, $memTypeTitle1, $term, $renew = FALSE){ - if ($renew){ + public function _testMultilpeTermsMembershipRegistration($pageId, $contactParams, $memTypeTitle1, $term, $renew = FALSE) { + if ($renew) { $this->openCiviPage('member/search', 'reset=1', 'member_end_date_high'); $this->type("sort_name", "{$contactParams['first_name']} {$contactParams['last_name']}"); $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='memberSearch']/table/tbody/tr"); diff --git a/tests/phpunit/api/v3/APIStandardsTest.php b/tests/phpunit/api/v3/APIStandardsTest.php index 707c9f1cac..2bd4911398 100644 --- a/tests/phpunit/api/v3/APIStandardsTest.php +++ b/tests/phpunit/api/v3/APIStandardsTest.php @@ -108,7 +108,7 @@ class api_v3_APIStandardsTest extends CiviUnitTestCase { $apiStdFunctions = $this->getAllAPIStdFunctions(); $this->assertGreaterThan(1, count($apiStdFunctions),"something has gone wrong getting the std functions in line " . __LINE__); $params = 'string'; - foreach ($apiStdFunctions as $key => $function){ + foreach ($apiStdFunctions as $key => $function) { if ( in_array( $function, $this->_skipFunctionList ) ) { continue; } diff --git a/tests/phpunit/api/v3/APITest.php b/tests/phpunit/api/v3/APITest.php index dc29ed34c7..427a3205cf 100644 --- a/tests/phpunit/api/v3/APITest.php +++ b/tests/phpunit/api/v3/APITest.php @@ -138,7 +138,7 @@ class api_v3_APITest extends CiviUnitTestCase { try{ $result = civicrm_api3('contact', 'get', array()); } - catch (CRM_Exception $e){ + catch (CRM_Exception $e) { $this->fail("This should have been a success test"); } $this->assertTrue(is_array($result)); @@ -148,11 +148,11 @@ class api_v3_APITest extends CiviUnitTestCase { /** * Test exception is thrown */ - public function testv3WrapperException(){ + public function testv3WrapperException() { try{ $result = civicrm_api3('contact', 'create', array('debug' => 1)); } - catch (CiviCRM_API3_Exception $e){ + catch (CiviCRM_API3_Exception $e) { $this->assertEquals('mandatory_missing', $e->getErrorCode()); $this->assertEquals('Mandatory key(s) missing from params array: contact_type', $e->getMessage()); $extra = $e->getExtraParams(); diff --git a/tests/phpunit/api/v3/CustomFieldTest.php b/tests/phpunit/api/v3/CustomFieldTest.php index 2d79dd974a..6c5850fdd4 100644 --- a/tests/phpunit/api/v3/CustomFieldTest.php +++ b/tests/phpunit/api/v3/CustomFieldTest.php @@ -281,7 +281,7 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase { /** * Test custom field get works & return param works */ - public function testCustomFieldGetReturnOptions(){ + public function testCustomFieldGetReturnOptions() { $customGroup = $this->customGroupCreate(array('extends' => 'Individual', 'title' => 'test_group')); $customField = $this->customFieldCreate(array('custom_group_id' => $customGroup['id'])); @@ -296,7 +296,7 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase { /** * Test custom field get works & return param works */ - public function testCustomFieldGetReturnArray(){ + public function testCustomFieldGetReturnArray() { $customGroup = $this->customGroupCreate(array('extends' => 'Individual', 'title' => 'test_group')); $customField = $this->customFieldCreate(array('custom_group_id' => $customGroup['id'])); @@ -311,7 +311,7 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase { /** * Test custom field get works & return param works */ - public function testCustomFieldGetReturnTwoOptions(){ + public function testCustomFieldGetReturnTwoOptions() { $customGroup = $this->customGroupCreate(array('extends' => 'Individual', 'test_group')); $customField = $this->customFieldCreate(array('custom_group_id' => $customGroup['id'])); diff --git a/tests/phpunit/api/v3/EventTest.php b/tests/phpunit/api/v3/EventTest.php index 1a47f574b0..a9faeaf6bb 100644 --- a/tests/phpunit/api/v3/EventTest.php +++ b/tests/phpunit/api/v3/EventTest.php @@ -254,7 +254,7 @@ class api_v3_EventTest extends CiviUnitTestCase { */ public function testCreateGetEventLegacyContributionTypeID() { $contributionTypeArray = array('contribution_type_id' => 3); - if (isset($this->_params[0]['financial_type_id'])){ + if (isset($this->_params[0]['financial_type_id'])) { //in case someone edits $this->_params & invalidates this test :-) unset($this->_params[0]['financial_type_id']); } diff --git a/tests/phpunit/api/v3/PriceSetTest.php b/tests/phpunit/api/v3/PriceSetTest.php index 84f9a4797b..f73f5dc363 100644 --- a/tests/phpunit/api/v3/PriceSetTest.php +++ b/tests/phpunit/api/v3/PriceSetTest.php @@ -152,7 +152,7 @@ class api_v3_PriceSetTest extends CiviUnitTestCase { // put stuff here that should happen before all tests in this unit } - public static function tearDownAfterClass(){ + public static function tearDownAfterClass() { $tablesToTruncate = array( 'civicrm_contact', 'civicrm_contribution', diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index dc740b33fe..563d81ab2a 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -402,7 +402,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { * * @return array */ - public function getKnownUnworkablesUpdateSingle($entity, $key){ + public function getKnownUnworkablesUpdateSingle($entity, $key) { // can't update values are values for which updates don't result in the value being changed $knownFailures = array( 'ActionSchedule' => array( @@ -489,7 +489,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { ), ), ); - if (empty($knownFailures[$entity]) || empty($knownFailures[$entity][$key])){ + if (empty($knownFailures[$entity]) || empty($knownFailures[$entity][$key])) { return array(); } return $knownFailures[$entity][$key]; @@ -945,7 +945,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { $this->assertNotEmpty($baoString, $entityName); $this->assertNotEmpty($entityName, $entityName); $fieldsGet = $fields = $this->callAPISuccess($entityName, 'getfields', array('action' => 'get')); - if ($entityName != 'Pledge'){ + if ($entityName != 'Pledge') { $fields = $this->callAPISuccess($entityName, 'getfields', array('action' => 'create')); } $fields = $fields['values']; @@ -1015,7 +1015,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { $entity[$fieldName] = 2; } elseif (!empty($specs['FKClassName'])) { - if ($specs['FKClassName'] == $baoString){ + if ($specs['FKClassName'] == $baoString) { $entity[$fieldName] = (string) $entity2['id']; } else{