Code Duplication    Length = 11-13 lines in 3 locations

Bundle/BlogBundle/Listener/ArticleMenuListener.php 1 location

@@ 74-86 (lines=13) @@
71
     *
72
     * @return \Knp\Menu\ItemInterface The main item to get
73
     */
74
    private function getMainItem()
75
    {
76
        $menuPage = $this->menuBuilder->getTopNavbar()->getChild('menu.page');
77
78
        if ($menuPage) {
79
            return $menuPage;
80
        } else {
81
            return $this->menuBuilder->createDropdownMenuItem(
82
                $this->menuBuilder->getTopNavbar(),
83
                'menu.page'
84
            );
85
        }
86
    }
87
}
88

Bundle/PageBundle/Listener/PageMenuListener.php 1 location

@@ 86-98 (lines=13) @@
83
     *
84
     * @return \Knp\Menu\ItemInterface <\Knp\Menu\ItemInterface, NULL>|\Knp\Menu\ItemInterface
85
     */
86
    public function getMainItem()
87
    {
88
        $menuPage = $this->menuBuilder->getTopNavbar()->getChild('menu.page');
89
90
        if ($menuPage) {
91
            return $menuPage;
92
        } else {
93
            return $this->menuBuilder->createDropdownMenuItem(
94
                $this->menuBuilder->getTopNavbar(),
95
                'menu.page'
96
            );
97
        }
98
    }
99
}
100

Bundle/TemplateBundle/Listener/TemplateMenuListener.php 1 location

@@ 75-85 (lines=11) @@
72
        ])->setLinkAttribute('data-toggle', 'vic-modal');
73
    }
74
75
    public function getMainItem()
76
    {
77
        if ($menuTemplate = $this->menuBuilder->getTopNavbar()->getChild('menu.template')) {
78
            return $menuTemplate;
79
        } else {
80
            return $this->menuBuilder->createDropdownMenuItem(
81
                $this->menuBuilder->getTopNavbar(),
82
                'menu.template'
83
            );
84
        }
85
    }
86
}
87