Code Duplication    Length = 37-38 lines in 2 locations

src/Kunstmaan/TranslatorBundle/Service/Menu/TranslatorMenuAdaptor.php 1 location

@@ 26-62 (lines=37) @@
23
            return;
24
        }
25
26
        if ('KunstmaanAdminBundle_settings' == $parent->getRoute()) {
27
            $menuItem = new MenuItem($menu);
28
            $menuItem
29
                ->setRoute('KunstmaanTranslatorBundle_settings_translations')
30
                ->setLabel('translator.translator.title')
31
                ->setUniqueId('Translations')
32
                ->setParent($parent);
33
            if (stripos($request->attributes->get('_route'), $menuItem->getRoute()) === 0) {
34
                $menuItem->setActive(true);
35
                $parent->setActive(true);
36
            }
37
            $children[] = $menuItem;
38
        } elseif ('KunstmaanTranslatorBundle_settings_translations' == $parent->getRoute()) {
39
            $menuItem = new MenuItem($menu);
40
            $menuItem
41
                ->setRoute('KunstmaanTranslatorBundle_settings_translations_add')
42
                ->setUniqueId('Add translation')
43
                ->setLabel('Add translation')
44
                ->setParent($parent)
45
                ->setAppearInNavigation(false);
46
            if (stripos($request->attributes->get('_route'), $menuItem->getRoute()) === 0) {
47
                $menuItem->setActive(true);
48
            }
49
            $children[] = $menuItem;
50
51
            $menuItem = new MenuItem($menu);
52
            $menuItem
53
                ->setRoute('KunstmaanTranslatorBundle_settings_translations_edit')
54
                ->setUniqueId('Edit translation')
55
                ->setLabel('Edit translation')
56
                ->setParent($parent)
57
                ->setAppearInNavigation(false);
58
            if (stripos($request->attributes->get('_route'), $menuItem->getRoute()) === 0) {
59
                $menuItem->setActive(true);
60
            }
61
            $children[] = $menuItem;
62
        }
63
    }
64
}
65

src/Kunstmaan/UserManagementBundle/Helper/Menu/UserManagementMenuAdaptor.php 1 location

@@ 41-78 (lines=38) @@
38
        }
39
40
        if ('KunstmaanAdminBundle_settings' == $parent->getRoute()) {
41
            if ($this->authorizationChecker->isGranted('ROLE_SUPER_ADMIN')) {
42
                $menuItem = new MenuItem($menu);
43
                $menuItem
44
                    ->setRoute('KunstmaanUserManagementBundle_settings_users')
45
                    ->setUniqueId('Users')
46
                    ->setLabel('settings.users')
47
                    ->setParent($parent);
48
                if (stripos($request->attributes->get('_route'), $menuItem->getRoute()) === 0) {
49
                    $menuItem->setActive(true);
50
                    $parent->setActive(true);
51
                }
52
                $children[] = $menuItem;
53
54
                $menuItem = new MenuItem($menu);
55
                $menuItem
56
                    ->setRoute('KunstmaanUserManagementBundle_settings_groups')
57
                    ->setUniqueId('Groups')
58
                    ->setLabel('settings.groups')
59
                    ->setParent($parent);
60
61
                if (stripos($request->attributes->get('_route'), $menuItem->getRoute()) === 0) {
62
                    $menuItem->setActive(true);
63
                    $parent->setActive(true);
64
                }
65
                $children[] = $menuItem;
66
67
                $menuItem = new MenuItem($menu);
68
                $menuItem
69
                    ->setRoute('KunstmaanUserManagementBundle_settings_roles')
70
                    ->setUniqueId('Roles')
71
                    ->setLabel('settings.roles')
72
                    ->setParent($parent);
73
                if (stripos($request->attributes->get('_route'), $menuItem->getRoute()) === 0) {
74
                    $menuItem->setActive(true);
75
                    $parent->setActive(true);
76
                }
77
                $children[] = $menuItem;
78
            }
79
        } elseif ('KunstmaanUserManagementBundle_settings_users' == $parent->getRoute()) {
80
            if ($this->authorizationChecker->isGranted('ROLE_SUPER_ADMIN')) {
81
                $menuItem = new MenuItem($menu);