jqh 5 years ago
parent
commit
26ad5fee25
1 changed files with 8 additions and 16 deletions
  1. 8 16
      src/Layout/SectionManager.php

+ 8 - 16
src/Layout/SectionManager.php

@@ -18,11 +18,6 @@ class SectionManager
      */
     protected $sections = [];
 
-    /**
-     * @var array
-     */
-    protected $sortedSections = [];
-
     /**
      * @var array
      */
@@ -118,9 +113,7 @@ class SectionManager
      */
     public function getSections($name)
     {
-        $this->sortSections($name);
-
-        return $this->sortedSections[$name];
+        return $this->sortSections($name);
     }
 
     /**
@@ -131,15 +124,14 @@ class SectionManager
      */
     protected function sortSections($name)
     {
-        $this->sortedSections[$name] = [];
-
-        if (! empty($this->sections[$name])) {
-            krsort($this->sections[$name]);
-
-            $this->sortedSections[$name] = call_user_func_array(
-                'array_merge', $this->sections[$name]
-            );
+        if (empty($this->sections[$name])) {
+            return [];
         }
+        krsort($this->sections[$name]);
+
+        return call_user_func_array(
+            'array_merge', $this->sections[$name]
+        );
     }
 
     /**