src/Factory/MenuFactory.php
public function create(string $name, array $configuration): Menu
    {
        $resolver = new OptionsResolver();
        $menuConfiguration = new MenuConfiguration($name, $this->applicationConfiguration->getParameter('title'));
        $menuConfiguration->configureOptions($resolver);

        $menuConfiguration->setParameters($resolver->resolve($configuration));
        $menu = new Menu($name, $menuConfiguration);

        foreach ($menuConfiguration->getParameter('items') as $itemName => $item) {
            $menu->addItem($this->createMenuItem($itemName, $item, $menuConfiguration));
        }
        $this->menus[$name] = $menu;

        return $menu;
    }
public function create(string $name, array $configuration): Menu
    {
        $resolver = new OptionsResolver();
        $menuConfiguration = new MenuConfiguration($name, $this->applicationConfiguration->getParameter('title'));
        $menuConfiguration->configureOptions($resolver);

        $menuConfiguration->setParameters($resolver->resolve($configuration));
        $menu = new Menu($name, $menuConfiguration);

        foreach ($menuConfiguration->getParameter('items') as $itemName => $item) {
            $menu->addItem($this->createMenuItem($itemName, $item, $menuConfiguration));
        }
        $this->menus[$name] = $menu;

        return $menu;
    }
public function create ( string $ name , array $ configuration ) : Menu { $ resolver = new OptionsResolver ( ) ; $ menuConfiguration = new MenuConfiguration ( $ name , $ this -> applicationConfiguration -> getParameter ( 'title' ) ) ; $ menuConfiguration -> configureOptions ( $ resolver ) ; $ menuConfiguration -> setParameters ( $ resolver -> resolve ( $ configuration ) ) ; $ menu = new Menu ( $ name , $ menuConfiguration ) ; foreach ( $ menuConfiguration -> getParameter ( 'items' ) as $ itemName => $ item ) { $ menu -> addItem ( $ this -> createMenuItem ( $ itemName , $ item , $ menuConfiguration ) ) ; } $ this -> menus [ $ name ] = $ menu ; return $ menu ; }
Create a menu item from a configuration array.

@param string $name
@param array  $configuration

@return Menu
Create a menu item from a configuration array .