Skip to content

Commit

Permalink
Tweaked previous merge
Browse files Browse the repository at this point in the history
  • Loading branch information
stof committed Sep 16, 2013
1 parent 0f6a4cd commit 52c8ffd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Knp/Menu/MenuFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MenuFactory implements FactoryInterface
/**
* @var ExtensionInterface[]
*/
private $sorted = array();
private $sorted;

public function __construct()
{
Expand Down Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 52c8ffd

Please sign in to comment.