Completed
Push — master ( ae5e03...0447ee )
by Jeroen
10:35 queued 04:37
created

MenuAdaptor::adaptChildren()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 16

Duplication

Lines 16
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
dl 16
loc 16
ccs 0
cts 16
cp 0
rs 9.7333
c 0
b 0
f 0
cc 4
nc 3
nop 4
crap 20
1
<?php
2
3
namespace Kunstmaan\LeadGenerationBundle\Service;
4
5
use Kunstmaan\AdminBundle\Helper\Menu\MenuAdaptorInterface;
6
use Kunstmaan\AdminBundle\Helper\Menu\MenuBuilder;
7
use Kunstmaan\AdminBundle\Helper\Menu\MenuItem;
8
use Kunstmaan\AdminBundle\Helper\Menu\TopMenuItem;
9
use Symfony\Component\HttpFoundation\Request;
10
11 View Code Duplication
class MenuAdaptor implements MenuAdaptorInterface
0 ignored issues
show
Duplication introduced by Kristof Jochmans
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    public function adaptChildren(MenuBuilder $menu, array &$children, MenuItem $parent = null, Request $request = null)
14
    {
15
        if (!\is_null($parent) && 'KunstmaanAdminBundle_modules' == $parent->getRoute()) {
16
            $menuItem = new TopMenuItem($menu);
17
            $menuItem
18
                ->setRoute('kunstmaanleadgenerationbundle_admin_popup_abstractpopup')
19
                ->setUniqueId('popup')
20
                ->setLabel('Popups')
21
                ->setParent($parent);
22
            if ($request->attributes->get('_route') === 'kunstmaanleadgenerationbundle_admin_popup_abstractpopup') {
23
                $menuItem->setActive(true);
24
                $parent->setActive(true);
25
            }
26
            $children[] = $menuItem;
27
        }
28
    }
29
}
30