Passed
Push — master ( eca8c1...83f908 )
by Václav
02:30
created

ConfigMenu::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of Nepttune (https://www.peldax.com)
5
 *
6
 * Copyright (c) 2018 Václav Pelíšek ([email protected])
7
 *
8
 * This software consists of voluntary contributions made by many individuals
9
 * and is licensed under the MIT license. For more information, see
10
 * <https://www.peldax.com>.
11
 */
12
13
declare(strict_types = 1);
14
15
namespace Nepttune\Component;
16
17
final class ConfigMenu extends BaseComponent
0 ignored issues
show
Bug introduced by
The type Nepttune\Component\BaseComponent was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
{
19
    /** @var array */
20
    protected $menu;
21
22
    /** @var \Nepttune\Model\Authorizator */
0 ignored issues
show
Bug introduced by
The type Nepttune\Model\Authorizator was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
    protected $authorizator;
24
25
    public function __construct(array $menu, \Nette\DI\Container $container)
0 ignored issues
show
Bug introduced by
The type Nette\DI\Container was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
    {
27
        parent::__construct();
28
        
29
        $this->menu = $menu;
30
        $this->authorizator = $container->getService('authorizator');
31
    }
32
33
    protected function beforeRender() : void
34
    {
35
        $this->template->menu = $this->menu;
36
    }
37
38
    public function hasAccess(string $resource) : bool
39
    {
40
        return $this->authorizator->isAllowed($resource);
41
    }
42
}
43