REF/CRM - Simplify inline conditionals with Elvis
authorcolemanw <coleman@civicrm.org>
Thu, 24 Aug 2023 17:42:03 +0000 (13:42 -0400)
committercolemanw <coleman@civicrm.org>
Thu, 24 Aug 2023 18:45:14 +0000 (14:45 -0400)
40 files changed:
CRM/Activity/BAO/Activity.php
CRM/Admin/Form/RelationshipType.php
CRM/Campaign/Form/Survey/Results.php
CRM/Campaign/Form/Survey/TabHeader.php
CRM/Contact/BAO/Contact.php
CRM/Contact/BAO/Relationship.php
CRM/Contact/Form/Task/EmailTrait.php
CRM/Contribute/Form/AdditionalInfo.php
CRM/Contribute/Form/ContributionBase.php
CRM/Contribute/Form/ContributionPage/TabHeader.php
CRM/Core/BAO/Country.php
CRM/Core/BAO/Domain.php
CRM/Core/Form.php
CRM/Core/I18n.php
CRM/Core/Lock.php
CRM/Core/Menu.php
CRM/Core/Page/AJAX/Location.php
CRM/Core/Payment/PayPalIPN.php
CRM/Core/Payment/PayPalProIPN.php
CRM/Core/PseudoConstant.php
CRM/Core/Selector/Controller.php
CRM/Core/Session.php
CRM/Event/Form/ManageEvent/TabHeader.php
CRM/Event/Form/Registration.php
CRM/Event/PseudoConstant.php
CRM/Logging/ReportDetail.php
CRM/Mailing/PseudoConstant.php
CRM/Mailing/Selector/Browse.php
CRM/PCP/Page/PCPInfo.php
CRM/Pledge/BAO/Pledge.php
CRM/Profile/Form.php
CRM/Profile/Page/Dynamic.php
CRM/Profile/Page/Listings.php
CRM/Profile/Page/View.php
CRM/Report/Form.php
CRM/Report/Form/Contribute/RecurSummary.php
CRM/Report/Form/Contribute/TopDonor.php
CRM/SMS/Form/Upload.php
CRM/Utils/Mail.php
CRM/Utils/Mail/Incoming.php

index 3d7993b5fbffd1aad10dd13c87ae69a096cb7091..37ece7b6fdd6d898112d23053b717a521e888a7f 100644 (file)
@@ -922,7 +922,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
       $details = "-ALTERNATIVE ITEM 0-\n{$html}{$additionalDetails}\n-ALTERNATIVE ITEM 1-\n{$text}{$additionalDetails}\n-ALTERNATIVE END-\n";
     }
     else {
-      $details = $html ? $html : $text;
+      $details = $html ?: $text;
       $details .= $additionalDetails;
     }
 
@@ -1703,7 +1703,7 @@ WHERE      activity.id IN ($activityIds)";
         'parent_id'
       );
 
-      $parentActivities[$activityId] = $parentId ? $parentId : FALSE;
+      $parentActivities[$activityId] = $parentId ?: FALSE;
     }
 
     return $parentActivities[$activityId];
index 391b52304c47b7324bd2094c0f78cf5e99b69e82..ce43206171550aec7e192bf3e5fdf03968528fae 100644 (file)
@@ -159,8 +159,8 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
       $params['contact_type_a'] = $cTypeA[0];
       $params['contact_type_b'] = $cTypeB[0];
 
-      $params['contact_sub_type_a'] = $cTypeA[1] ? $cTypeA[1] : 'null';
-      $params['contact_sub_type_b'] = $cTypeB[1] ? $cTypeB[1] : 'null';
+      $params['contact_sub_type_a'] = $cTypeA[1] ?: 'null';
+      $params['contact_sub_type_b'] = $cTypeB[1] ?: 'null';
 
       if (!strlen(trim($params['label_b_a'] ?? ''))) {
         $params['label_b_a'] = $params['label_a_b'] ?? NULL;
index c7054f570fa8da48864b376abffc91ff5402fa70..a12e609326e3fe1314950bdfe5148255e2100f07 100644 (file)
@@ -397,7 +397,7 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
       $activityStatus = array_flip($activityStatus);
       $this->_params = [
         'name' => "survey_{$survey->id}",
-        'title' => $params['report_title'] ? $params['report_title'] : $this->_values['title'],
+        'title' => $params['report_title'] ?: $this->_values['title'],
         'status_id_op' => 'eq',
         // reserved status
         'status_id_value' => $activityStatus['Scheduled'],
index e7bfd2fa569f1c9c8a74e6cb800578f572985416..2856c09a3e7abf7a68b98790095df2a9a3e8a47c 100644 (file)
@@ -137,7 +137,7 @@ class CRM_Campaign_Form_Survey_TabHeader {
       }
     }
 
-    $current = $current ? $current : 'main';
+    $current = $current ?: 'main';
     return $current;
   }
 
@@ -166,7 +166,7 @@ class CRM_Campaign_Form_Survey_TabHeader {
       }
     }
 
-    $next = $next ? $next : 'main';
+    $next = $next ?: 'main';
     return $next;
   }
 
index a925762dd4690f1572db28c0a350732d0dd9b51d..d54041d393b5291abde0cb77d2f3e5f834190b16 100644 (file)
@@ -1135,7 +1135,7 @@ WHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
     $cid = CRM_Utils_Request::retrieve('cid', 'Positive');
     // retrieve contact id in case of Profile context
     $id = CRM_Utils_Request::retrieve('id', 'Positive');
-    $cid = $cid ? $cid : $id;
+    $cid = $cid ?: $id;
     if ($action & CRM_Core_Action::DELETE) {
       if (CRM_Utils_Request::retrieve('confirmed', 'Boolean')) {
         CRM_Contact_BAO_Contact::deleteContactImage($cid);
index eb45476e8684930f9f362576603f662b5e3653e8..03b91fbf66e267c7ba1282ed98eae45054f8a07b 100644 (file)
@@ -2040,7 +2040,7 @@ AND cc.sort_name LIKE '%$name%'";
    */
   public static function isCurrentEmployerNeedingToBeCleared($params, $relationshipId, $updatedRelTypeID = NULL) {
     $existingTypeID = (int) CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Relationship', $relationshipId, 'relationship_type_id');
-    $updatedRelTypeID = $updatedRelTypeID ? $updatedRelTypeID : $existingTypeID;
+    $updatedRelTypeID = $updatedRelTypeID ?: $existingTypeID;
     $currentEmployerID = (int) civicrm_api3('Contact', 'getvalue', ['return' => 'current_employer_id', 'id' => $params['contact_id_a']]);
 
     if ($currentEmployerID !== (int) $params['contact_id_b'] || !self::isRelationshipTypeCurrentEmployer($existingTypeID)) {
index 04a1b7bd575ec4a753c05ebdbe9ddeaf7af828d8..1755bbc2327fc4e39b31b4874d94189993b3bcd3 100644 (file)
@@ -838,7 +838,7 @@ trait CRM_Contact_Form_Task_EmailTrait {
       $details = "-ALTERNATIVE ITEM 0-\n{$html}{$additionalDetails}\n-ALTERNATIVE ITEM 1-\n{$text}{$additionalDetails}\n-ALTERNATIVE END-\n";
     }
     else {
-      $details = $html ? $html : $text;
+      $details = $html ?: $text;
       $details .= $additionalDetails;
     }
 
index 2d451f782ce0a1ff86eb6560740e242491130b45..86b0e9457265cd61d5915ec975c646b6178a6e93 100644 (file)
@@ -255,7 +255,7 @@ class CRM_Contribute_Form_AdditionalInfo {
     $noteID = [];
     if ($contributionNoteID) {
       $noteID = ["id" => $contributionNoteID];
-      $noteParams['note'] = $noteParams['note'] ? $noteParams['note'] : "null";
+      $noteParams['note'] = $noteParams['note'] ?: "null";
     }
     CRM_Core_BAO_Note::add($noteParams, $noteID);
   }
index b423a4b41ca024aee78fda7eba764ee064b7c466..b1972d0060e95dc5e65f1ba3b2067832d2ec24ce 100644 (file)
@@ -1089,7 +1089,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
    */
   public function overrideExtraTemplateFileName() {
     $fileName = $this->checkTemplateFileExists('extra.');
-    return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
+    return $fileName ?: parent::overrideExtraTemplateFileName();
   }
 
   /**
index c103759321bc4fd732c7510c1e55c95f7ef451cc..1344cbb441ef814bde40f17fb0f1ce12d49e73ec 100644 (file)
@@ -179,7 +179,7 @@ class CRM_Contribute_Form_ContributionPage_TabHeader {
       }
     }
 
-    $current = $current ? $current : 'settings';
+    $current = $current ?: 'settings';
     return $current;
   }
 
index d81958f09dbe21f1e890088812926787c5a5bc84..8d53a8bf8ac2e7c1dd41bde193a2576b88b6659e 100644 (file)
@@ -174,7 +174,7 @@ class CRM_Core_BAO_Country extends CRM_Core_DAO_Country {
   public static function defaultCurrencySymbol($defaultCurrency = NULL) {
     static $cachedSymbol = NULL;
     if (!$cachedSymbol || $defaultCurrency) {
-      $currency = $defaultCurrency ? $defaultCurrency : Civi::settings()->get('defaultCurrency');
+      $currency = $defaultCurrency ?: Civi::settings()->get('defaultCurrency');
       if ($currency) {
         $currencySymbols = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', [
           'labelColumn' => 'symbol',
index 1462718c86cccf0a3a94b02256356d55a876b41d..548baffdc68a0f0347cc24be915d9ca9eabfc6fc 100644 (file)
@@ -273,7 +273,7 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
         $title, 'id', 'title', TRUE
       );
     }
-    return $groupID ? $groupID : FALSE;
+    return $groupID ?: FALSE;
   }
 
   /**
index e29b8fcb22c74650e2e507a5ff87eaffd28b5b34..76a7baaf79ad86662a1862c944d9aa4f6cf037a1 100644 (file)
@@ -489,7 +489,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     // Fudge some extra types that quickform doesn't support
     $inputType = $type;
     if ($type == 'wysiwyg' || in_array($type, self::$html5Types)) {
-      $attributes = ($attributes ? $attributes : []) + ['class' => ''];
+      $attributes = ($attributes ?: []) + ['class' => ''];
       $attributes['class'] = ltrim($attributes['class'] . " crm-form-$type");
       if ($type == 'wysiwyg' && isset($attributes['preset'])) {
         $attributes['data-preset'] = $attributes['preset'];
@@ -1397,7 +1397,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    */
   public function &addRadio($name, $title, $values, $attributes = [], $separator = NULL, $required = FALSE, $optionAttributes = []) {
     $options = [];
-    $attributes = $attributes ? $attributes : [];
+    $attributes = $attributes ?: [];
     $allowClear = !empty($attributes['allowClear']);
     unset($attributes['allowClear']);
     $attributes['id_suffix'] = $name;
index 7484564f5bf50c4609b2f7946817671fedcb95ca..2c789e152ec8aff1bcae61dba59c53974a66c6cf 100644 (file)
@@ -774,7 +774,7 @@ class CRM_Core_I18n {
    */
   public static function getLocale() {
     global $tsLocale;
-    return $tsLocale ? $tsLocale : 'en_US';
+    return $tsLocale ?: 'en_US';
   }
 
   /**
index f72c655d59ff88a5cfc0afef3603539392e4292f..129e5db5998db8e34c11964ca20601a4f8cddaf6 100644 (file)
@@ -175,7 +175,7 @@ class CRM_Core_Lock implements \Civi\Core\Lock\LockInterface {
       $query = "SELECT GET_LOCK( %1, %2 )";
       $params = [
         1 => [$this->_id, 'String'],
-        2 => [$timeout ? $timeout : $this->_timeout, 'Integer'],
+        2 => [$timeout ?: $this->_timeout, 'Integer'],
       ];
       $res = CRM_Core_DAO::singleValueQuery($query, $params);
       if ($res) {
index d22073f07b03dbc56c8f8a90c357b1cadb1b1df7..774aaf5b9686165bc604f9a472dfc1d113a5363b 100644 (file)
@@ -522,7 +522,7 @@ class CRM_Core_Menu {
           'id', 'name'
         );
       }
-      $menu[$path]['component_id'] = $componentId ? $componentId : NULL;
+      $menu[$path]['component_id'] = $componentId ?: NULL;
       $cache[$compPath] = $menu[$path]['component_id'];
     }
   }
index 2faae46bf279650cfd9fefafd6ff0744abd47e1c..0e47c0a46600d4dea37ab0fb9fe44548aa162f53 100644 (file)
@@ -226,7 +226,7 @@ class CRM_Core_Page_AJAX_Location {
         }
         $fld = "address[1][{$element}]";
         $value = $location['address'][1][$element] ?? NULL;
-        $value = $value ? $value : "";
+        $value = $value ?: "";
         $result[str_replace([
           '][',
           '[',
@@ -244,7 +244,7 @@ class CRM_Core_Page_AJAX_Location {
       for ($i = 1; $i < 3; $i++) {
         $fld = "{$block}[{$i}][{$element}]";
         $value = $location[$block][$i][$element] ?? NULL;
-        $value = $value ? $value : "";
+        $value = $value ?: "";
         $result[str_replace([
           '][',
           '[',
index 369e4c176ae527dc170349ca760b84569c28de3e..23be16e1afd08038501836e257282391c55a30ff 100644 (file)
@@ -308,7 +308,7 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN {
     ];
     foreach ($lookup as $name => $paypalName) {
       $value = $this->retrieve($paypalName, 'String', FALSE);
-      $input[$name] = $value ? $value : NULL;
+      $input[$name] = $value ?: NULL;
     }
 
     $input['is_test'] = $this->retrieve('test_ipn', 'Integer', FALSE);
index 5b039d3b41360f47031426c631fbe5a859832ae0..2106e136d4253109d4b07323a0f785c8aec85552 100644 (file)
@@ -480,7 +480,7 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
     ];
     foreach ($lookup as $name => $paypalName) {
       $value = $this->retrieve($paypalName, 'String', FALSE);
-      $input[$name] = $value ? $value : NULL;
+      $input[$name] = $value ?: NULL;
     }
 
     $input['is_test'] = $this->retrieve('test_ipn', 'Integer', FALSE);
index 35bc3cae683910824107093befe57f02b05d47e1..e355265f0b1c45537e305fb50b689d9a9f240283 100644 (file)
@@ -801,7 +801,7 @@ WHERE  id = %1";
    */
   public static function allGroup($groupType = NULL, $excludeHidden = TRUE) {
     $condition = CRM_Contact_BAO_Group::groupTypeCondition($groupType, $excludeHidden);
-    $groupKey = ($groupType ? $groupType : 'null') . !empty($excludeHidden);
+    $groupKey = ($groupType ?: 'null') . !empty($excludeHidden);
 
     if (!isset(Civi::$statics[__CLASS__]['groups']['allGroup'][$groupKey])) {
       self::populate(Civi::$statics[__CLASS__]['groups']['allGroup'][$groupKey], 'CRM_Contact_DAO_Group', FALSE, 'title', 'is_active', $condition);
index a3723979b13ed11a013c9d7a24041bbfbb9cd9d0..c2cc8d196aa6c8b3324329107c682b5f1da398e2 100644 (file)
@@ -183,8 +183,8 @@ class CRM_Core_Selector_Controller {
   public function __construct($object, $pageID, $sortID, $action, $store = NULL, $output = self::TEMPLATE, $prefix = NULL, $case = NULL) {
 
     $this->_object = $object;
-    $this->_pageID = $pageID ? $pageID : 1;
-    $this->_sortID = $sortID ? $sortID : NULL;
+    $this->_pageID = $pageID ?: 1;
+    $this->_sortID = $sortID ?: NULL;
     $this->_action = $action;
     $this->_store = $store;
     $this->_output = $output;
index 3f0011cc78cc8ddfa7689226d19e8db1064fa33c..fa6003c784d3d9a23361313f9aff73989263dfe5 100644 (file)
@@ -325,7 +325,7 @@ class CRM_Core_Session {
     $ts = $this->get($name, 'timer');
     if (!$ts || $ts < time() - $expire) {
       $this->set($name, time(), 'timer');
-      return $ts ? $ts : 'not set';
+      return $ts ?: 'not set';
     }
     return FALSE;
   }
@@ -502,7 +502,7 @@ class CRM_Core_Session {
         'text' => $text,
         'title' => $title,
         'type' => $type,
-        'options' => $options ? $options : NULL,
+        'options' => $options ?: NULL,
       ];
     }
   }
index af32097768d4b25fba4e0f32b3593370560e9663..8c159a7c397873bfce0414947fe08af7acc96e9d 100644 (file)
@@ -227,7 +227,7 @@ WHERE      e.id = %1
       }
     }
 
-    $current = $current ? $current : 'settings';
+    $current = $current ?: 'settings';
     return $current;
   }
 
index 26b938cf46b4cbd81842b1e7cdddbd2cb8bd248d..595ee19e88df4daa46d94d6ee38e6f25b8b71122 100644 (file)
@@ -1126,7 +1126,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
    */
   public function getTemplateFileName() {
     $fileName = $this->checkTemplateFileExists();
-    return $fileName ? $fileName : parent::getTemplateFileName();
+    return $fileName ?: parent::getTemplateFileName();
   }
 
   /**
@@ -1136,7 +1136,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
    */
   public function overrideExtraTemplateFileName() {
     $fileName = $this->checkTemplateFileExists('extra.');
-    return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
+    return $fileName ?: parent::overrideExtraTemplateFileName();
   }
 
   /**
index ca1ad28386c2acadcdc307bafead5e4ba651b2a4..b8bd9f11a62bf664d5bfaadd9fefa3d55908f5ce 100644 (file)
@@ -124,7 +124,7 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
       self::$participantStatus = [];
     }
 
-    $index = $cond ? $cond : 'No Condition';
+    $index = $cond ?: 'No Condition';
     $index = "{$index}_{$retColumn}";
     if (empty(self::$participantStatus[$index])) {
       self::$participantStatus[$index] = [];
@@ -183,7 +183,7 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
    *   array reference of all participant roles if any
    */
   public static function &participantRole($id = NULL, $cond = NULL) {
-    $index = $cond ? $cond : 'No Condition';
+    $index = $cond ?: 'No Condition';
     if (empty(self::$participantRole[$index])) {
       self::$participantRole[$index] = [];
 
index a8cb03d610b16c9f0eb4b8a8ebf076f517de65ba..8df6ec89e5b67b9c3efe3f21a77ac47a61bfb2a1 100644 (file)
@@ -455,7 +455,7 @@ class CRM_Logging_ReportDetail extends CRM_Report_Form {
         unset($_POST['crmPID_B'], $_POST['crmPID']);
       }
 
-      $pageId = $pageId ? $pageId : 1;
+      $pageId = $pageId ?: 1;
       $offset = ($pageId - 1) * $rowCount;
 
       $offset = CRM_Utils_Type::escape($offset, 'Int');
index cd8064400c7fc562d39420904a6e4641bbde25aa..ea347de44e21f69dd39bb97f0a5f78f1a1ec0934 100644 (file)
@@ -135,7 +135,7 @@ class CRM_Mailing_PseudoConstant extends CRM_Core_PseudoConstant {
    *   array reference of all mailing components
    */
   public static function &component($type = NULL) {
-    $name = $type ? $type : 'ALL';
+    $name = $type ?: 'ALL';
 
     if (!self::$component || !array_key_exists($name, self::$component)) {
       if (!self::$component) {
index 603eb9084ce8ae55fc330e344891576a0f9ce16d..c5253d53dba04d0844cff405fda46b831866571a 100644 (file)
@@ -439,7 +439,7 @@ LEFT JOIN  civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul
           $actionMask,
           [
             'mid' => $row['id'],
-            'hashOrMid' => $hash ? $hash : $row['id'],
+            'hashOrMid' => $hash ?: $row['id'],
           ],
           "more",
           FALSE,
index c20e94e56c5d445e0b8b095146a7be9d59f0d021..18496ef20e599f59edacf2680c962df974633e30 100644 (file)
@@ -211,7 +211,7 @@ class CRM_PCP_Page_PCPInfo extends CRM_Core_Page {
     }
 
     $this->assign('honor', $honor);
-    $this->assign('total', $totalAmount ? $totalAmount : '0.0');
+    $this->assign('total', $totalAmount ?: '0.0');
     $this->assign('achieved', $achieved <= 100 ? $achieved : 100);
 
     if ($achieved <= 100) {
index c665dc2b1af1d753fc513ad0a9aa7601a60dc045..1279c56a33058cb859690e6ed9c031ec8f77641b 100644 (file)
@@ -922,7 +922,7 @@ SELECT  pledge.contact_id              as contact_id,
           // 2. send acknowledgement mail
           if ($toEmail && !($doNotEmail || $onHold)) {
             // assign value to template
-            $template->assign('amount_paid', $details['amount_paid'] ? $details['amount_paid'] : 0);
+            $template->assign('amount_paid', $details['amount_paid'] ?: 0);
             $template->assign('next_payment', $details['scheduled_date']);
             $template->assign('amount_due', $details['amount_due']);
             $template->assign('checksumValue', $details['checksumValue']);
index 9ba8bc0ee7ad3aa5c43828f74782a3c72e4a3093..19c766776142d0633ac151f95900bbd1b074e5cf 100644 (file)
@@ -770,7 +770,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
           $return = TRUE;
           if (!$statusMessage) {
             $statusMessage = ts("This profile is configured for contact type '%1'. It cannot be used to edit contacts of other types.",
-                [1 => $profileSubType ? $profileSubType : $profileType]);
+                [1 => $profileSubType ?: $profileType]);
           }
         }
       }
@@ -1367,7 +1367,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
    */
   public function getTemplateFileName() {
     $fileName = $this->checkTemplateFileExists();
-    return $fileName ? $fileName : parent::getTemplateFileName();
+    return $fileName ?: parent::getTemplateFileName();
   }
 
   /**
@@ -1378,7 +1378,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
    */
   public function overrideExtraTemplateFileName() {
     $fileName = $this->checkTemplateFileExists('extra.');
-    return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
+    return $fileName ?: parent::overrideExtraTemplateFileName();
   }
 
   /**
index d17f37d43f3991dc7524743d308d2d5a0deda2fc..d6009aa02d802cffe134e3cf2180e7918e2aac42 100644 (file)
@@ -420,7 +420,7 @@ class CRM_Profile_Page_Dynamic extends CRM_Core_Page {
    */
   public function getTemplateFileName() {
     $fileName = $this->checkTemplateFileExists();
-    return $fileName ? $fileName : parent::getTemplateFileName();
+    return $fileName ?: parent::getTemplateFileName();
   }
 
   /**
@@ -431,7 +431,7 @@ class CRM_Profile_Page_Dynamic extends CRM_Core_Page {
    */
   public function overrideExtraTemplateFileName() {
     $fileName = $this->checkTemplateFileExists('extra.');
-    return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
+    return $fileName ?: parent::overrideExtraTemplateFileName();
   }
 
   /**
index 4ad6a75771ebad1f7c42a88671af7a3744beb569..9bfcebd6018911ab7b455e35a4c0360e9eabfddf 100644 (file)
@@ -483,7 +483,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
    */
   public function getTemplateFileName() {
     $fileName = $this->checkTemplateFileExists();
-    return $fileName ? $fileName : parent::getTemplateFileName();
+    return $fileName ?: parent::getTemplateFileName();
   }
 
   /**
@@ -494,7 +494,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
    */
   public function overrideExtraTemplateFileName() {
     $fileName = $this->checkTemplateFileExists('extra.');
-    return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
+    return $fileName ?: parent::overrideExtraTemplateFileName();
   }
 
 }
index 90d835149640985d2e5bd4ca2ce80183cc3c81ff..5ecdb3b58f5de1dd881bb0fbccbde4904d9fabee 100644 (file)
@@ -195,7 +195,7 @@ class CRM_Profile_Page_View extends CRM_Core_Page {
    */
   public function getTemplateFileName() {
     $fileName = $this->checkTemplateFileExists();
-    return $fileName ? $fileName : parent::getTemplateFileName();
+    return $fileName ?: parent::getTemplateFileName();
   }
 
   /**
@@ -206,7 +206,7 @@ class CRM_Profile_Page_View extends CRM_Core_Page {
    */
   public function overrideExtraTemplateFileName() {
     $fileName = $this->checkTemplateFileExists('extra.');
-    return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
+    return $fileName ?: parent::overrideExtraTemplateFileName();
   }
 
 }
index 6c5e14cf46fd4db05c70d575682ff35bc61d8eae..5078254988e6b3f7d161d80e3420cbffb88a01bb 100644 (file)
@@ -3711,7 +3711,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
         unset($_POST['crmPID_B'], $_POST['crmPID']);
       }
 
-      $pageId = $pageId ? $pageId : 1;
+      $pageId = $pageId ?: 1;
       $this->set(CRM_Utils_Pager::PAGE_ID, $pageId);
       $offset = ($pageId - 1) * $rowCount;
 
@@ -5118,7 +5118,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
    * @param string $table
    */
   public function setEntityRefDefaults(&$field, $table) {
-    $field['attributes'] = $field['attributes'] ? $field['attributes'] : [];
+    $field['attributes'] = $field['attributes'] ?: [];
     $field['attributes'] += [
       'entity' => CRM_Core_DAO_AllCoreTables::getEntityNameForTable($table),
       'multiple' => TRUE,
index 74d2bc35e6070413d1b99b05bc0657f6046fef00..7cb5190442b71d1dcd1913fa4f10ad7ae8a26f7c 100644 (file)
@@ -225,10 +225,10 @@ class CRM_Report_Form_Contribute_RecurSummary extends CRM_Report_Form {
     $startDateRelative = $this->_params["start_date_relative"] ?? NULL;
 
     $startedDateSql = $this->dateClause('start_date', $startDateRelative, $startDateFrom, $startDateTo);
-    $startedDateSql = $startedDateSql ? $startedDateSql : " ( 1 ) ";
+    $startedDateSql = $startedDateSql ?: " ( 1 ) ";
 
     $cancelledDateSql = $this->dateClause('cancel_date', $startDateRelative, $startDateFrom, $startDateTo);
-    $cancelledDateSql = $cancelledDateSql ? $cancelledDateSql : " ( cancel_date IS NOT NULL ) ";
+    $cancelledDateSql = $cancelledDateSql ?: " ( cancel_date IS NOT NULL ) ";
 
     $started = $cancelled = $active = $total = 0;
 
index fa40ee3d8b621047154ff9abe7734a2316bc2577..7666485e9c75c80b20c00f856f4bd27ad58a9146 100644 (file)
@@ -362,7 +362,7 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
         }
       }
 
-      $pageId = $pageId ? $pageId : 1;
+      $pageId = $pageId ?: 1;
       $this->set(CRM_Utils_Pager::PAGE_ID, $pageId);
       $offset = ($pageId - 1) * $rowCount;
 
index da40e49a7a0c63eeb616db789eef19b1bea97c67..ae52483822f2cd5a4e6ded7d1efc63ff26acb7f1 100644 (file)
@@ -56,7 +56,7 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form {
       // We don't want to retrieve template details once it is
       // set in session.
       $templateId = $this->get('template');
-      $this->assign('templateSelected', $templateId ? $templateId : 0);
+      $this->assign('templateSelected', $templateId ?: 0);
       if (isset($defaults['msg_template_id']) && !$templateId) {
         $defaults['SMStemplate'] = $defaults['msg_template_id'];
         $messageTemplate = new CRM_Core_DAO_MessageTemplate();
index f3a0559381139fb981bb7301d3f311f1f7b665b8..76263cce0073a2a010d50f6b40d828e3432e6177 100644 (file)
@@ -43,8 +43,8 @@ class CRM_Utils_Mail {
         throw new CRM_Core_Exception(ts('There is no valid smtp server setting. Click <a href=\'%1\'>Administer >> System Setting >> Outbound Email</a> to set the SMTP Server.', [1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')]));
       }
 
-      $params['host'] = $mailingInfo['smtpServer'] ? $mailingInfo['smtpServer'] : 'localhost';
-      $params['port'] = $mailingInfo['smtpPort'] ? $mailingInfo['smtpPort'] : 25;
+      $params['host'] = $mailingInfo['smtpServer'] ?: 'localhost';
+      $params['port'] = $mailingInfo['smtpPort'] ?: 25;
 
       if ($mailingInfo['smtpAuth']) {
         $params['username'] = $mailingInfo['smtpUsername'];
index a1a941f16048ae19eaac9621824a53eb3bbdc776..d3cf5bf0b886a5ab02f2b8310e68e7ec532d1224 100644 (file)
@@ -377,7 +377,7 @@ class CRM_Utils_Mail_Incoming {
       $createContact,
       $mail
     );
-    $subParam['id'] = $contactID ? $contactID : NULL;
+    $subParam['id'] = $contactID ?: NULL;
   }
 
   /**