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 — master ( 276aa4...81ad79 )
by Matthew
13s
created

Evaluator::__invoke()   A

Complexity

Conditions 4
Paths 5

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 8
nc 5
nop 2
dl 0
loc 15
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
namespace Sphpeme;
4
5
6
class Evaluator
7
{
8
    /**
9
     * @var ExpHandler[]
10
     */
11
    private $handlers;
12
13
    public function __construct(ExpHandler ...$handlers)
14
    {
15
        if (\count($handlers) === 0) {
16
            $handlers = [
17
                new SymbolHandler(),
18
                new ScalarHandler(),
19
            ];
20
        }
21
        $this->handlers = $handlers;
22
    }
23
24
    public function __invoke($exp, Env $env)
25
    {
26
        foreach ($this->handlers as $handler) {
27
            if ($handler->handles($exp)) {
28
                return $handler->evaluate($exp, $env, $this);
29
            }
30
        }
31
32
        $call = $this($exp[0], $env);
33
        $args = [];
34
        foreach (\array_slice($exp, 1) as $arg) {
35
            $args[] = $this($arg, $env);
36
        }
37
38
        return $call(...$args);
39
    }
40
}