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.

DefineExpHandler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 32
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 4
lcom 2
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A evaluate() 0 15 2
A handles() 0 4 1
1
<?php
2
3
namespace Sphpeme\ExpHandler;
4
5
6
7
use Sphpeme\Env;
8
use Sphpeme\Evaluator;
9
use Sphpeme\Symbol;
10
11
class DefineExpHandler implements ExpHandler
12
{
13
    private $defineSymbol;
14
    private $lambdaSymbol;
15
16 3
    public function __construct()
17
    {
18 3
        $this->defineSymbol = Symbol::make('define');
19 3
        $this->lambdaSymbol = Symbol::make('lambda');
20 3
    }
21
22 2
    public function evaluate($exp, Env\EnvInterface $env, Evaluator $evaluate)
23
    {
24 2
        $symbol = $exp[1];
25
26 2
        if (\is_array($symbol)) {
27 1
            $args = \array_slice($symbol, 1);
28 1
            $symbol = $symbol[0];
29 1
            $define = array_merge(
30 1
                [$this->lambdaSymbol, $args], \array_slice($exp, 2));
31
        } else {
32 1
            $define = $exp[2];
33
        }
34
35 2
        $env->$symbol = $evaluate($define, $env);
36 2
    }
37
38 1
    public function handles($exp): bool
39
    {
40 1
        return $exp[0] === $this->defineSymbol;
41
    }
42
}