SystemMenuBuilder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 26
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A systemMenu() 0 39 2
1
<?php
2
3
namespace App\Menu;
4
5
use Knp\Menu\ItemInterface;
6
7
class SystemMenuBuilder extends AbstractMenuBuilder {
8
    public function systemMenu(array $options): ItemInterface {
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

8
    public function systemMenu(/** @scrutinizer ignore-unused */ array $options): ItemInterface {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
9
        $root = $this->factory->createItem('root')
10
            ->setChildrenAttributes([
11
                'class' => 'navbar-nav float-lg-right'
12
            ]);
13
14
        $menu = $root->addChild('system', [
15
            'label' => ''
16
        ])
17
            ->setExtra('icon', 'fa fa-tools')
18
            ->setExtra('menu', 'system')
19
            ->setExtra('menu-container', '#submenu')
20
            ->setExtra('pull-right', true)
21
            ->setAttribute('title', $this->translator->trans('system.label'));
22
23
        if($this->authorizationChecker->isGranted('ROLE_SUPER_ADMIN')) {
24
            $menu->addChild('cron.label', [
25
                'route' => 'admin_cronjobs'
26
            ])
27
                ->setExtra('icon', 'fas fa-history');
28
29
            $menu->addChild('logs.label', [
30
                'route' => 'admin_logs'
31
            ])
32
                ->setExtra('icon', 'fas fa-clipboard-list');
33
34
            $menu->addChild('messenger.label', [
35
                'route' => 'admin_messenger'
36
            ])
37
                ->setExtra('icon', 'fas fa-envelope-open-text');
38
39
            $menu->addChild('audit.label', [
40
                'uri' => '/admin/audit'
41
            ])
42
                ->setLinkAttribute('target', '_blank')
43
                ->setExtra('icon', 'far fa-eye');
44
        }
45
46
        return $root;
47
    }
48
}