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
Push — master ( d9bb99...49fd78 )
by Matthew
01:35
created

LambdaExpHandler::evaluate()   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 3
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Sphpeme\ExpHandler;
4
5
6
use Sphpeme\Env;
7
use function Sphpeme\env_extend;
0 ignored issues
show
introduced by
The function Sphpeme\env_extend was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
8
use Sphpeme\Evaluator;
9
use Sphpeme\Symbol;
10
11
class LambdaExpHandler implements ExpHandler
12
{
13
    private $lambdaSymbol;
14
15
    public function __construct()
16
    {
17
        $this->lambdaSymbol = Symbol::make('lambda');
18
    }
19
20
    public function evaluate($exp, Env $env, Evaluator $evaluate)
21
    {
22
        [$lambda, $params, $body] = $exp;
23
        return function (...$args) use ($env, $body, $params, $evaluate) {
24
            return $evaluate($body, env_extend($env, array_combine($params, $args)));
25
        };
26
    }
27
28
    public function handles($exp): bool
29
    {
30
        return $exp[0] === $this->lambdaSymbol;
31
    }
32
}