GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — user-entity ( a5fdbe...6d5c03 )
by Luis Ramón
02:54
created

HeadDepartmentMenu::updateMenu()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 21
Code Lines 14

Duplication

Lines 21
Ratio 100 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 21
loc 21
rs 9.3142
cc 2
eloc 14
nc 2
nop 1
1
<?php
2
/*
3
  ÁTICA - Aplicación web para la gestión documental de centros educativos
4
5
  Copyright (C) 2015-2016: Luis Ramón López López
6
7
  This program is free software: you can redistribute it and/or modify
8
  it under the terms of the GNU Affero General Public License as published by
9
  the Free Software Foundation, either version 3 of the License, or
10
  (at your option) any later version.
11
12
  This program is distributed in the hope that it will be useful,
13
  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
  GNU Affero General Public License for more details.
16
17
  You should have received a copy of the GNU Affero General Public License
18
  along with this program.  If not, see [http://www.gnu.org/licenses/].
19
*/
20
21
namespace AppBundle\Service;
22
23
use AppBundle\Menu\MenuItem;
24
use Symfony\Component\Security\Core\Authorization\AuthorizationChecker;
25
26 View Code Duplication
class HeadDepartmentMenu implements MenuBuilderInterface
0 ignored issues
show
Duplication introduced by
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...
27
{
28
    private $authorizationChecker;
29
30
    public function __construct(AuthorizationChecker $authorizationChecker)
31
    {
32
        $this->authorizationChecker = $authorizationChecker;
33
    }
34
35
    public function updateMenu(&$menu)
36
    {
37
        $isHeadOfDepartment = $this->authorizationChecker->isGranted("ROLE_DEPARTMENT_HEAD");
38
39
        if (!$isHeadOfDepartment) {
40
            return null;
41
        }
42
43
        $mainItem = reset($menu);
44
        
45
        $item = new MenuItem();
46
        $item
47
            ->setName('companies')
48
            ->setRouteName('company_index')
49
            ->setCaption('menu.companies')
50
            ->setDescription('menu.companies.detail')
51
            ->setColor('dark-cyan')
52
            ->setIcon('building');
53
54
        $mainItem->addChild($item);
55
    }
56
57
    public function getMenuPriority()
58
    {
59
        return '0100-FCT-Admin';
60
    }
61
}
62