(REF) Replace CRM_Utils_Array in context of conditional expressions
authorcolemanw <coleman@civicrm.org>
Sat, 22 Jul 2023 03:24:36 +0000 (20:24 -0700)
committerTim Otten <totten@civicrm.org>
Sat, 22 Jul 2023 03:33:38 +0000 (20:33 -0700)
CRM/Case/XMLProcessor/Process.php
CRM/Core/BAO/UFField.php
CRM/Cxn/ApiRouter.php
CRM/SMS/Form/Upload.php
CRM/Utils/System.php
api/v3/Generic.php

index 97fc4e0459192f2e9fd4a37ac9d2322c357964bb..a8e398474630f4876551e07a4f1ae9c661398317 100644 (file)
@@ -87,7 +87,7 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor {
     $standardTimeline = $params['standardTimeline'] ?? NULL;
     $activitySetName = $params['activitySetName'] ?? NULL;
 
-    if ('Open Case' == CRM_Utils_Array::value('activityTypeName', $params)) {
+    if ('Open Case' == ($params['activityTypeName'] ?? '')) {
       // create relationships for the ones that are required
       foreach ($xml->CaseRoles as $caseRoleXML) {
         foreach ($caseRoleXML->RelationshipType as $relationshipTypeXML) {
@@ -109,7 +109,7 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor {
       }
     }
 
-    if ('Change Case Start Date' == CRM_Utils_Array::value('activityTypeName', $params)) {
+    if ('Change Case Start Date' == ($params['activityTypeName'] ?? '')) {
       // delete all existing activities which are non-empty
       $this->deleteEmptyActivity($params);
     }
@@ -136,7 +136,7 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor {
    * @param array $params
    */
   public function processStandardTimeline($activitySetXML, &$params) {
-    if ('Change Case Type' == CRM_Utils_Array::value('activityTypeName', $params)
+    if ('Change Case Type' == ($params['activityTypeName'] ?? '')
       && CRM_Utils_Array::value('resetTimeline', $params, TRUE)
     ) {
       // delete all existing activities which are non-empty
index afb2e3c7b142d5fcf0ad30c868a62874b7f2d926..88ef83cfe107b1c889a56a9e6ce22ce214a4ed11 100644 (file)
@@ -787,7 +787,7 @@ SELECT  id
 
     if (!empty($index) && (
         // it's empty so we set it OR
-        !CRM_Utils_Array::value($prefixName, $profileAddressFields)
+        empty($profileAddressFields[$prefixName])
         //we are dealing with billing id (precedence)
         || $index == $billing_id
         // we are dealing with primary & billing not set
index 1331e91904f7b8943ce5c7a5d5c7162064ca56d1..0a5327c03c88c4ad2433998c21e48211e088757d 100644 (file)
@@ -32,7 +32,7 @@ class CRM_Cxn_ApiRouter {
     // FIXME: Shouldn't the X-Forwarded-Proto check be part of CRM_Utils_System::isSSL()?
     if (Civi::settings()->get('enableSSL') &&
       !CRM_Utils_System::isSSL() &&
-      strtolower(CRM_Utils_Array::value('X_FORWARDED_PROTO', CRM_Utils_System::getRequestHeaders())) != 'https'
+      strtolower(CRM_Utils_System::getRequestHeaders()['X_FORWARDED_PROTO'] ?? '') != 'https'
     ) {
       return civicrm_api3_create_error('System policy requires HTTPS.');
     }
index e33c9244a79f0c660fd4aa1bb7062d84048ae74f..da40e49a7a0c63eeb616db789eef19b1bea97c67 100644 (file)
@@ -310,7 +310,7 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form {
       }
     }
 
-    if (($params['upload_type'] || file_exists(CRM_Utils_Array::value('tmp_name', $files['textFile']))) ||
+    if (($params['upload_type'] || file_exists($files['textFile']['tmp_name'] ?? '')) ||
       (!$params['upload_type'] && $params['text_message'])
     ) {
 
index 42eb98d4d6d8d5346a4f57daff5c2c67e1cd2e82..8d57b5bed90b226d88fdd4775c08c571b05de340 100644 (file)
@@ -1253,7 +1253,7 @@ class CRM_Utils_System {
     // FIXME: Shouldn't the X-Forwarded-Proto check be part of CRM_Utils_System::isSSL()?
     if (Civi::settings()->get('enableSSL') &&
       !self::isSSL() &&
-      strtolower(CRM_Utils_Array::value('X_FORWARDED_PROTO', $req_headers)) != 'https'
+      strtolower($req_headers['X_FORWARDED_PROTO'] ?? '') != 'https'
     ) {
       // ensure that SSL is enabled on a civicrm url (for cookie reasons etc)
       $url = "https://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
index 690ff54af4aed67ac0f8b62857f5302abde89c3c..85b44c5bc3c4bf72ae56e2d23b9d8395b6b6182d 100644 (file)
@@ -40,7 +40,7 @@
  */
 function civicrm_api3_generic_getfields($apiRequest, $unique = TRUE) {
   static $results = [];
-  if ((CRM_Utils_Array::value('cache_clear', $apiRequest['params']))) {
+  if (!empty($apiRequest['params']['cache_clear'])) {
     $results = [];
     // we will also clear pseudoconstants here - should potentially be moved to relevant BAO classes
     CRM_Core_PseudoConstant::flush();