Issues (3)

src/ConfigMenu.php (3 issues)

Labels
Severity
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
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)
26
    {   
27
        $this->menu = $menu;
28
        $this->authorizator = $container->getService('authorizator');
29
    }
30
31
    protected function beforeRender() : void
32
    {
33
        $this->template->menu = $this->menu;
34
    }
35
    
36
    public function render() : void
37
    {
38
        $this->beforeRender();
39
        $this->template->setFile(__DIR__ . '/ConfigMenu.latte');
0 ignored issues
show
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

39
        $this->template->/** @scrutinizer ignore-call */ 
40
                         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...
40
        $this->template->render();
0 ignored issues
show
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

40
        $this->template->/** @scrutinizer ignore-call */ 
41
                         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...
41
    }
42
43
    public function hasAccess(string $resource) : bool
44
    {
45
        return $this->authorizator->isAllowed($resource);
46
    }
47
}
48