src/Step/GenerateMenus.php
public function process()
    {
        call_user_func_array($this->phpoole->getMessageCb(), ['MENU', 'Generating menus']);
        $count = 0;
        $this->phpoole->setMenus(new MenusCollection());
        $this->collectPages();

        /*
         * Removing/adding/replacing menus entries from config array
         * ie:
         * ['site' => [
         *     'menu' => [
         *         'main' => [
         *             'test' => [
         *                 'id'     => 'test',
         *                 'name'   => 'Test website',
         *                 'url'    => 'http://test.org',
         *                 'weight' => 999,
         *             ],
         *         ],
         *     ],
         * ]]
         */
        if (!empty($this->phpoole->getConfig()->get('site.menu'))) {
            foreach ($this->phpoole->getConfig()->get('site.menu') as $name => $entry) {
                /* @var $menu \PHPoole\Collection\Menu\Menu */
                $menu = $this->phpoole->getMenus()->get($name);
                foreach ($entry as $property) {
                    // remove disable entries
                    if (isset($property['disabled']) && $property['disabled']) {
                        if (isset($property['id']) && $menu->has($property['id'])) {
                            $menu->remove($property['id']);
                        }
                        continue;
                    }
                    // add new entries
                    $item = (new Entry($property['id']))
                        ->setName($property['name'])
                        ->setUrl($property['url'])
                        ->setWeight($property['weight']);
                    $menu->add($item);
                    $count++;
                }
            }
        }
        if ($count) {
            call_user_func_array($this->phpoole->getMessageCb(), ['MENU_PROGRESS', 'Start generating', 0, $count]);
            call_user_func_array($this->phpoole->getMessageCb(), ['MENU_PROGRESS', 'Menus generated', $count, $count]);
        } else {
            call_user_func_array($this->phpoole->getMessageCb(), ['MENU_PROGRESS', 'No menu']);
        }
    }
public function process()
    {
        call_user_func_array($this->phpoole->getMessageCb(), ['MENU', 'Generating menus']);
        $count = 0;
        $this->phpoole->setMenus(new MenusCollection());
        $this->collectPages();

        /*
         * Removing/adding/replacing menus entries from config array
         * ie:
         * ['site' => [
         *     'menu' => [
         *         'main' => [
         *             'test' => [
         *                 'id'     => 'test',
         *                 'name'   => 'Test website',
         *                 'url'    => 'http://test.org',
         *                 'weight' => 999,
         *             ],
         *         ],
         *     ],
         * ]]
         */
        if (!empty($this->phpoole->getConfig()->get('site.menu'))) {
            foreach ($this->phpoole->getConfig()->get('site.menu') as $name => $entry) {
                /* @var $menu \PHPoole\Collection\Menu\Menu */
                $menu = $this->phpoole->getMenus()->get($name);
                foreach ($entry as $property) {
                    // remove disable entries
                    if (isset($property['disabled']) && $property['disabled']) {
                        if (isset($property['id']) && $menu->has($property['id'])) {
                            $menu->remove($property['id']);
                        }
                        continue;
                    }
                    // add new entries
                    $item = (new Entry($property['id']))
                        ->setName($property['name'])
                        ->setUrl($property['url'])
                        ->setWeight($property['weight']);
                    $menu->add($item);
                    $count++;
                }
            }
        }
        if ($count) {
            call_user_func_array($this->phpoole->getMessageCb(), ['MENU_PROGRESS', 'Start generating', 0, $count]);
            call_user_func_array($this->phpoole->getMessageCb(), ['MENU_PROGRESS', 'Menus generated', $count, $count]);
        } else {
            call_user_func_array($this->phpoole->getMessageCb(), ['MENU_PROGRESS', 'No menu']);
        }
    }
{@inheritdoc}