Replace CRM_Utils_Array::value with ?? in variable assignments
[civicrm-core.git] / CRM / Profile / Form.php
index 4ab59bf8084ea7e327a93340e3ab594e4a21b13d..9fb5ef5f7a837219979e834d56a9aff2525c0ca8 100644 (file)
@@ -50,7 +50,8 @@ class CRM_Profile_Form extends CRM_Core_Form {
   protected $_gid;
 
   /**
-   * @var array details of the UFGroup used on this page
+   * @var array
+   * Details of the UFGroup used on this page
    */
   protected $_ufGroup = ['name' => 'unknown'];
 
@@ -356,7 +357,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
         $this->_ufGroup = (array) $dao;
       }
 
-      if (!CRM_Utils_Array::value('is_active', $this->_ufGroup)) {
+      if (empty($this->_ufGroup['is_active'])) {
         CRM_Core_Error::fatal(ts('The requested profile (gid=%1) is inactive or does not exist.', [
           1 => $this->_gid,
         ]));
@@ -840,7 +841,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
         $addCaptcha[$field['group_id']] = $field['add_captcha'];
       }
 
-      if (($name == 'email-Primary') || ($name == 'email-' . isset($primaryLocationType) ? $primaryLocationType : "")) {
+      if (($name == 'email-Primary') || ($name == 'email-' . $primaryLocationType ?? "")) {
         $emailPresent = TRUE;
         $this->_mail = $name;
       }
@@ -993,7 +994,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
     if (!$register && empty($fields['_qf_Edit_upload_duplicate'])) {
       // fix for CRM-3240
       if (!empty($fields['email-Primary'])) {
-        $fields['email'] = CRM_Utils_Array::value('email-Primary', $fields);
+        $fields['email'] = $fields['email-Primary'] ?? NULL;
       }
 
       // fix for CRM-6141
@@ -1186,7 +1187,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
       }
     }
 
-    $addToGroupId = CRM_Utils_Array::value('add_to_group_id', $this->_ufGroup);
+    $addToGroupId = $this->_ufGroup['add_to_group_id'] ?? NULL;
     if (!empty($addToGroupId)) {
       //run same check whether group is a mailing list
       $groupTypes = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group',