From 52c8ffd7eba8028f93ef9eece98f74b2f11c1c1f Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 16 Sep 2013 11:46:19 +0200 Subject: [PATCH] Tweaked previous merge --- src/Knp/Menu/MenuFactory.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Knp/Menu/MenuFactory.php b/src/Knp/Menu/MenuFactory.php index 5f483c5c..87ad0eec 100644 --- a/src/Knp/Menu/MenuFactory.php +++ b/src/Knp/Menu/MenuFactory.php @@ -20,7 +20,7 @@ class MenuFactory implements FactoryInterface /** * @var ExtensionInterface[] */ - private $sorted = array(); + private $sorted; public function __construct() { @@ -66,7 +66,7 @@ public function createItem($name, array $options = array()) public function addExtension(ExtensionInterface $extension, $priority = 0) { $this->extensions[$priority][] = $extension; - $this->sorted = array(); + $this->sorted = null; } /** @@ -128,9 +128,9 @@ public function createFromArray(array $data) */ private function getExtensions() { - if (0 === count($this->sorted)) { + if (null === $this->sorted) { krsort($this->extensions); - $this->sorted = call_user_func_array('array_merge', $this->extensions); + $this->sorted = !empty($this->extensions) ? call_user_func_array('array_merge', $this->extensions) : array(); } return $this->sorted;