From cf9ccf98dd6af3c4251df206fbf60b2a508b3c49 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 5 Apr 2019 13:46:10 -0700 Subject: [PATCH] (NFC) Various updates for future version of civicrm/coder --- CRM/Core/BAO/Address.php | 20 ++++---------------- CRM/Core/BAO/CMSUser.php | 2 +- CRM/Core/BAO/Cache.php | 6 ++++-- CRM/Core/BAO/Cache/Psr16.php | 20 +++++++++++++++----- CRM/Core/BAO/CustomGroup.php | 8 +++++--- CRM/Core/BAO/Dashboard.php | 12 +++++------- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index 8b57485017..b5ec97d748 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -360,12 +360,7 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { ); if ($parseStreetAddress && !empty($params['street_address'])) { - foreach ([ - 'street_number', - 'street_name', - 'street_unit', - 'street_number_suffix', - ] as $fld) { + foreach (['street_number', 'street_name', 'street_unit', 'street_number_suffix'] as $fld) { unset($params[$fld]); } // main parse string. @@ -494,12 +489,7 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { while ($address->fetch()) { // deprecate reference. if ($count > 1) { - foreach ([ - 'state', - 'state_name', - 'country', - 'world_region', - ] as $fld) { + foreach (['state', 'state_name', 'country', 'world_region'] as $fld) { if (isset($address->$fld)) { unset($address->$fld); } @@ -733,10 +723,8 @@ ORDER BY civicrm_address.is_primary DESC, civicrm_address.location_type_id DESC, $streetAddress = trim($streetAddress); $matches = []; - if (in_array($locale, [ - 'en_CA', - 'fr_CA', - ]) && preg_match('/^([A-Za-z0-9]+)[ ]*\-[ ]*/', $streetAddress, $matches) + if (in_array($locale, ['en_CA', 'fr_CA']) + && preg_match('/^([A-Za-z0-9]+)[ ]*\-[ ]*/', $streetAddress, $matches) ) { $parseFields['street_unit'] = $matches[1]; // unset from rest of street address diff --git a/CRM/Core/BAO/CMSUser.php b/CRM/Core/BAO/CMSUser.php index 368bcd97de..36bb8bdb6f 100644 --- a/CRM/Core/BAO/CMSUser.php +++ b/CRM/Core/BAO/CMSUser.php @@ -213,7 +213,7 @@ class CRM_Core_BAO_CMSUser { } // now check that the cms db does not have the user name and/or email - if ($isDrupal OR $isJoomla OR $isWordPress) { + if ($isDrupal or $isJoomla or $isWordPress) { $params = [ 'name' => $fields['cms_name'], 'mail' => $fields[$emailName], diff --git a/CRM/Core/BAO/Cache.php b/CRM/Core/BAO/Cache.php index ffdcfa7b31..3347f978d8 100644 --- a/CRM/Core/BAO/Cache.php +++ b/CRM/Core/BAO/Cache.php @@ -45,7 +45,8 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache { * * @var int, number of second */ - const DEFAULT_SESSION_TTL = 172800; // Two days: 2*24*60*60 + // Two days: 2*24*60*60 + const DEFAULT_SESSION_TTL = 172800; /** * @var array ($cacheKey => $cacheValue) @@ -174,7 +175,8 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache { $table = self::getTableName(); $where = self::whereCache($group, $path, $componentID); $dataExists = CRM_Core_DAO::singleValueQuery("SELECT COUNT(*) FROM $table WHERE {$where}"); - $now = date('Y-m-d H:i:s'); // FIXME - Use SQL NOW() or CRM_Utils_Time? + // FIXME - Use SQL NOW() or CRM_Utils_Time? + $now = date('Y-m-d H:i:s'); $dataSerialized = self::encode($data); // This table has a wonky index, so we cannot use REPLACE or diff --git a/CRM/Core/BAO/Cache/Psr16.php b/CRM/Core/BAO/Cache/Psr16.php index 986a4bcbf4..03463d473e 100644 --- a/CRM/Core/BAO/Cache/Psr16.php +++ b/CRM/Core/BAO/Cache/Psr16.php @@ -189,11 +189,21 @@ class CRM_Core_BAO_Cache_Psr16 { 'custom data', // Universe - 'dashboard', // be.chiro.civi.atomfeeds - 'lineitem-editor', // biz.jmaconsulting.lineitemedit - 'HRCore_Info', // civihr/uk.co.compucorp.civicrm.hrcore - 'CiviCRM setting Spec', // nz.co.fuzion.entitysetting - 'descendant groups for an org', // org.civicrm.multisite + + // be.chiro.civi.atomfeeds + 'dashboard', + + // biz.jmaconsulting.lineitemedit + 'lineitem-editor', + + // civihr/uk.co.compucorp.civicrm.hrcore + 'HRCore_Info', + + // nz.co.fuzion.entitysetting + 'CiviCRM setting Spec', + + // org.civicrm.multisite + 'descendant groups for an org', ]; } diff --git a/CRM/Core/BAO/CustomGroup.php b/CRM/Core/BAO/CustomGroup.php index 8fa78cbf7a..01e65fc4ce 100644 --- a/CRM/Core/BAO/CustomGroup.php +++ b/CRM/Core/BAO/CustomGroup.php @@ -303,7 +303,8 @@ class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup { if (self::hasCustomGroup('Activity', NULL, $activityTypeId)) { return TRUE; } - $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE, FALSE); // everything + // everything + $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE, FALSE); $params = [ 'version' => 3, 'extends' => 'Activity', @@ -484,7 +485,7 @@ LEFT JOIN civicrm_custom_field ON (civicrm_custom_field.custom_group_id = civicr foreach ($subTypes as $key => $subType) { $subTypeClauses[] = self::whereListHas("civicrm_custom_group.extends_entity_column_value", self::validateSubTypeByEntity($entityType, $subType)); } - $subTypeClause = '(' . implode(' OR ', $subTypeClauses) . ')'; + $subTypeClause = '(' . implode(' OR ', $subTypeClauses) . ')'; if (!$onlySubType) { $subTypeClause = '(' . $subTypeClause . ' OR civicrm_custom_group.extends_entity_column_value IS NULL )'; } @@ -716,7 +717,8 @@ ORDER BY civicrm_custom_group.weight, * SQL condition. */ static private function whereListHas($column, $value, $delimiter = CRM_Core_DAO::VALUE_SEPARATOR) { - $bareValue = trim($value, $delimiter); // ? + // ? + $bareValue = trim($value, $delimiter); $escapedValue = CRM_Utils_Type::escape("%{$delimiter}{$bareValue}{$delimiter}%", 'String', FALSE); return "($column LIKE \"$escapedValue\")"; } diff --git a/CRM/Core/BAO/Dashboard.php b/CRM/Core/BAO/Dashboard.php index 1bfd6812d2..091348624b 100644 --- a/CRM/Core/BAO/Dashboard.php +++ b/CRM/Core/BAO/Dashboard.php @@ -181,9 +181,9 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard { public static function initializeDashlets() { $dashlets = []; $getDashlets = civicrm_api3("Dashboard", "get", [ - 'domain_id' => CRM_Core_Config::domainID(), - 'option.limit' => 0, - ]); + 'domain_id' => CRM_Core_Config::domainID(), + 'option.limit' => 0, + ]); $contactID = CRM_Core_Session::getLoggedInContactID(); $allDashlets = CRM_Utils_Array::index(['name'], $getDashlets['values']); $defaultDashlets = []; @@ -271,10 +271,8 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard { } // hack to handle case permissions - if (!$componentName && in_array($key, [ - 'access my cases and activities', - 'access all cases and activities', - ]) + if (!$componentName + && in_array($key, ['access my cases and activities', 'access all cases and activities']) ) { $componentName = 'CiviCase'; } -- 2.25.1