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 ( 25b080...c43051 )
by Matthew
02:10
created

StdEnv::newline()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Sphpeme\Env;
4
5
6
class StdEnv implements EnvInterface
7
{
8
    use MappedEnvTrait;
9
10
    const MAPPING = [
11
        '#' => '+',
12
        '+' => 'add',
13
        '-' => 'subtract',
14
        '*' => 'multiply',
15
        '/' => 'divide',
16
        '>' => 'gt',
17
        '<' => 'lt',
18
        '<=' => 'lte',
19
        '>=' => 'gte',
20
        'eq?' => 'isEqual',
21
        'eqv?' => 'isEquiv',
22
        'list' => '_list'
23
    ];
24
25
    public $pi = M_PI;
26
27 1
    public function _list(...$args)
28
    {
29 1
        return $args;
30
    }
31
32 1
    public function car(array $list)
33
    {
34 1
        return current($list);
35
    }
36
37 1
    public function cdr(array $list)
38
    {
39 1
        return \array_slice($list, 1);
40
    }
41
42 1
    public function display($arg)
43
    {
44 1
        if (is_scalar($arg) || method_exists($arg, '__toString')) {
45 1
            echo $arg;
46
        } else {
47 1
            var_export($arg);
48
        }
49 1
    }
50
51 1
    public function newline()
52
    {
53 1
        echo PHP_EOL;
54 1
    }
55
56 2
    public function add($first, ...$rest)
57
    {
58 2
        return $first + (\count($rest) > 1
59 2
                ? $this->add(...$rest)
60 2
                : current($rest));
61
    }
62
63 1
    public function subtract($first, ...$rest)
64
    {
65 1
        return $first - (\count($rest) > 1
66 1
                ? $this->add(...$rest)
67 1
                : current($rest));
68
    }
69
70 1
    public function multiply($first, ...$rest)
71
    {
72 1
        return $first * (\count($rest) > 1
73 1
                ? $this->multiply(...$rest)
74 1
                : current($rest));
75
    }
76
77 1
    public function divide($a, $b)
78
    {
79 1
        return $a / $b;
80
    }
81
82 1
    public function gt($a, $b)
83
    {
84 1
        return $a > $b;
85
    }
86
87 1
    public function lt($a, $b)
88
    {
89 1
        return $a < $b;
90
    }
91
92 1
    public function gte($a, $b)
93
    {
94 1
        return $a >= $b;
95
    }
96
97 1
    public function lte($a, $b)
98
    {
99 1
        return $a <= $b;
100
    }
101
102 1
    public function isEqual($a, $b)
103
    {
104 1
        return $a == $b;
105
    }
106
107 1
    public function isEquiv($a, $b)
108
    {
109 1
        return $a === $b;
110
    }
111
}