<commit_before><?php

namespace Application\Bundle\DefaultBundle\Menu;

use Knp\Menu\FactoryInterface;
use Symfony\Component\HttpFoundation\Request;

/**
 * MenuBuilder Class
 */
class MenuBuilder
{
    /**
     * @var \Knp\Menu\FactoryInterface
     */
    private $factory;

    /**
     * @param \Knp\Menu\FactoryInterface $factory
     */
    public function __construct(FactoryInterface $factory)
    {
        $this->factory = $factory;
    }

    /**
     * Main page top menu
     *
     * @param Request $request
     *
     * @return \Knp\Menu\MenuItem
     */
    public function createMainMenu(Request $request)
    {
        $menu = $this->factory->createItem('root');

        $menu->setCurrentUri($request->getRequestUri());
        $menu->setAttribute('class', 'nav');

        $menu->addChild('О Frameworks Days', array('route' => 'page_show', 'routeParameters' => array('slug' => 'about')));
        $menu->addChild('События', array('route' => 'events'));
        $menu->addChild('Контакты', array('route' => 'page_show', 'routeParameters' => array('slug' => 'contacts')));
        $menu->addChild('Спонсоры и партнеры', array('route' => 'partners_page'));

        return $menu;
    }

    /**
     * Event page top menu
     *
     * @param Request $request
     *
     * @return \Knp\Menu\MenuItem
     */
    public function createEventMainMenu(Request $request)
    {
        $menu = $this->createMainMenu($request);

        $menu->addChild('← На главную', array('route' => 'homepage'))
             ->moveToFirstPosition();

        return $menu;
    }

    /**
     * Event page submenu
     *
     * @param Request                                   $request Request
     * @param \Stfalcon\Bundle\EventBundle\Entity\Event $event   Event
     *
     * @return \Knp\Menu\MenuItem
     */
    public function createEventSubMenu(Request $request, $event)
    {
        $menu = $this->factory->createItem('root');

        $menu->setCurrentUri($request->getRequestUri());

        $menu->addChild("О событии", array('route' => 'event_show', 'routeParameters' => array('event_slug' => $event->getSlug())));

        /** @var $event \Stfalcon\Bundle\EventBundle\Entity\Event */
        if ($event->getSpeakers()) {
            $menu->addChild("Докладчики", array('route' => 'event_speakers', 'routeParameters' => array('event_slug' => $event->getSlug())));
        }

        // ссылки на страницы ивента
        foreach ($event->getPages() as $page) {
            if ($page->isShowInMenu()) {
                $menu->addChild($page->getTitle(), array('route' => 'event_page_show',
                        'routeParameters' => array('event_slug' => $event->getSlug(), 'page_slug' => $page->getSlug())));
            }
        }

        return $menu;
    }
}
<commit_msg>menu Партнеры<commit_after><?php

namespace Application\Bundle\DefaultBundle\Menu;

use Knp\Menu\FactoryInterface;
use Symfony\Component\HttpFoundation\Request;

/**
 * MenuBuilder Class
 */
class MenuBuilder
{
    /**
     * @var \Knp\Menu\FactoryInterface
     */
    private $factory;

    /**
     * @param \Knp\Menu\FactoryInterface $factory
     */
    public function __construct(FactoryInterface $factory)
    {
        $this->factory = $factory;
    }

    /**
     * Main page top menu
     *
     * @param Request $request
     *
     * @return \Knp\Menu\MenuItem
     */
    public function createMainMenu(Request $request)
    {
        $menu = $this->factory->createItem('root');

        $menu->setCurrentUri($request->getRequestUri());
        $menu->setAttribute('class', 'nav');

        $menu->addChild('О Frameworks Days', array('route' => 'page_show', 'routeParameters' => array('slug' => 'about')));
        $menu->addChild('События', array('route' => 'events'));
        $menu->addChild('Контакты', array('route' => 'page_show', 'routeParameters' => array('slug' => 'contacts')));
        $menu->addChild('Партнеры', array('route' => 'partners_page'));

        return $menu;
    }

    /**
     * Event page top menu
     *
     * @param Request $request
     *
     * @return \Knp\Menu\MenuItem
     */
    public function createEventMainMenu(Request $request)
    {
        $menu = $this->createMainMenu($request);

        $menu->addChild('← На главную', array('route' => 'homepage'))
             ->moveToFirstPosition();

        return $menu;
    }

    /**
     * Event page submenu
     *
     * @param Request                                   $request Request
     * @param \Stfalcon\Bundle\EventBundle\Entity\Event $event   Event
     *
     * @return \Knp\Menu\MenuItem
     */
    public function createEventSubMenu(Request $request, $event)
    {
        $menu = $this->factory->createItem('root');

        $menu->setCurrentUri($request->getRequestUri());

        $menu->addChild("О событии", array('route' => 'event_show', 'routeParameters' => array('event_slug' => $event->getSlug())));

        /** @var $event \Stfalcon\Bundle\EventBundle\Entity\Event */
        if ($event->getSpeakers()) {
            $menu->addChild("Докладчики", array('route' => 'event_speakers', 'routeParameters' => array('event_slug' => $event->getSlug())));
        }

        // ссылки на страницы ивента
        foreach ($event->getPages() as $page) {
            if ($page->isShowInMenu()) {
                $menu->addChild($page->getTitle(), array('route' => 'event_page_show',
                        'routeParameters' => array('event_slug' => $event->getSlug(), 'page_slug' => $page->getSlug())));
            }
        }

        return $menu;
    }
}

{'fraction_non_alphanumeric': 0.16986891722032682, 'fraction_numerical': 0.0, 'mean_word_length': 2.459627329192547, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 97, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5709738', 'n_tokens_mistral': 1695, 'n_tokens_neox': 1700, 'n_words': 295}