CRM/Campaign - Refactor unnecessary uses of CRM_Utils_Array::value
authorcolemanw <coleman@civicrm.org>
Fri, 13 Oct 2023 23:42:49 +0000 (19:42 -0400)
committercolemanw <coleman@civicrm.org>
Sat, 14 Oct 2023 03:21:13 +0000 (23:21 -0400)
CRM/Campaign/BAO/Survey.php
CRM/Campaign/Form/Campaign.php
CRM/Campaign/Form/Petition.php
CRM/Campaign/Form/Survey/Main.php
CRM/Campaign/Page/AJAX.php

index c6aa2dc2cbe9a1fc71573e7fc6874bc5831aa4dc..f0220a12b2b6f2314e6cce98c9a5ba37e8534bb8 100644 (file)
@@ -674,7 +674,7 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a
         );
         $menuLinks[] = sprintf('<a href="%s" class="action-item crm-hover-button" title="%s">%s</a>',
           $urlPath,
-          CRM_Utils_Array::value('title', $link),
+          $link['title'] ?? NULL,
           $link['title']
         );
       }
index 7feef215f251c3bf347d5568bf5de3681d852b36..f5a1c523bb414b93f956c472909f887a4f53f02d 100644 (file)
@@ -291,7 +291,7 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form {
       $params['created_date'] = date('YmdHis');
     }
     // format params
-    $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
+    $params['is_active'] = $params['is_active'] ?? FALSE;
     $params['last_modified_id'] = $session->get('userID');
     $params['last_modified_date'] = date('YmdHis');
     $result = self::submit($params, $this);
index 1cbd72d69bd12616f566863075fdc7fb7f388c1c..55a7377984fa17542d2bc152ad418670304d71c1 100644 (file)
@@ -291,7 +291,7 @@ WHERE  $whereClause
 
     $params['last_modified_id'] = $session->get('userID');
     $params['last_modified_date'] = date('YmdHis');
-    $params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE);
+    $params['is_share'] = $params['is_share'] ?? FALSE;
 
     if ($this->_surveyId) {
 
@@ -309,9 +309,9 @@ WHERE  $whereClause
       $params['created_date'] = date('YmdHis');
     }
 
-    $params['bypass_confirm'] = CRM_Utils_Array::value('bypass_confirm', $params, 0);
-    $params['is_active'] = CRM_Utils_Array::value('is_active', $params, 0);
-    $params['is_default'] = CRM_Utils_Array::value('is_default', $params, 0);
+    $params['bypass_confirm'] = $params['bypass_confirm'] ?? 0;
+    $params['is_active'] = $params['is_active'] ?? 0;
+    $params['is_default'] = $params['is_default'] ?? 0;
 
     $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->getEntityId(), $this->getDefaultEntity());
 
index 2aca9a250b68fe0ac710810da7769bb80b17931a..e23617951bf24bcd9236a67b9f360dadd1b26476 100644 (file)
@@ -155,8 +155,8 @@ class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey {
       $params['created_date'] = date('YmdHis');
     }
 
-    $params['is_active'] = CRM_Utils_Array::value('is_active', $params, 0);
-    $params['is_default'] = CRM_Utils_Array::value('is_default', $params, 0);
+    $params['is_active'] = $params['is_active'] ?? 0;
+    $params['is_default'] = $params['is_default'] ?? 0;
 
     $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->getEntityId(), $this->getDefaultEntity());
 
index 6236287a3030479bf8f600d5b21ee8651b651615..69e15a5585c2a819a55fd0cc2079220c55181996 100644 (file)
@@ -254,9 +254,9 @@ class CRM_Campaign_Page_AJAX {
       TRUE, FALSE,
       FALSE, FALSE,
       FALSE,
-      CRM_Utils_Array::value('whereClause', $voterClause),
+      $voterClause['whereClause'] ?? NULL,
       NULL,
-      CRM_Utils_Array::value('fromClause', $voterClause)
+      $voterClause['fromClause'] ?? NULL
     );
 
     $iTotal = $searchCount;
@@ -287,9 +287,9 @@ class CRM_Campaign_Page_AJAX {
         FALSE, FALSE,
         FALSE, FALSE,
         FALSE,
-        CRM_Utils_Array::value('whereClause', $voterClause),
+        $voterClause['whereClause'] ?? NULL,
         $sortOrder,
-        CRM_Utils_Array::value('fromClause', $voterClause)
+        $voterClause['fromClause'] ?? NULL
       );
       while ($result->fetch()) {
         $contactID = $result->contact_id;