registry = $registry; $this->menuIds = $menuIds; } public function get($name, array $options = []) { if (!isset($this->menuIds[$name])) { throw new \InvalidArgumentException(\sprintf('The menu "%s" is not defined.', $name)); } $menu = $this->registry[$this->menuIds[$name]]; if (\is_callable($menu)) { $menu = \call_user_func($menu, $options, $this->registry); } return $menu; } public function has($name, array $options = []) { return isset($this->menuIds[$name]); } }