X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FSort.php;h=cef2fdcb717a4f5031c95c995865fa030fa19fcb;hb=ac439a0617d2a9d7bf661b615928a6f50c3ad5a9;hp=4de46591e393cd99a538ccea3a01ce87898966ff;hpb=7481d51b832ba89932216bcc67bedbc17d7fc651;p=civicrm-core.git diff --git a/CRM/Utils/Sort.php b/CRM/Utils/Sort.php index 4de46591e3..cef2fdcb71 100644 --- a/CRM/Utils/Sort.php +++ b/CRM/Utils/Sort.php @@ -1,27 +1,11 @@ _vars = array(); - $this->_response = array(); + $this->_vars = []; + $this->_response = []; foreach ($vars as $weight => $value) { - $this->_vars[$weight] = array( + $this->_vars[$weight] = [ 'name' => CRM_Utils_Type::validate($value['sort'], 'MysqlColumnNameOrAlias'), 'direction' => CRM_Utils_Array::value('direction', $value), 'title' => $value['name'], - ); + ]; } $this->_currentSortID = 1; @@ -219,12 +203,12 @@ class CRM_Utils_Sort { public function initialize($defaultSortOrder) { $this->initSortID($defaultSortOrder); - $this->_response = array(); + $this->_response = []; $current = $this->_currentSortID; foreach ($this->_vars as $index => $item) { $name = $item['name']; - $this->_response[$name] = array(); + $this->_response[$name] = []; $newDirection = ($item['direction'] == self::ASCENDING) ? self::DESCENDING : self::ASCENDING; @@ -274,7 +258,7 @@ class CRM_Utils_Sort { * (-1 or 1) */ public static function cmpFunc($a, $b) { - $cmp_order = array('weight', 'id', 'title', 'name'); + $cmp_order = ['weight', 'id', 'title', 'name']; foreach ($cmp_order as $attribute) { if (isset($a[$attribute]) && isset($b[$attribute])) { if ($a[$attribute] < $b[$attribute]) {