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.
Passed
Pull Request — master (#1)
by Matthew
01:35
created

Evaluator::__invoke()   C

Complexity

Conditions 7
Paths 7

Size

Total Lines 23
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

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