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.

FlawDetector::analyze()   A
last analyzed

Complexity

Conditions 3
Paths 1

Size

Total Lines 23
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 10
nc 1
nop 1
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
1
<?php
2
3
namespace Inspector\Analysis;
4
5
use PhpParser\Node;
6
use Inspector\Application\Bootstrapper;
7
use Inspector\Misc\ParametersInterface;
8
use Inspector\Analysis\Checker\CheckerInterface;
9
10
/**
11
 * Detects and returns all the flaws in a method/function
12
 *
13
 * @author Kabir Baidhya
14
 */
15
class FlawDetector
16
{
17
18
    /**
19
     * @var array
20
     */
21
    protected $config;
22
23
    /**
24
     * @var Bootstrapper
25
     */
26
    protected $bootstrapper;
27
28
    /**
29
     * @param Bootstrapper $bootstrapper
30
     * @param array $config
31
     */
32
    public function __construct(Bootstrapper $bootstrapper, array $config)
33
    {
34
        $this->config = $config;
35
        $this->bootstrapper = $bootstrapper;
36
    }
37
38
    /**
39
     * @param Node[]|null $ast
40
     * @return array
41
     */
42
    public function analyze($ast)
43
    {
44
        $walker = new NodeWalker();
45
46
        $errors = $walker->walk($ast, function ($node) {
47
48
            foreach ($this->checkers() as $class) {
49
50
                /** @var CheckerInterface $checker */
51
                $checker = new $class();
52
53
                if ($checker instanceof ParametersInterface) {
54
                    $checker->setParameters($this->config);
55
                }
56
57
                $this->bootstrapper->bootstrap($checker);
58
59
                $checker->check($node);
60
            }
61
        });
62
63
        return $errors;
64
    }
65
66
    /**
67
     * @return array
68
     */
69
    protected function checkers()
70
    {
71
        return require BASEPATH . 'config/checkers.config.php';
72
    }
73
}
74