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

            $menuInfo = $this->menuInfoCollection[$name];
            $service = $menuInfo['id'];
            $method = isset($menuInfo['method']) ? $menuInfo['method'] : 'getMenu';
            $menu = $this->container->get($service)->$method($this->factory, $this->helper);

            $event = new ConfigureMenuEvent($menu, $this->factory, $this->helper, $name);
            $this->container->get('event_dispatcher')->dispatch('imatic_view.configure_menu.' . $name, $event);

            $this->menuCollection[$name] = $menu;
        }

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

            $menuInfo = $this->menuInfoCollection[$name];
            $service = $menuInfo['id'];
            $method = isset($menuInfo['method']) ? $menuInfo['method'] : 'getMenu';
            $menu = $this->container->get($service)->$method($this->factory, $this->helper);

            $event = new ConfigureMenuEvent($menu, $this->factory, $this->helper, $name);
            $this->container->get('event_dispatcher')->dispatch('imatic_view.configure_menu.' . $name, $event);

            $this->menuCollection[$name] = $menu;
        }

        return $this->menuCollection[$name];
    }
public function get ( $ name , array $ options = [ ] ) { if ( ! isset ( $ this -> menuCollection [ $ name ] ) ) { if ( ! isset ( $ this -> menuInfoCollection [ $ name ] ) ) { throw new \ InvalidArgumentException ( \ sprintf ( 'The menu "%s" is not defined.' , $ name ) ) ; } $ menuInfo = $ this -> menuInfoCollection [ $ name ] ; $ service = $ menuInfo [ 'id' ] ; $ method = isset ( $ menuInfo [ 'method' ] ) ? $ menuInfo [ 'method' ] : 'getMenu' ; $ menu = $ this -> container -> get ( $ service ) -> $ method ( $ this -> factory , $ this -> helper ) ; $ event = new ConfigureMenuEvent ( $ menu , $ this -> factory , $ this -> helper , $ name ) ; $ this -> container -> get ( 'event_dispatcher' ) -> dispatch ( 'imatic_view.configure_menu.' . $ name , $ event ) ; $ this -> menuCollection [ $ name ] = $ menu ; } return $ this -> menuCollection [ $ name ] ; }
Retrieves a menu by its name.

@param string $name
@param array  $options

@return ItemInterface

@throws \InvalidArgumentException if the menu does not exists
Retrieves a menu by its name .