Array formatting cleanup
authorcolemanw <coleman@civicrm.org>
Tue, 28 Nov 2023 15:27:22 +0000 (10:27 -0500)
committercolemanw <coleman@civicrm.org>
Wed, 29 Nov 2023 15:53:29 +0000 (10:53 -0500)
Multiline arrays aren't always the most readable.
These were all done by an autoformatting tool which got a little too zealous
about breaking every array into multiple lines. They are especially silly within if() statements.

69 files changed:
CRM/Activity/BAO/Activity.php
CRM/Activity/Form/Activity.php
CRM/Activity/Form/ActivityView.php
CRM/Activity/Page/AJAX.php
CRM/Activity/Page/Tab.php
CRM/Campaign/BAO/Survey.php
CRM/Campaign/Form/Search.php
CRM/Campaign/Form/Task/Interview.php
CRM/Campaign/Form/Task/Release.php
CRM/Campaign/Page/AJAX.php
CRM/Case/Audit/Audit.php
CRM/Case/BAO/Case.php
CRM/Case/Form/DeleteClient.php
CRM/Case/Form/EditClient.php
CRM/Contact/BAO/Contact.php
CRM/Contact/BAO/Contact/Utils.php
CRM/Contact/Form/Contact.php
CRM/Contact/Form/Edit/Address.php
CRM/Contact/Form/RelatedContact.php
CRM/Contact/Form/Task/Result.php
CRM/Contact/Task.php
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Contribute/Form/ContributionPage/Amount.php
CRM/Contribute/Form/Search.php
CRM/Contribute/Page/DashBoard.php
CRM/Core/BAO/Address.php
CRM/Core/Block.php
CRM/Core/Form.php
CRM/Core/OptionValue.php
CRM/Core/Page/AJAX/Location.php
CRM/Core/Smarty/plugins/function.simpleActivityContacts.php
CRM/Dedupe/Finder.php
CRM/Event/BAO/Participant.php
CRM/Event/BAO/Query.php
CRM/Event/Form/Registration/Confirm.php
CRM/Event/Form/Task/Batch.php
CRM/Export/BAO/ExportProcessor.php
CRM/Financial/BAO/PaymentProcessor.php
CRM/Financial/Form/FinancialAccount.php
CRM/Financial/Form/FinancialType.php
CRM/Friend/Form.php
CRM/Mailing/BAO/Mailing.php
CRM/Mailing/Form/Component.php
CRM/Mailing/MailStore.php
CRM/Mailing/MailStore/Maildir.php
CRM/Mailing/Selector/Browse.php
CRM/Member/BAO/MembershipType.php
CRM/Member/Page/UserDashboard.php
CRM/PCP/Form/Event.php
CRM/Profile/Form.php
CRM/Profile/Form/Search.php
CRM/Profile/Selector/Listings.php
CRM/Queue/ErrorPolicy.php
CRM/Report/Form.php
CRM/Report/Form/Campaign/SurveyDetails.php
CRM/Report/Form/Contribute/Summary.php
CRM/Report/Form/Contribute/TopDonor.php
CRM/Report/Form/Mailing/Detail.php
CRM/Report/Form/Membership/Summary.php
CRM/Report/Form/Pledge/Pbnp.php
CRM/Report/Utils/Get.php
CRM/SMS/Form/Group.php
CRM/UF/Form/Field.php
CRM/Utils/Chart.php
CRM/Utils/Token.php
api/v3/Activity.php
ext/flexmailer/tests/phpunit/Civi/FlexMailer/Listener/SimpleFilterTest.php
ext/legacycustomsearches/CRM/Contact/Form/Search/Custom/PriceSet.php
tests/phpunit/api/v3/SyntaxConformanceTest.php

index 27596d3f284987e8bdce1451456bcd0b7fd33b71..d74f4fd2aa46d6de8f82418a33ce8ddc0530228b 100644 (file)
@@ -691,9 +691,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
     foreach ($result as $id => $activity) {
       $isBulkActivity = (!$bulkActivityTypeID || ($bulkActivityTypeID === $activity['activity_type_id']));
       foreach ($mappingParams as $apiKey => $expectedName) {
-        if (in_array($apiKey, [
-          'target_contact_name',
-        ])) {
+        if (in_array($apiKey, ['target_contact_name'])) {
 
           if ($isBulkActivity) {
             // @todo  - how is this used? Couldn't we use 'is_bulk' or something clearer?
index cefbe57ae3770dd3f26e784a08104f17baba4db3..35c4bfb936ded0aa2a0964fab1d8144fb7e0dce2 100644 (file)
@@ -292,10 +292,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
 
     // Check for required permissions, CRM-6264.
     if ($this->_activityId &&
-      in_array($this->_action, [
-        CRM_Core_Action::UPDATE,
-        CRM_Core_Action::VIEW,
-      ]) &&
+      in_array($this->_action, [CRM_Core_Action::UPDATE, CRM_Core_Action::VIEW]) &&
       !CRM_Activity_BAO_Activity::checkPermission($this->_activityId, $this->_action)
     ) {
       CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
@@ -406,13 +403,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
       }
       $this->assign('searchKey', $qfKey);
     }
-    elseif (in_array($this->_context, [
-      'standalone',
-      'home',
-      'dashlet',
-      'dashletFullscreen',
-    ])
-    ) {
+    elseif (in_array($this->_context, ['standalone', 'home', 'dashlet', 'dashletFullscreen'])) {
       $urlParams = 'reset=1';
       $urlString = 'civicrm/dashboard';
     }
index 593ff1924c6057df8ff3fb4053f080138672c485..e5223a6f1276fe0faad9ade150ad2beb11e0655a 100644 (file)
@@ -51,12 +51,7 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form {
     }
 
     $session = CRM_Core_Session::singleton();
-    if (!in_array($context, [
-      'home',
-      'dashlet',
-      'dashletFullscreen',
-    ])
-    ) {
+    if (!in_array($context, ['home', 'dashlet', 'dashletFullscreen'])) {
       $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
     }
     else {
index 5c2c63ec9fc581e77c8969da1d6a642212c5ab05..9977d747dd091152e9ce213fdc94504bcf30ef07 100644 (file)
@@ -325,10 +325,7 @@ class CRM_Activity_Page_AJAX {
 
     // Mark previous activity as deleted. If it was a non-case activity
     // then just change the subject.
-    if (in_array($params['mode'], [
-      'move',
-      'file',
-    ])) {
+    if (in_array($params['mode'], ['move', 'file'])) {
       $caseActivity = new CRM_Case_DAO_CaseActivity();
       $caseActivity->case_id = $params['caseID'];
       $caseActivity->activity_id = $otherActivity->id;
index bca1f8abbe222158ac8da45fa5b7a2e3cde5932b..34968914c2b4cf4f80b76386eadec611cd949c29 100644 (file)
@@ -184,10 +184,7 @@ class CRM_Activity_Page_Tab extends CRM_Core_Page {
         'Print PDF Letter'
       );
 
-      if (in_array($activityTypeId, [
-        $emailTypeValue,
-        $letterTypeValue,
-      ])) {
+      if (in_array($activityTypeId, [$emailTypeValue, $letterTypeValue])) {
         return;
       }
     }
index f0220a12b2b6f2314e6cce98c9a5ba37e8534bb8..9976b33dcfa8406ee77a798af796ba546f95f28a 100644 (file)
@@ -266,10 +266,7 @@ SELECT  survey.id    as id,
 
     $select = $from = [];
     foreach ($returnProperties as $property => $ignore) {
-      $value = (in_array($property, [
-        'city',
-        'street_address',
-      ])) ? 'address' : $property;
+      $value = (in_array($property, ['city', 'street_address'])) ? 'address' : $property;
       switch ($property) {
         case 'sort_name':
         case 'contact_type':
index dcbf439915d381e73e87f4b334b867d746f5faa0..528bf2ce5defeacd21e9d445c0e74f7fb13802d3 100644 (file)
@@ -65,12 +65,7 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search {
     //operation for state machine.
     $this->_operation = CRM_Utils_Request::retrieve('op', 'String', $this, FALSE, 'reserve');
     //validate operation.
-    if (!in_array($this->_operation, [
-      'reserve',
-      'release',
-      'interview',
-    ])
-    ) {
+    if (!in_array($this->_operation, ['reserve', 'release', 'interview'])) {
       $this->_operation = 'reserve';
       $this->set('op', $this->_operation);
     }
index 34a7c5978c9788bc3fd84e005fc8bf44e4ecce5a..653f67c0cb16f950093ec2f11f529fa99a1df95e 100644 (file)
@@ -59,11 +59,7 @@ class CRM_Campaign_Form_Task_Interview extends CRM_Campaign_Form_Task {
     $this->_reserveToInterview = $this->get('reserveToInterview');
     if ($this->_reserveToInterview || $this->_votingTab) {
       //user came from voting tab / reserve form.
-      foreach ([
-        'surveyId',
-        'contactIds',
-        'interviewerId',
-      ] as $fld) {
+      foreach (['surveyId', 'contactIds', 'interviewerId'] as $fld) {
         $this->{"_$fld"} = $this->get($fld);
       }
       //get the target voter ids.
@@ -428,11 +424,7 @@ WHERE {$clause}
     }
     elseif ($buttonName == '_qf_Interview_next_interviewToRelease') {
       //get ready to jump to release form.
-      foreach ([
-        'surveyId',
-        'contactIds',
-        'interviewerId',
-      ] as $fld) {
+      foreach (['surveyId', 'contactIds', 'interviewerId'] as $fld) {
         $this->controller->set($fld, $this->{"_$fld"});
       }
       $this->controller->set('interviewToRelease', TRUE);
index 8cfb78ba14b284c396a81c64023c18293a2c876f..ae17d3be8ca8dcac85f395583e1a61ed02332647 100644 (file)
@@ -50,11 +50,7 @@ class CRM_Campaign_Form_Task_Release extends CRM_Campaign_Form_Task {
     $this->_interviewToRelease = $this->get('interviewToRelease');
     if ($this->_interviewToRelease) {
       //user came from interview form.
-      foreach ([
-        'surveyId',
-        'contactIds',
-        'interviewerId',
-      ] as $fld) {
+      foreach (['surveyId', 'contactIds', 'interviewerId'] as $fld) {
         $this->{"_$fld"} = $this->get($fld);
       }
 
index 69e15a5585c2a819a55fd0cc2079220c55181996..7d99c2f666a2fe7777549bdf6bb17c65581111b5 100644 (file)
@@ -127,10 +127,7 @@ class CRM_Campaign_Page_AJAX {
     }
 
     //format multi-select group and contact types.
-    foreach ([
-      'group',
-      'contact_type',
-    ] as $param) {
+    foreach (['group', 'contact_type'] as $param) {
       $paramValue = $params[$param] ?? NULL;
       if ($paramValue) {
         unset($params[$param]);
index 620ef00941de8489f93ffc011b4287c3c590fa28..9f9128241f6caf94dcc461d26d4495933fe8584c 100644 (file)
@@ -102,11 +102,7 @@ class CRM_Case_Audit_Audit {
 
               //CRM-4570
               if ($printReport) {
-                if (!in_array($label, [
-                  'Activity Type',
-                  'Status',
-                ])
-                ) {
+                if (!in_array($label, ['Activity Type', 'Status'])) {
                   $caseActivities[$activityindex][$fieldindex] = [];
                   $caseActivities[$activityindex][$fieldindex]['name'] = $name;
                   $caseActivities[$activityindex][$fieldindex]['label'] = $label;
index bdd20090e2b48fd00fa321a0494bc92bd0a9c5c0..ddb2f68c4e1b215335bfce8d89d73d4364030e3f 100644 (file)
@@ -2541,11 +2541,7 @@ WHERE id IN (' . implode(',', $copiedActivityIds) . ')';
         //has permissions.
         if (!empty($hasPermissions)) {
           //need to check activity object specific.
-          if (in_array($operation, [
-            'view',
-            'edit',
-          ])
-          ) {
+          if (in_array($operation, ['view', 'edit'])) {
             // Check for super permission.
             if (in_array('access all cases and activities', $hasPermissions[$operation])) {
               $allowOperations[$operation] = $allow = TRUE;
index c7614416ea0150b5304589378a45215f5d478a62..58978fb33fca3fa12a8d7ffd1f60e9e61ba3bad1 100644 (file)
@@ -66,10 +66,7 @@ class CRM_Case_Form_DeleteClient extends CRM_Core_Form {
     elseif ($context == 'dashboard') {
       $url = CRM_Utils_System::url('civicrm/case', 'reset=1');
     }
-    elseif (in_array($context, [
-      'dashlet',
-      'dashletFullscreen',
-    ])) {
+    elseif (in_array($context, ['dashlet', 'dashletFullscreen'])) {
       $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
     }
     $session = CRM_Core_Session::singleton();
index 16e7257b73c90fc0c6ad22a89c8371d708c699b4..cf0c5ea7e06bdbb0d55be400c4fdc087da80bcc6 100644 (file)
@@ -45,10 +45,7 @@ class CRM_Case_Form_EditClient extends CRM_Core_Form {
     elseif ($context == 'dashboard') {
       $url = CRM_Utils_System::url('civicrm/case', 'reset=1');
     }
-    elseif (in_array($context, [
-      'dashlet',
-      'dashletFullscreen',
-    ])) {
+    elseif (in_array($context, ['dashlet', 'dashletFullscreen'])) {
       $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
     }
     $session = CRM_Core_Session::singleton();
index fc3435e30f4f6afe9362b63bac77fb1d40b6bfba..d5ab1a5c4e823dabd5f6661caccfd4e38799c2f3 100644 (file)
@@ -1272,12 +1272,7 @@ WHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
       $fields = CRM_Contact_DAO_Contact::import();
 
       // get the fields thar are meant for contact types
-      if (in_array($contactType, [
-        'Individual',
-        'Household',
-        'Organization',
-        'All',
-      ])) {
+      if (in_array($contactType, ['Individual', 'Household', 'Organization', 'All'])) {
         $fields = array_merge($fields, CRM_Core_OptionValue::getFields('', $contactType));
       }
 
@@ -1431,12 +1426,7 @@ WHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
         $fields = CRM_Contact_DAO_Contact::export();
 
         // The fields are meant for contact types.
-        if (in_array($contactType, [
-          'Individual',
-          'Household',
-          'Organization',
-          'All',
-        ])) {
+        if (in_array($contactType, ['Individual', 'Household', 'Organization', 'All'])) {
           $fields = array_merge($fields, CRM_Core_OptionValue::getFields('', $contactType));
         }
         // add current employer for individuals
@@ -3057,10 +3047,7 @@ LEFT JOIN civicrm_email    ON ( civicrm_contact.id = civicrm_email.contact_id )
           continue;
         }
         // build directly accessible action menu.
-        if (in_array($values['ref'], [
-          'view-contact',
-          'edit-contact',
-        ])) {
+        if (in_array($values['ref'], ['view-contact', 'edit-contact'])) {
           $contextMenu['primaryActions'][$key] = [
             'title' => $values['title'],
             'ref' => $values['ref'],
@@ -3169,9 +3156,7 @@ LEFT JOIN civicrm_email    ON ( civicrm_contact.id = civicrm_email.contact_id )
         ) {
           $hasAllPermissions = TRUE;
         }
-        elseif (in_array($menuOptions['ref'], [
-          'new-email',
-        ])) {
+        elseif (in_array($menuOptions['ref'], ['new-email'])) {
           // grant permissions for these tasks.
           $hasAllPermissions = TRUE;
         }
index 2b972e77f37fb6739f5c7016b774f2276bc2bc6a..dfcaaf54155d08d023cdc6a5e32aa7cb5231540c 100644 (file)
@@ -584,10 +584,7 @@ UPDATE civicrm_contact
       }
 
       // check permission on acl basis.
-      if (in_array($task, [
-        'view',
-        'edit',
-      ])) {
+      if (in_array($task, ['view', 'edit'])) {
         $aclPermission = CRM_Core_Permission::VIEW;
         if ($task == 'edit') {
           $aclPermission = CRM_Core_Permission::EDIT;
index 0b0aec7ab16fedb991e1b281ef0bb3e2693ab171..8bfc19f3773047df6efc14cc2f1f498175aaa927 100644 (file)
@@ -680,10 +680,8 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
             if (!empty($blockValues['is_primary'])) {
               $hasPrimary[] = $instance;
               if (!$primaryID &&
-                in_array($name, [
-                  'email',
-                  'openid',
-                ]) && !empty($blockValues[$name])
+                in_array($name, ['email', 'openid']) &&
+                !empty($blockValues[$name])
               ) {
                 $primaryID = $blockValues[$name];
               }
@@ -1397,10 +1395,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
           'street_name',
           'street_unit',
         ] as $fld) {
-          if (in_array($fld, [
-            'street_name',
-            'street_unit',
-          ])) {
+          if (in_array($fld, ['street_name', 'street_unit'])) {
             $streetAddress .= ' ';
           }
           // CRM-17619 - if the street number suffix begins with a number, add a space
index 4c82a7ff5134d3060fc7fd644a48da974bccaae2..ea280315fc06e71ac2c29036bcc38c261fe1ac27 100644 (file)
@@ -283,10 +283,7 @@ class CRM_Contact_Form_Edit_Address {
             'street_name',
             'street_unit',
           ] as $fld) {
-            if (in_array($fld, [
-              'street_name',
-              'street_unit',
-            ])) {
+            if (in_array($fld, ['street_name', 'street_unit'])) {
               $streetAddress .= ' ';
             }
             // CRM-17619 - if the street number suffix begins with a number, add a space
index 68f64b70864c38ac4a4eb2f93a64419cdc5afe87..bdacf8249003da3c9dcfb0d434b879c74e609d13 100644 (file)
@@ -137,11 +137,7 @@ class CRM_Contact_Form_RelatedContact extends CRM_Core_Form {
     $params = $this->controller->exportValues($this->_name);
 
     $locType = CRM_Core_BAO_LocationType::getDefault();
-    foreach ([
-      'phone',
-      'email',
-      'address',
-    ] as $locFld) {
+    foreach (['phone', 'email', 'address'] as $locFld) {
       if (!empty($this->_defaults[$locFld]) && $this->_defaults[$locFld][1]['location_type_id']) {
         $params[$locFld][1]['is_primary'] = $this->_defaults[$locFld][1]['is_primary'];
         $params[$locFld][1]['location_type_id'] = $this->_defaults[$locFld][1]['location_type_id'];
index 03bcfe8d1fdb5878262847ae8982197c62531f16..36692eef6f9faa6c0404ba24792c1d832fa7a487 100644 (file)
@@ -30,10 +30,7 @@ class CRM_Contact_Form_Task_Result extends CRM_Contact_Form_Task {
     $this->set('searchRows', '');
 
     $context = $this->get('context');
-    if (in_array($context, [
-      'smog',
-      'amtg',
-    ])) {
+    if (in_array($context, ['smog', 'amtg'])) {
       $urlParams = 'reset=1&force=1&context=smog&gid=';
       $urlParams .= ($context == 'smog') ? $this->get('gid') : $this->get('amtgID');
       $session->replaceUserContext(CRM_Utils_System::url('civicrm/group/search', $urlParams));
index 4a6989bd070c198225df7b73051922d5d19a1937..a992548150ce8e33c0bd267f3a47be0b5c8f5697 100644 (file)
@@ -301,11 +301,7 @@ class CRM_Contact_Task extends CRM_Core_Task {
         self::LABEL_CONTACTS => self::$_tasks[self::LABEL_CONTACTS]['title'],
       ];
 
-      foreach ([
-        self::MAP_CONTACTS,
-        self::CREATE_MAILING,
-        self::TASK_SMS,
-      ] as $task) {
+      foreach ([self::MAP_CONTACTS, self::CREATE_MAILING, self::TASK_SMS] as $task) {
         if (isset(self::$_tasks[$task]) &&
           !empty(self::$_tasks[$task]['title'])
         ) {
index 7c0368b7eafccaf67e10be8f7003379580aedb1b..45dd561553cf03d81517e46214b4cc8ff79dc801 100644 (file)
@@ -427,11 +427,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     elseif (!empty($this->_values['is_for_organization'])) {
       // no on behalf of an organization, CRM-5519
       // so reset loc blocks from main params.
-      foreach ([
-        'phone',
-        'email',
-        'address',
-      ] as $blk) {
+      foreach (['phone', 'email', 'address'] as $blk) {
         if (isset($this->_params[$blk])) {
           unset($this->_params[$blk]);
         }
index 03df84064adebaedb978280aae5f24c5de370967..03092f75e7b8e943b2d2995a354325eeb9eda1e0 100644 (file)
@@ -483,10 +483,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
         $val = $defaultVal;
       }
 
-      if (in_array($field, [
-        'min_amount',
-        'max_amount',
-      ])) {
+      if (in_array($field, ['min_amount', 'max_amount'])) {
         $val = CRM_Utils_Rule::cleanMoney($val);
       }
 
index 8997b4208e34a6d1e8a5eedfc171e8881bc232b9..f1401dfc8e2d317c41f1a0e5b20326020484c3c4 100644 (file)
@@ -259,10 +259,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search {
       $this->_formValues['is_template'] = 0;
     }
 
-    foreach ([
-      'contribution_amount_low',
-      'contribution_amount_high',
-    ] as $f) {
+    foreach (['contribution_amount_low', 'contribution_amount_high'] as $f) {
       if (isset($this->_formValues[$f])) {
         // @todo - stop changing formValues - respect submitted form values, change a working array.
         $this->_formValues[$f] = CRM_Utils_Rule::cleanMoney($this->_formValues[$f]);
index aa8cdbbc413df36175391074c8d05fbeff134199..fbb5c253b0d75f4733da7470fb6a424bd8cd5179 100644 (file)
@@ -35,11 +35,7 @@ class CRM_Contribute_Page_DashBoard extends CRM_Core_Page {
 
     //get contribution dates.
     $dates = CRM_Contribute_BAO_Contribution::getContributionDates();
-    foreach ([
-      'now',
-      'yearDate',
-      'monthDate',
-    ] as $date) {
+    foreach (['now', 'yearDate', 'monthDate'] as $date) {
       $$date = $dates[$date];
     }
     // fiscal years end date
index a0aa6a50191e7bfac3c09c1d9fec520872c562e6..aa219d505506012452fbd642d142f57d30f7bfcd 100644 (file)
@@ -720,10 +720,7 @@ ORDER BY civicrm_address.is_primary DESC, civicrm_address.location_type_id DESC,
     ];
 
     // overwriting $streetUnitFormats for 'en_CA' and 'fr_CA' locale
-    if (in_array($locale, [
-      'en_CA',
-      'fr_CA',
-    ])) {
+    if (in_array($locale, ['en_CA', 'fr_CA'])) {
       $streetUnitFormats = ['APT', 'APP', 'SUITE', 'BUREAU', 'UNIT'];
     }
     //@todo per CRM-14459 this regex picks up words with the string in them - e.g APT picks up
index 4e034084f812dce675a06b7b22e2e6498b59bf9f..e33e9289331e4c28ddbc3216a8bc265cfbe54bc6 100644 (file)
@@ -218,10 +218,7 @@ class CRM_Core_Block {
     $block = [];
     foreach (self::properties() as $id => $value) {
       if ($value['active']) {
-        if (in_array($id, [
-          self::ADD,
-          self::CREATE_NEW,
-        ])) {
+        if (in_array($id, [self::ADD, self::CREATE_NEW])) {
           $hasAccess = TRUE;
           if (!CRM_Core_Permission::check('add contacts') &&
             !CRM_Core_Permission::check('edit groups')
index 461a0c32752150e090e8d95d03496987a54eba9c..99e439b536283edddc062ab97803716a1d02e4d3 100644 (file)
@@ -626,10 +626,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     $this->postProcessHook();
 
     // Respond with JSON if in AJAX context (also support legacy value '6')
-    if ($allowAjax && !empty($_REQUEST['snippet']) && in_array($_REQUEST['snippet'], [
-      CRM_Core_Smarty::PRINT_JSON,
-      6,
-    ])) {
+    if ($allowAjax && !empty($_REQUEST['snippet']) && in_array($_REQUEST['snippet'], [CRM_Core_Smarty::PRINT_JSON, 6])) {
       $this->ajaxResponse['buttonName'] = str_replace('_qf_' . $this->getAttribute('id') . '_', '', $this->controller->getButtonName());
       $this->ajaxResponse['action'] = $this->_action;
       if (isset($this->_id) || isset($this->id)) {
index 89f45a28da2abe29d95d353c60ab371c4b336ce8..2ce77fe815199227cc6e45c0de05166775747d1f 100644 (file)
@@ -306,12 +306,7 @@ class CRM_Core_OptionValue {
       elseif ($mode == '') {
         //the fields email greeting and postal greeting are meant only for Individual and Household
         //the field addressee is meant for all contact types, CRM-4575
-        if (in_array($contactType, [
-          'Individual',
-          'Household',
-          'Organization',
-          'All',
-        ])) {
+        if (in_array($contactType, ['Individual', 'Household', 'Organization', 'All'])) {
           $nameTitle = [
             'addressee' => [
               'name' => 'addressee',
index 2e2ce83ca6f7dfdc7c5816ebf4fb921c7fe969d6..100968942f452bdd9d86ba8d556d002e8ed396b5 100644 (file)
@@ -210,15 +210,8 @@ class CRM_Core_Page_AJAX_Location {
     );
     // lets output only required fields.
     foreach ($addressOptions as $element => $isSet) {
-      if ($isSet && (!in_array($element, [
-        'im',
-        'openid',
-      ]))) {
-        if (in_array($element, [
-          'country',
-          'state_province',
-          'county',
-        ])) {
+      if ($isSet && (!in_array($element, ['im', 'openid']))) {
+        if (in_array($element, ['country', 'state_province', 'county'])) {
           $element .= '_id';
         }
         elseif ($element == 'address_name') {
@@ -227,29 +220,17 @@ class CRM_Core_Page_AJAX_Location {
         $fld = "address[1][{$element}]";
         $value = $location['address'][1][$element] ?? NULL;
         $value = $value ?: "";
-        $result[str_replace([
-          '][',
-          '[',
-          "]",
-        ], ['_', '_', ''], $fld)] = $value;
+        $result[str_replace(['][', '[', ']'], ['_', '_', ''], $fld)] = $value;
       }
     }
 
-    foreach ([
-      'email',
-      'phone_type_id',
-      'phone',
-    ] as $element) {
+    foreach (['email', 'phone_type_id', 'phone'] as $element) {
       $block = ($element == 'phone_type_id') ? 'phone' : $element;
       for ($i = 1; $i < 3; $i++) {
         $fld = "{$block}[{$i}][{$element}]";
         $value = $location[$block][$i][$element] ?? NULL;
         $value = $value ?: "";
-        $result[str_replace([
-          '][',
-          '[',
-          "]",
-        ], ['_', '_', ''], $fld)] = $value;
+        $result[str_replace(['][', '[', ']'], ['_', '_', ''], $fld)] = $value;
       }
     }
 
index cb3ecf363a7d8595f7f442134d3a0a03302d5a2f..3f092924ec1c94581bd5a2c64b3f82f779092f60 100644 (file)
@@ -50,10 +50,7 @@ function smarty_function_simpleActivityContacts($params, &$smarty) {
     $baseContactParams['return.' . $field] = 1;
   }
 
-  foreach ([
-    'target',
-    'assignee',
-  ] as $role) {
+  foreach (['target', 'assignee'] as $role) {
     $contact = [];
     if (!empty($activity[$role . '_contact_id'])) {
       $contact_id = array_shift($activity[$role . '_contact_id']);
index 77fe3d185c21c01adea407bfd4b77a24b09c78fb..e6082c455ebc8c46a4ac5ee45109bec9f121dbcf 100644 (file)
@@ -191,10 +191,7 @@ class CRM_Dedupe_Finder {
     }
 
     // handle {birth,deceased}_date
-    foreach ([
-      'birth_date',
-      'deceased_date',
-    ] as $date) {
+    foreach (['birth_date', 'deceased_date'] as $date) {
       if (!empty($fields[$date])) {
         $flat[$date] = $fields[$date];
         if (is_array($flat[$date])) {
index e0946b03da3db848f37f8fbaf74cf1affc5685ed..f9f0c1c9569ee052da2d2544ff9969b412998c89 100644 (file)
@@ -211,10 +211,7 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant implements \Ci
     }
     $noteValue = NULL;
     $hasNoteField = FALSE;
-    foreach ([
-      'note',
-      'participant_note',
-    ] as $noteFld) {
+    foreach (['note', 'participant_note'] as $noteFld) {
       if (array_key_exists($noteFld, $params)) {
         $noteValue = $params[$noteFld];
         $hasNoteField = TRUE;
index 9bffff952c229bde08699d8b039760b61cc8fbf2..b1bf8f8b6825144e1acaccd62adcf43a9243b133 100644 (file)
@@ -434,11 +434,7 @@ class CRM_Event_BAO_Query extends CRM_Core_BAO_Query {
       case 'event_type_id':
       case 'event_title':
         $qillName = $name;
-        if (in_array($name, [
-          'event_id',
-          'event_title',
-          'event_is_public',
-        ])) {
+        if (in_array($name, ['event_id', 'event_title', 'event_is_public'])) {
           $name = str_replace('event_', '', $name);
         }
         $dataType = !empty($fields[$qillName]['type']) ? CRM_Utils_Type::typeToString($fields[$qillName]['type']) : 'String';
index ef3b46d8ca8204dea1ecd4a792edba08dc211bda..daec9350a1c00ffad0841b3f865595bc5bb2d240 100644 (file)
@@ -216,10 +216,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
         $taxAmount += $v['tax_amount'];
         if (is_array($v)) {
           $this->cleanMoneyFields($v);
-          foreach ([
-            'first_name',
-            'last_name',
-          ] as $name) {
+          foreach (['first_name', 'last_name'] as $name) {
             if (isset($v['billing_' . $name]) &&
               !isset($v[$name])
             ) {
index 1e1b896b1904ed8f75181298a72cc918fd767d1d..92e1becbf9172036ff5e95f3cf0d97e9f194b1bc 100644 (file)
@@ -331,11 +331,7 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task {
     }
 
     //set values for ipn code.
-    foreach ([
-      'fee_amount',
-      'check_number',
-      'payment_instrument_id',
-    ] as $field) {
+    foreach (['fee_amount', 'check_number', 'payment_instrument_id'] as $field) {
       if (!$input[$field] = CRM_Utils_Array::value($field, $params)) {
         $input[$field] = $contribution->$field;
       }
index 770b8e09121970972ebae2219471ade60d1e9ef2..2b26fd10284e15cecbf60b9acf1d48388ed56586 100644 (file)
@@ -1126,11 +1126,7 @@ class CRM_Export_BAO_ExportProcessor {
 
         return CRM_Core_BAO_CustomField::displayValue($fieldValue, $cfID);
       }
-      elseif (in_array($field, [
-        'email_greeting',
-        'postal_greeting',
-        'addressee',
-      ])) {
+      elseif (in_array($field, ['email_greeting', 'postal_greeting', 'addressee'])) {
         //special case for greeting replacement
         $fldValue = "{$field}_display";
         return $iterationDAO->$fldValue;
@@ -2138,11 +2134,9 @@ WHERE  id IN ( $deleteIDString )
           $fieldValue = $imProviders[$relationValue] ?? NULL;
         }
         // CRM-13995
-        elseif (is_object($relDAO) && in_array($relationField, [
-          'email_greeting',
-          'postal_greeting',
-          'addressee',
-        ])) {
+        elseif (is_object($relDAO) &&
+          in_array($relationField, ['email_greeting', 'postal_greeting', 'addressee'])
+        ) {
           //special case for greeting replacement
           $fldValue = "{$relationField}_display";
           $fieldValue = $relDAO->$fldValue;
index b46df53a76dbda1dd464adfa9b086da3d1a56e46..e0c9fa40e4e36f2336c420e4ade6b2939a9108d2 100644 (file)
@@ -482,12 +482,7 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces
    */
   public static function getProcessorForEntity($entityID, $component = 'contribute', $type = 'id') {
     $result = NULL;
-    if (!in_array($component, [
-      'membership',
-      'contribute',
-      'recur',
-    ])
-    ) {
+    if (!in_array($component, ['membership', 'contribute', 'recur'])) {
       return $result;
     }
 
index 727c2335e3451c2dee677a0b797b444cffebeae7..2ea06f7705c71438f29e116b92cd4da95566233b 100644 (file)
@@ -200,12 +200,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
       if ($this->_action & CRM_Core_Action::UPDATE) {
         $params['id'] = $this->_id;
       }
-      foreach ([
-        'is_active',
-        'is_deductible',
-        'is_tax',
-        'is_default',
-      ] as $field) {
+      foreach (['is_active', 'is_deductible', 'is_tax', 'is_default'] as $field) {
         $params[$field] = $params[$field] ?? FALSE;
       }
       $financialAccount = CRM_Financial_BAO_FinancialAccount::writeRecord($params);
index 4521ca3afc41fb62ca76540a376457f326230ca8..0a953bf5ba6ecf2593fb42349a1b52deff7a4e7c 100644 (file)
@@ -117,11 +117,7 @@ class CRM_Financial_Form_FinancialType extends CRM_Core_Form {
       if ($this->_id) {
         $params['id'] = $this->_id;
       }
-      foreach ([
-        'is_active',
-        'is_reserved',
-        'is_deductible',
-      ] as $field) {
+      foreach (['is_active', 'is_reserved', 'is_deductible'] as $field) {
         $params[$field] = $params[$field] ?? FALSE;
       }
       $financialType = civicrm_api3('FinancialType', 'create', $params);
index 939975446a45606ba1b7b4478563a464078f6aa7..c36056d048fe09487b8edca1f4c892f03df98c75 100644 (file)
@@ -56,10 +56,7 @@ class CRM_Friend_Form extends CRM_Core_Form {
 
     $pcomponent = CRM_Utils_Request::retrieve('pcomponent', 'String', $this, TRUE);
 
-    if (in_array($pcomponent, [
-      'contribute',
-      'event',
-    ])) {
+    if (in_array($pcomponent, ['contribute', 'event'])) {
       $values = [];
       $params = ['id' => $this->_entityId];
       CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage',
index ae2037a0b698efe369242d86a39b94566b8e2d87..52c6bb78204b145f6cab96510e67e74b41e45a53 100644 (file)
@@ -616,11 +616,7 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing implements \Civi\C
 
       $this->preparedTemplates = [];
 
-      foreach ([
-        'html',
-        'text',
-        'subject',
-      ] as $key) {
+      foreach (['html', 'text', 'subject'] as $key) {
         if (!isset($templates[$key])) {
           continue;
         }
index 6044fd565888a6011a84405daa3808ab4bdcfc87..660d0a8e1b77428c4a00135a0f4cf58f8cc5b613 100644 (file)
@@ -146,10 +146,7 @@ class CRM_Mailing_Form_Component extends CRM_Core_Form {
       $InvalidTokens = ['action.forward' => ts("This token can only be used in send mailing context (body, header, footer)..")];
     }
     $errors = [];
-    foreach ([
-      'text',
-      'html',
-    ] as $type) {
+    foreach (['text', 'html'] as $type) {
       $dataErrors = [];
       foreach ($InvalidTokens as $token => $desc) {
         if ($params['body_' . $type]) {
index 13626fcf1cac661360eb899768cda144f57f7ac4..1aa3e62b34197b2acc954a4dce6fbf812cf8373d 100644 (file)
@@ -191,11 +191,7 @@ class CRM_Mailing_MailStore {
   public function maildir($name) {
     $config = CRM_Core_Config::singleton();
     $dir = $config->customFileUploadDir . DIRECTORY_SEPARATOR . $name;
-    foreach ([
-      'cur',
-      'new',
-      'tmp',
-    ] as $sub) {
+    foreach (['cur', 'new', 'tmp'] as $sub) {
       if (!file_exists($dir . DIRECTORY_SEPARATOR . $sub)) {
         if ($this->_debug) {
           print "creating $dir/$sub\n";
index 8668ce12e6c3bdd2c56bbd17069dea13a6e5d392..33490dd0d50b5a14637f63845e8a79bd7d31a72b 100644 (file)
@@ -82,10 +82,7 @@ class CRM_Mailing_MailStore_Maildir extends CRM_Mailing_MailStore {
     // set property text attachment as file CRM-5408
     $parser->options->parseTextAttachmentsAsFiles = TRUE;
 
-    foreach ([
-      'cur',
-      'new',
-    ] as $subdir) {
+    foreach (['cur', 'new'] as $subdir) {
       $dir = $this->_dir . DIRECTORY_SEPARATOR . $subdir;
       foreach (scandir($dir) as $file) {
         if ($file == '.' or $file == '..') {
index d5cf043fb62f0b3fa0d792664afd224e5c3ff23c..cf6fd1e6cba37053a8f685efba5ac5a307f75c61 100644 (file)
@@ -378,14 +378,8 @@ LEFT JOIN  civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul
             $actionMask = CRM_Core_Action::PREVIEW;
           }
         }
-        if (in_array($row['status'], [
-          'Scheduled',
-          'Running',
-          'Paused',
-        ])) {
-          if ($allAccess ||
-            ($showApprovalLinks && $showCreateLinks && $showScheduleLinks)
-          ) {
+        if (in_array($row['status'], ['Scheduled', 'Running', 'Paused'])) {
+          if ($allAccess || ($showApprovalLinks && $showCreateLinks && $showScheduleLinks)) {
 
             $actionMask |= CRM_Core_Action::DISABLE;
             if ($row['status'] === "Paused") {
index 0d686deacb7ad035be2a662dbe79f3d313611cdd..aab5faf3896ec7ac5d6a8d43e6c96f012c72b83a 100644 (file)
@@ -298,11 +298,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType implem
     $membershipTypeDetails = self::getMembershipTypeDetails($membershipTypeId);
 
     // Convert all dates to 'Y-m-d' format.
-    foreach ([
-      'joinDate',
-      'startDate',
-      'endDate',
-    ] as $dateParam) {
+    foreach (['joinDate', 'startDate', 'endDate'] as $dateParam) {
       if (!empty($$dateParam)) {
         $$dateParam = CRM_Utils_Date::processDate($$dateParam, NULL, FALSE, 'Y-m-d');
       }
index bcc693f61a89706f2cb1ffb973808c5392657075..5e427c40bec8059c0d6115d20640690249c00923 100644 (file)
@@ -38,10 +38,7 @@ class CRM_Member_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoard
 
       //get the membership status and type values.
       $statusANDType = CRM_Member_BAO_Membership::getStatusANDTypeValues($dao->id);
-      foreach ([
-        'status',
-        'membership_type',
-      ] as $fld) {
+      foreach (['status', 'membership_type'] as $fld) {
         $membership[$dao->id][$fld] = $statusANDType[$dao->id][$fld] ?? NULL;
       }
       if (!empty($statusANDType[$dao->id]['is_current_member'])) {
index 5448225acc030bd27ab893a2a2eddd2484c72689..b51425d8c580140fa71ea79b8d99e3c701ea0c1f 100644 (file)
@@ -100,10 +100,7 @@ class CRM_PCP_Form_Event extends CRM_Event_Form_ManageEvent {
     $pcpBlock->find(TRUE);
 
     if (!empty($pcpBlock->id) && CRM_PCP_BAO_PCP::getPcpBlockInUse($pcpBlock->id)) {
-      foreach ([
-        'target_entity_type',
-        'target_entity_id',
-      ] as $element_name) {
+      foreach (['target_entity_type', 'target_entity_id'] as $element_name) {
         $element = $this->getElement($element_name);
         $element->freeze();
       }
index e20bd8d40b92fa9176b165637f42cc94730c70ea..32cea9291c32005cb44dd8d09c3005264054faeb 100644 (file)
@@ -473,11 +473,8 @@ class CRM_Profile_Form extends CRM_Core_Form {
           }
 
         }
-        elseif (!empty($this->_multiRecordFields)
-          && (!$this->_multiRecord || !in_array($this->_multiRecord, [
-            CRM_Core_Action::DELETE,
-            CRM_Core_Action::UPDATE,
-          ]))
+        elseif (!empty($this->_multiRecordFields) &&
+          (!$this->_multiRecord || !in_array($this->_multiRecord, [CRM_Core_Action::DELETE, CRM_Core_Action::UPDATE]))
         ) {
           CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header');
           //multi-record listing page
index 71d9a6cc518d922da42c0db5cc29ed837e9e646f..dc5e7efa4d4519d44274819c1638eef8bc259258 100644 (file)
@@ -63,10 +63,7 @@ class CRM_Profile_Form_Search extends CRM_Profile_Form {
           $value[$item] = 1;
         }
       }
-      elseif (in_array($key, [
-        'birth_date',
-        'deceased_date',
-      ])) {
+      elseif (in_array($key, ['birth_date', 'deceased_date'])) {
         list($value) = CRM_Utils_Date::setDateDefaults($value);
       }
 
index 87d04a9c81c173f8d781109351348bd5755dd793..c2ede95215759f308a0ef6d2f6ab8970804dd4fa 100644 (file)
@@ -310,11 +310,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR
                 $locationTypeName = $locationTypes[$lType];
               }
 
-              if (in_array($fieldName, [
-                'phone',
-                'im',
-                'email',
-              ])) {
+              if (in_array($fieldName, ['phone', 'im', 'email'])) {
                 if ($type) {
                   $name = "`$locationTypeName-$fieldName-$type`";
                 }
@@ -523,11 +519,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR
               continue;
             }
             $locationTypeName = str_replace(' ', '_', $locationTypeName);
-            if (in_array($fieldName, [
-              'phone',
-              'im',
-              'email',
-            ])) {
+            if (in_array($fieldName, ['phone', 'im', 'email'])) {
               if ($type) {
                 $names[] = "{$locationTypeName}-{$fieldName}-{$type}";
               }
@@ -643,10 +635,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR
           $dname = $name . '_display';
           $row[] = $result->$dname;
         }
-        elseif (in_array($name, [
-          'birth_date',
-          'deceased_date',
-        ])) {
+        elseif (in_array($name, ['birth_date', 'deceased_date'])) {
           $row[] = CRM_Utils_Date::customFormat($result->$name);
         }
         elseif (isset($result->$name)) {
index 9246036f9bc272877ca4ca8d863d85aa76b008d0..d7ffeff762a27bbb772e9a1e7cb52290b94971db 100644 (file)
@@ -60,11 +60,7 @@ class CRM_Queue_ErrorPolicy {
   protected function activate() {
     $this->active = TRUE;
     $this->backup = [];
-    foreach ([
-      'display_errors',
-      'html_errors',
-      'xmlrpc_errors',
-    ] as $key) {
+    foreach (['display_errors', 'html_errors', 'xmlrpc_errors'] as $key) {
       $this->backup[$key] = ini_get($key);
       ini_set($key, 0);
     }
@@ -76,11 +72,7 @@ class CRM_Queue_ErrorPolicy {
    */
   protected function deactivate() {
     restore_error_handler();
-    foreach ([
-      'display_errors',
-      'html_errors',
-      'xmlrpc_errors',
-    ] as $key) {
+    foreach (['display_errors', 'html_errors', 'xmlrpc_errors'] as $key) {
       ini_set($key, $this->backup[$key]);
     }
     $this->active = FALSE;
index 2c2605ce4f4d7741ebe2cbde5db3981ff67d194c..91622e7c26f307f0d968bd429c531ed8c46622da 100644 (file)
@@ -4272,14 +4272,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
   protected function isFieldFiltered($prop) {
     if (!empty($prop['filters']) && $this->_customGroupFilters) {
       foreach ($prop['filters'] as $fieldAlias => $val) {
-        foreach ([
-          'value',
-          'min',
-          'max',
-          'relative',
-          'from',
-          'to',
-        ] as $attach) {
+        foreach (['value', 'min', 'max', 'relative', 'from', 'to'] as $attach) {
           if (isset($this->_params[$fieldAlias . '_' . $attach]) &&
             (!empty($this->_params[$fieldAlias . '_' . $attach])
               || ($attach != 'relative' &&
index fe56fbdc8053c3b4fe486c30fba59663bf426e74..9191acc4efd18a46384c06ead283e7edbc988eab 100644 (file)
@@ -628,10 +628,7 @@ INNER JOIN  civicrm_custom_group cg ON ( cg.id = cf.custom_group_id )
       if ($responseField->option_group_id) {
         //show value for print and pdf.
         $value = $responseField->label;
-        if (in_array($this->_outputMode, [
-          'print',
-          'pdf',
-        ])) {
+        if (in_array($this->_outputMode, ['print', 'pdf'])) {
           $value = $responseField->value;
         }
         $fieldValueMap[$responseField->option_group_id][$responseField->value] = $value;
index 32b51586568df681d3bd23b4c47fd09360c1e149..dfedb6043bca823d957c4a18bcc38d64c2047b8e 100644 (file)
@@ -481,11 +481,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
     $errors = $self->customDataFormRule($fields, $ignoreFields);
 
     if (empty($fields['fields']['total_amount'])) {
-      foreach ([
-        'total_count_value',
-        'total_sum_value',
-        'total_avg_value',
-      ] as $val) {
+      foreach (['total_count_value', 'total_sum_value', 'total_avg_value'] as $val) {
         if (!empty($fields[$val])) {
           $errors[$val] = ts("Please select the Amount Statistics");
         }
index 97b43806e2504e1b9690b555744063527e542558..3ad31bee78fa75b4625c19f5e9a5eff43fbd6cc1 100644 (file)
@@ -226,11 +226,7 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
     $op = $fields['total_range_op'] ?? NULL;
     $val = $fields['total_range_value'] ?? NULL;
 
-    if (!in_array($op, [
-      'eq',
-      'lte',
-    ])
-    ) {
+    if (!in_array($op, ['eq', 'lte'])) {
       $errors['total_range_op'] = ts("Please select 'Is equal to' OR 'Is Less than or equal to' operator");
     }
 
index 52df57c7a7d0a9f39746fdac5191743d4c8e65fc..045e18b79bfbc9d97754ee8022dae7f68755c9a2 100644 (file)
@@ -271,12 +271,7 @@ class CRM_Report_Form_Mailing_Detail extends CRM_Report_Form {
           if (!empty($field['required']) ||
             !empty($this->_params['fields'][$fieldName])
           ) {
-            if (in_array($fieldName, [
-              'unsubscribe_id',
-              'optout_id',
-              'forward_id',
-              'reply_id',
-            ])) {
+            if (in_array($fieldName, ['unsubscribe_id', 'optout_id', 'forward_id', 'reply_id'])) {
               $select[] = "IF({$field['dbAlias']} IS NULL, 'No', 'Yes') as {$tableName}_{$fieldName}";
               $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
               $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = $field['no_display'] ?? NULL;
index 68fc16695cf57f866d5578c00bd42f0350278192..9ce592b5d9dbdacae5583fd7db02dc39bb75db48 100644 (file)
@@ -319,11 +319,7 @@ LEFT  JOIN civicrm_contribution  {$this->_aliases['civicrm_contribution']}
     $this->assign('statistics', $this->statistics($rows));
 
     if (!empty($this->_params['charts'])) {
-      foreach ([
-        'receive_date',
-        $this->_interval,
-        'value',
-      ] as $ignore) {
+      foreach (['receive_date', $this->_interval, 'value'] as $ignore) {
         unset($graphRows[$ignore][$count - 1]);
       }
 
index e0e6f9f1175f882977dc14e592ef4e2417893c6a..bcf3381045f0195b3f8ca4a190f2aa84fbb272d2 100644 (file)
@@ -198,11 +198,7 @@ class CRM_Report_Form_Pledge_Pbnp extends CRM_Report_Form {
 
     $allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
     $pendingStatus = array_search('Pending', $allStatus);
-    foreach ([
-      'Pending',
-      'In Progress',
-      'Overdue',
-    ] as $statusKey) {
+    foreach (['Pending', 'In Progress', 'Overdue'] as $statusKey) {
       if ($key = CRM_Utils_Array::key($statusKey, $allStatus)) {
         $unpaidStatus[] = $key;
       }
index 58ce4ed313e5772ab09977a7abd997fc69a5f9ee..34f29f2d385a3aeac11462e8ee1f20d9a70069a8 100644 (file)
@@ -190,10 +190,7 @@ class CRM_Report_Utils_Get {
    */
   public static function processChart(&$defaults) {
     $chartType = $_GET["charts"] ?? NULL;
-    if (in_array($chartType, [
-      'barChart',
-      'pieChart',
-    ])) {
+    if (in_array($chartType, ['barChart', 'pieChart'])) {
       $defaults["charts"] = $chartType;
     }
   }
index 782abef8463e981af47f3fd0d9c5fad3ac508d5b..897ea179c46a33344739f79fbb4009790483124b 100644 (file)
@@ -170,12 +170,7 @@ class CRM_SMS_Form_Group extends CRM_Contact_Form_Task {
 
     $groups = [];
 
-    foreach ([
-      'name',
-      'group_id',
-      'is_sms',
-      'sms_provider_id',
-    ] as $n) {
+    foreach (['name', 'group_id', 'is_sms', 'sms_provider_id'] as $n) {
       if (!empty($values[$n])) {
         $params[$n] = $values[$n];
         if ($n == 'sms_provider_id') {
@@ -237,10 +232,7 @@ class CRM_SMS_Form_Group extends CRM_Contact_Form_Task {
       $mailingTableName = CRM_Mailing_BAO_Mailing::getTableName();
 
       // delete previous includes/excludes, if mailing already existed
-      foreach ([
-        'groups',
-        'mailings',
-      ] as $entity) {
+      foreach (['groups', 'mailings'] as $entity) {
         $mg = new CRM_Mailing_DAO_MailingGroup();
         $mg->mailing_id = $ids['mailing_id'];
         $mg->entity_table = ($entity == 'groups') ? $groupTableName : $mailingTableName;
index 053e61c13a26e70b620293d71cda15fe6c8e1429..04a6a0ae3a60c195abf04d94c92396faf97ab2e2 100644 (file)
@@ -578,12 +578,7 @@ class CRM_UF_Form_Field extends CRM_Core_Form {
    *   List of errors to be posted back to the form.
    */
   public static function formRuleSubType($fieldType, $groupType, &$errors) {
-    if (in_array($fieldType, [
-      'Participant',
-      'Contribution',
-      'Membership',
-      'Activity',
-    ])) {
+    if (in_array($fieldType, ['Participant', 'Contribution', 'Membership', 'Activity'])) {
       $individualSubTypes = CRM_Contact_BAO_ContactType::subTypes('Individual');
       foreach ($groupType as $value) {
         if (!in_array($value, $individualSubTypes) &&
@@ -744,12 +739,7 @@ class CRM_UF_Form_Field extends CRM_Core_Form {
       $errors['field_name'] = ts('Please select a field name');
     }
 
-    if ($in_selector && in_array($entityName, [
-      'Contribution',
-      'Participant',
-      'Membership',
-      'Activity',
-    ])
+    if ($in_selector && in_array($entityName, ['Contribution', 'Participant', 'Membership', 'Activity'])
     ) {
       $errors['in_selector'] = ts("'Results Column' cannot be checked for %1 fields.", [1 => $entityName]);
     }
@@ -979,10 +969,8 @@ class CRM_UF_Form_Field extends CRM_Core_Form {
   protected function setMessageIfCountryNotAboveState($fieldName, $locationTypeID, $weight, $ufGroupID) {
     $message = ts('For best results, the Country field should precede the State-Province field in your Profile form. You can use the up and down arrows on field listing page for this profile to change the order of these fields or manually edit weight for Country/State-Province Field.');
 
-    if (in_array($fieldName, [
-      'country',
-      'state_province',
-    ]) && count(CRM_Core_Config::singleton()->countryLimit) > 1
+    if (in_array($fieldName, ['country', 'state_province']) &&
+      count(CRM_Core_Config::singleton()->countryLimit) > 1
     ) {
       // get state or country field weight if exists
       $ufFieldDAO = new CRM_Core_DAO_UFField();
index ff74cf8fbfdfe6564921801b0597874e17989e43..516f1d9211d73b9a3978123281e17da29e126cc5 100644 (file)
@@ -196,11 +196,7 @@ class CRM_Utils_Chart {
     $chartData['yname'] = $rows['yname'] ?? NULL;
 
     // carry some chart params if pass.
-    foreach ([
-      'xSize',
-      'ySize',
-      'divName',
-    ] as $f) {
+    foreach (['xSize', 'ySize', 'divName'] as $f) {
       if (!empty($rows[$f])) {
         $chartData[$f] = $rows[$f];
       }
@@ -236,11 +232,7 @@ class CRM_Utils_Chart {
     }
 
     // carry some chart params if pass.
-    foreach ([
-      'xSize',
-      'ySize',
-      'divName',
-    ] as $f) {
+    foreach (['xSize', 'ySize', 'divName'] as $f) {
       if (!empty($rows[$f])) {
         $chartData[$f] = $rows[$f];
       }
index 9e241bcfe833a43dba6f07784800bc2b045c004c..05088221607843de17854d00df770bb3da99a067 100644 (file)
@@ -1135,11 +1135,7 @@ class CRM_Utils_Token {
         }
 
         // special case for greeting replacement
-        foreach ([
-          'email_greeting',
-          'postal_greeting',
-          'addressee',
-        ] as $val) {
+        foreach (['email_greeting', 'postal_greeting', 'addressee'] as $val) {
           if (!empty($contactDetails[$contactID][$val])) {
             $contactDetails[$contactID][$val] = $contactDetails[$contactID]["{$val}_display"];
           }
@@ -1258,11 +1254,7 @@ class CRM_Utils_Token {
   public static function flattenTokens(&$tokens) {
     $flattenTokens = [];
 
-    foreach ([
-      'html',
-      'text',
-      'subject',
-    ] as $prop) {
+    foreach (['html', 'text', 'subject'] as $prop) {
       if (!isset($tokens[$prop])) {
         continue;
       }
index 0c4f19e5b93ebda50d9c21da3c59b0f765dc535f..617d6f5a38831e29ad37881ec1dcab5187fe4080 100644 (file)
@@ -265,11 +265,7 @@ function civicrm_api3_activity_get($params) {
 function _civicrm_activity_get_handleSourceContactNameOrderBy(&$params, &$options, $sql) {
   $sourceContactID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Source');
   if (!empty($options['sort'])
-    && in_array($options['sort'], [
-      'source_contact_name',
-      'source_contact_name desc',
-      'source_contact_name asc',
-    ])) {
+    && in_array($options['sort'], ['source_contact_name', 'source_contact_name desc', 'source_contact_name asc'])) {
     $order = substr($options['sort'], -4) === 'desc' ? 'desc' : 'asc';
     $sql->join(
       'source_contact',
index 7ae2774f42e6cdb10b71ead41a9cc80547d872b2..531f662cfe979c995c6cef0b6a18bf6ab760fae7 100644 (file)
@@ -49,10 +49,7 @@ class SimpleFilterTest extends \CiviUnitTestCase {
     SimpleFilter::byValue($e, 'text', function ($value, $t, $e) use ($test) {
       $test->assertInstanceOf('Civi\FlexMailer\FlexMailerTask', $t);
       $test->assertInstanceOf('Civi\FlexMailer\Event\ComposeBatchEvent', $e);
-      $test->assertTrue(in_array($value, [
-        'eat more cheese',
-        'eat more ice cream',
-      ]));
+      $test->assertTrue(in_array($value, ['eat more cheese', 'eat more ice cream']));
       return preg_replace('/more/', 'thoughtfully considered quantities of', $value);
     });
 
index e23b4d5cf7d5e094cd0d6ad65bc9427462cc53c8..589efdc3b9a7ed3d24703a5fb163af3cee192c39 100644 (file)
@@ -63,11 +63,7 @@ class CRM_Contact_Form_Search_Custom_PriceSet extends CRM_Contact_Form_Search_Cu
 ';
 
     foreach ($this->_columns as $fieldName) {
-      if (in_array($fieldName, [
-        'contact_id',
-        'participant_id',
-        'display_name',
-      ])) {
+      if (in_array($fieldName, ['contact_id', 'participant_id', 'display_name'])) {
         continue;
       }
       $sql .= "{$fieldName} int default 0,\n";
@@ -259,10 +255,7 @@ contact_a.id             as contact_id  ,
 contact_a.display_name   as display_name";
 
       foreach ($this->_columns as $dontCare => $fieldName) {
-        if (in_array($fieldName, [
-          'contact_id',
-          'display_name',
-        ])) {
+        if (in_array($fieldName, ['contact_id', 'display_name'])) {
           continue;
         }
         $selectClause .= ",\ntempTable.{$fieldName} as {$fieldName}";
index 40c1bc280c105892443cc8cd95553778bc14563c..2e187db31d9b89c4382351c8a20624e339948927 100644 (file)
@@ -1380,10 +1380,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
               $entity[$fieldName] = strtolower($entity[$fieldName]);
             }
             // typecast with array to satisfy changes made in CRM-13160
-            if ($entityName == 'MembershipType' && in_array($fieldName, [
-              'relationship_type_id',
-              'relationship_direction',
-            ])) {
+            if ($entityName == 'MembershipType' && in_array($fieldName, ['relationship_type_id', 'relationship_direction'])) {
               $entity[$fieldName] = (array) $entity[$fieldName];
             }
           }