Commit 92e4c2a5 authored by totten's avatar totten

INFRA-132 - s/(else|try){/(else|try) {/

parent 86bfa4f6
......@@ -149,7 +149,7 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form {
$props['html_type'] == 'select' ? CRM_Utils_Array::value('html_attributes', $props) : NULL
);
}
else{
else {
$this->$add($setting, ts($props['title']));
}
$this->assign("{$setting}_description", ts($props['description']));
......
......@@ -88,7 +88,7 @@ class CRM_Contact_BAO_Contact_Utils {
if ($addProfileOverlay) {
$imageInfo[$contactType]['image'] = "<div class=\"icon crm-icon {$type}-icon\"></div>";
}
else{
else {
$imageInfo[$contactType]['image'] = "<div class=\"icon crm-icon {$type}-icon\" title=\"{$contactType}\"></div>";
}
$imageInfo[$contactType]['url'] = NULL;
......
......@@ -93,7 +93,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
$hook = 'create';
$action = CRM_Core_Action::ADD;
}
else{
else {
$hook = 'edit';
$action = CRM_Core_Action::UPDATE;
}
......@@ -240,7 +240,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
$relationship->$defaultField = 'NULL';
}
}
else{
else {
$relationship->$defaultField = $params[$defaultField];
}
}
......@@ -1738,7 +1738,7 @@ AND cc.sort_name LIKE '%$name%'";
elseif(!empty($clauses)) {
return explode(' OR ', $clauses);
}
else{
else {
// effectively setting it to return no results
$params['relationship_type_id'] = 0;
}
......
......@@ -152,7 +152,7 @@ class CRM_Contribute_BAO_Contribution_Utils {
// this does not return
$result = $payment->doTransferCheckout($form->_params, 'contribute');
}
else{
else {
CRM_Core_Error::fatal($paymentObjError);
}
}
......
......@@ -605,7 +605,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
'name'
);
}
else{
else {
$activityTypeID = CRM_Core_OptionGroup::getValue('activity_type',
'Emailed Invoice',
'name'
......
......@@ -1502,7 +1502,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
CRM_Utils_Array::value("{$fieldName}_time", $params), TRUE)
);
}
else{
else {
if (isset($specs['default'])) {
$params[$fieldName] = date('YmdHis', strtotime($specs['default']));
}
......@@ -1698,7 +1698,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
* @return array
*/
public function getProfileDefaults($profile_id = 'Billing', $contactID = NULL) {
try{
try {
$defaults = civicrm_api3('profile', 'getsingle', array(
'profile_id' => (array) $profile_id,
'contact_id' => $contactID,
......
......@@ -162,7 +162,7 @@ class CRM_Custom_Import_Parser_Api extends CRM_Custom_Import_Parser {
$this->_params['skipRecentView'] = TRUE;
$this->_params['check_permissions'] = TRUE;
$this->_params['entity_id'] = $formatted['id'];
try{
try {
civicrm_api3('custom_value', 'create', $this->_params);
}
catch(CiviCRM_API3_Exception $e) {
......
......@@ -98,7 +98,7 @@ class CRM_Member_BAO_MembershipStatus extends CRM_Member_DAO_MembershipStatus {
if (!empty($params['id'])) {
$ids['membershipStatus'] = $params['id'];
}
else{
else {
//don't allow duplicate names - if id not set
$status = new CRM_Member_DAO_MembershipStatus();
$status->name = $params['name'];
......
......@@ -112,7 +112,7 @@ class CRM_Member_Form_MembershipStatus extends CRM_Member_Form_MembershipConfig
*/
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
try{
try {
CRM_Member_BAO_MembershipStatus::del($this->_id);
}
catch(CRM_Core_Exception $e) {
......
......@@ -294,7 +294,7 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form_MembershipConfig {
*/
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
try{
try {
CRM_Member_BAO_MembershipType::del($this->_id);
}
catch(CRM_Core_Exception $e) {
......
......@@ -134,7 +134,7 @@ class CRM_Member_Form_Task_Label extends CRM_Member_Form_Task {
$labelRows[$id] = $rows[$membership['contact_id']];
}
}
else{
else {
$labelRows = $rows;
}
//call function to create labels
......
......@@ -255,7 +255,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser {
* @return boolean the result of this processing
*/
public function import($onDuplicate, &$values) {
try{
try {
// first make sure this is a valid line
$response = $this->summary($values);
if ($response != CRM_Import_Parser::VALID) {
......
......@@ -393,11 +393,11 @@ ALTER TABLE civicrm_dashboard
self::setContactImageUrl($dao->id,
CRM_Utils_System::url('civicrm/contact/imagefile', 'photo=' . $photo, TRUE, NULL, TRUE, TRUE));
}
else{
else {
$failures[$dao->id] = $dao->image_url;
}
}
else{
else {
$failures[$dao->id] = $dao->image_url;
}
}
......
......@@ -683,7 +683,7 @@ WHERE cpf.price_set_id = %1
if (isset($result->price_set_id)) {
$priceSetId = $result->price_set_id;
}
else{
else {
$defaultPriceSets = CRM_Price_BAO_PriceSet::getDefaultPriceSet();
foreach ($defaultPriceSets as $key => $pSet) {
if ($pSet['name'] == 'contribution_amount') {
......
......@@ -207,7 +207,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
array(1 => $email)
);
}
else{
else {
$errors[$emailName] = ts('This email %1 is already registered. Please select another email.',
array(1 => $email)
);
......@@ -473,7 +473,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
if (!$contactID) {
return FALSE;
}
else{//success
else { //success
if ($loadCMSBootstrap) {
$bootStrapParams = array();
if ($name && $password) {
......
......@@ -1695,7 +1695,7 @@ class CRM_Utils_Token {
break;
case 'fee':
try{
try {
$value = civicrm_api3('membership_type', 'getvalue', array('id' => $membership['membership_type_id'], 'return' => 'minimum_fee'));
}
catch (CiviCRM_API3_Exception $e) {
......
......@@ -126,7 +126,7 @@ function civicrm_api3_constant_get($params) {
}
return civicrm_api3_create_success($values, $params, 'constant');
}
else{
else {
$values = call_user_func(array('CRM_Utils_PseudoConstant', 'getConstant'), $name);
if (!empty($values)) {
return civicrm_api3_create_success($values, $params, 'constant');
......
......@@ -208,7 +208,7 @@ function civicrm_api3_custom_value_get($params) {
$n = 0;
$id = $fieldNumber;
}
else{
else {
$n = $idArray[2];
$id = $fieldNumber . "." . $idArray[2];
}
......
......@@ -53,7 +53,7 @@ function civicrm_api3_entity_tag_get($params) {
if (empty($params['entity_id'])) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
else{
else {
//do legacy non-standard behaviour
$values = CRM_Core_BAO_EntityTag::getTag($params['entity_id'], $params['entity_table']);
$result = array();
......
......@@ -71,7 +71,7 @@ function civicrm_api3_generic_getfields($apiRequest) {
$metadata['id']['api.aliases'] = array($lcase_entity . '_id');
}
}
else{
else {
// really the preference would be to set the unique name in the xml
// question is which is a less risky fix this close to a release - setting in xml for the known failure
// (note) or setting for all api where fields is returning 'id' & we want to accept 'note_id' @ the api layer
......
......@@ -88,7 +88,7 @@ function civicrm_api3_option_value_delete($params) {
civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1, 'option_group_id' => $optionGroupID));
return civicrm_api3_create_success();
}
else{
else {
civicrm_api3_create_error('Could not delete OptionValue ' . $params['id']);
}
}
......@@ -124,7 +124,7 @@ function civicrm_api3_profile_get($params) {
$values[$profileID][strtolower($fieldName)] = $field;
}
}
else{
else {
$values[$profileID] = array_fill_keys(array_keys($profileFields), '');
}
}
......@@ -450,7 +450,7 @@ function _civicrm_api3_profile_getbillingpseudoprofile(&$params) {
$values['billing_' . $fieldname . '-' . $locationTypeID] = isset($result['api.address.get.2']['values'][0][$fieldname]) ? $result['api.address.get.2']['values'][0][$fieldname] : '';
}
}
else{
else {
foreach ($addressFields as $fieldname) {
$values['billing_' . $fieldname . '-' . $locationTypeID] = isset($result[$fieldname]) ? $result[$fieldname] : '';
}
......@@ -462,7 +462,7 @@ function _civicrm_api3_profile_getbillingpseudoprofile(&$params) {
elseif(!empty($result['api.email.get.2']['count'])) {
$values['billing-email' . '-' . $locationTypeID] = $result['api.email.get.2']['values'][0]['email'];
}
else{
else {
$values['billing-email' . '-' . $locationTypeID] = $result['email'];
}
// return both variants of email to reflect inconsistencies in form layer
......@@ -567,7 +567,7 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour =
// which entity 'status_id' belongs to
$fieldName = $entityGetFieldsResult[$realName]['uniqueName'];
}
else{
else {
if (isset($entityGetFieldsResult[$realName]['name'])) {
// this will sort out membership_type_id vs membership_type
$fieldName = $entityGetFieldsResult[$realName]['name'];
......@@ -638,7 +638,7 @@ function _civicrm_api3_map_profile_fields_to_entity(&$field) {
if ($fieldName == 'email') {
$entity = 'email';
}
else{
else {
$entity = 'address';
}
$fieldName .= '-' . $field['location_type_id'];
......
......@@ -96,7 +96,7 @@ function civicrm_api3_setting_getdefaults(&$params) {
if (array_key_exists('default', $spec) && !is_null($spec['default'])) {
$defaults[$domainID][$setting] = $spec['default'];
}
else{
else {
$noDefaults[$setting] = 1;
}
}
......@@ -343,14 +343,14 @@ function _civicrm_api3_setting_getDomainArray(&$params) {
if (isset($domainAPIResult['values'])) {
$params['domain_id'] = array_keys($domainAPIResult['values']);
}
else{
else {
throw new Exception('All domains not retrieved - problem with Domain Get api call ' . $domainAPIResult['error_message']);
}
}
if (is_array($params['domain_id'])) {
$domains = $params['domain_id'];
}
else{
else {
$domains = array($params['domain_id']);
}
return $domains;
......
......@@ -1888,7 +1888,7 @@ function _civicrm_api3_validate_string(&$params, &$fieldName, &$fieldInfo, $enti
if (!is_array($value)) {
$value = (string) $value;
}
else{
else {
//@todo what do we do about passed in arrays. For many of these fields
// the missing piece of functionality is separating them to a separated string
// & many save incorrectly. But can we change them wholesale?
......
......@@ -39,7 +39,7 @@ $log = new CRM_Utils_SystemLogger();
$log->alert('payment_notification processor_name=AuthNet', $_REQUEST);
$authorizeNetIPN = new CRM_Core_Payment_AuthorizeNetIPN($_REQUEST);
try{
try {
$authorizeNetIPN->main();
}
catch(CRM_Core_Exception $e) {
......
......@@ -48,7 +48,7 @@ else {
$paypalIPN = new CRM_Core_Payment_PayPalIPN();
// @todo upgrade standard per Pro
}
try{
try {
$paypalIPN->main();
}
catch(CRM_Core_Exception $e) {
......
......@@ -153,7 +153,7 @@ class CRM_Core_Payment_PayPalProIPNTest extends CiviUnitTestCase {
public function testIPNPaymentExpressNoError() {
$this->setupRecurringPaymentProcessorTransaction();
$paypalIPN = new CRM_Core_Payment_PayPalProIPN($this->getPaypalExpressTransactionIPN());
try{
try {
$paypalIPN->main();
}
catch(CRM_Core_Exception $e) {
......
......@@ -135,7 +135,7 @@ class api_v3_APITest extends CiviUnitTestCase {
* Test that calling via wrapper works
*/
public function testv3Wrapper() {
try{
try {
$result = civicrm_api3('contact', 'get', array());
}
catch (CRM_Exception $e) {
......@@ -149,7 +149,7 @@ class api_v3_APITest extends CiviUnitTestCase {
* Test exception is thrown
*/
public function testv3WrapperException() {
try{
try {
$result = civicrm_api3('contact', 'create', array('debug' => 1));
}
catch (CiviCRM_API3_Exception $e) {
......
......@@ -1018,7 +1018,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
if ($specs['FKClassName'] == $baoString) {
$entity[$fieldName] = (string) $entity2['id'];
}
else{
else {
$uniqueName = CRM_Utils_Array::value('uniqueName', $specs);
if (!empty($entity[$fieldName])) {
$resetFKTo = array($fieldName => $entity[$fieldName]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment