Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
12 | 43 | public function run(array $args) |
|
13 | { |
||
14 | 43 | $this->expectArguments( |
|
15 | 43 | 'define', |
|
16 | 43 | [0 => ['Symbol']], |
|
17 | 43 | $args |
|
18 | ); |
||
19 | 42 | if (!isset($args[1])) { |
|
20 | 1 | throw new ArgumentException('"define" expects second argument.'); |
|
21 | } |
||
22 | 41 | $value = $this->eval->getReturn($args[1]); |
|
23 | 41 | $this->currentEnv->set($args[0]->value(), $value); |
|
24 | |||
25 | // Update the lambda environment so that it can refer to itself. |
||
26 | 41 | if ($value instanceof LambdaType) { |
|
27 | 5 | $value->updateCreationEnv($this->currentEnv); |
|
28 | } |
||
29 | 41 | return $value; |
|
30 | } |
||
31 | } |
||
32 |