Passed
Push — master ( 83f908...f1eef1 )
by Václav
02:52 queued 01:28
created

ConfigMenu::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
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 \Nette\Application\UI\Control
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 render() : void
39
    {
40
        $this->beforeRender();
41
        $this->template->setFile(__DIR__ . '/ConfigMenu.latte');
0 ignored issues
show
Bug introduced by
The method setFile() does not exist on stdClass. ( Ignorable by Annotation )

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

41
        $this->template->/** @scrutinizer ignore-call */ 
42
                         setFile(__DIR__ . '/ConfigMenu.latte');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
42
        $this->template->render();
0 ignored issues
show
Bug introduced by
The method render() does not exist on stdClass. ( Ignorable by Annotation )

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

42
        $this->template->/** @scrutinizer ignore-call */ 
43
                         render();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
43
    }
44
45
    public function hasAccess(string $resource) : bool
46
    {
47
        return $this->authorizator->isAllowed($resource);
48
    }
49
}
50