Merge pull request #14101 from civicrm/5.13
[civicrm-core.git] / CRM / Core / Region.php
index 77b3e6065b2a65083aba5e715914d7f7ad606062..a9f9e13b71ae571c8a5247a10b637bbedc665767 100644 (file)
@@ -26,21 +26,21 @@ class CRM_Core_Region {
    *
    * @var string
    */
-  var $_name;
+  public $_name;
 
   /**
    * List of snippets to inject within region
    *
    * @var array; e.g. $this->_snippets[3]['type'] = 'template';
    */
-  var $_snippets;
+  public $_snippets;
 
   /**
    * Whether the snippets array has been sorted
    *
    * @var boolean
    */
-  var $_isSorted;
+  public $_isSorted;
 
   /**
    * @param string $name
@@ -51,15 +51,15 @@ class CRM_Core_Region {
     civicrm_smarty_register_string_resource();
 
     $this->_name = $name;
-    $this->_snippets = array();
+    $this->_snippets = [];
 
     // Placeholder which represents any of the default content generated by the main Smarty template
-    $this->add(array(
+    $this->add([
       'name' => 'default',
       'type' => 'markup',
       'markup' => '',
       'weight' => 0,
-    ));
+    ]);
     $this->_isSorted = TRUE;
   }
 
@@ -103,12 +103,12 @@ class CRM_Core_Region {
    * @return array
    */
   public function add($snippet) {
-    static $types = array('markup', 'template', 'callback', 'scriptUrl', 'script', 'jquery', 'style', 'styleUrl');
-    $defaults = array(
+    static $types = ['markup', 'template', 'callback', 'scriptUrl', 'script', 'jquery', 'style', 'styleUrl'];
+    $defaults = [
       'region' => $this->_name,
       'weight' => 1,
       'disabled' => FALSE,
-    );
+    ];
     $snippet += $defaults;
     if (!isset($snippet['type'])) {
       foreach ($types as $type) {
@@ -166,7 +166,7 @@ class CRM_Core_Region {
     $cms = CRM_Core_Config::singleton()->userSystem;
 
     if (!$this->_isSorted) {
-      uasort($this->_snippets, array('CRM_Core_Region', '_cmpSnippet'));
+      uasort($this->_snippets, ['CRM_Core_Region', '_cmpSnippet']);
       $this->_isSorted = TRUE;
     }
 
@@ -223,7 +223,7 @@ class CRM_Core_Region {
         default:
           require_once 'CRM/Core/Error.php';
           CRM_Core_Error::fatal(ts('Snippet type %1 is unrecognized',
-            array(1 => $snippet['type'])));
+            [1 => $snippet['type']]));
       }
     }
     return $html;