Conditions | 9 |
Paths | 4 |
Total Lines | 24 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 17 |
CRAP Score | 9 |
Changes | 0 |
1 | <?php |
||
8 | 8 | public function run(array $args) |
|
9 | { |
||
10 | 8 | $arg = $args[0]; |
|
11 | 8 | $isList = $arg instanceof ListType; |
|
12 | 8 | if ($isList && !empty($arg->value())) { |
|
13 | 6 | $list = $arg; |
|
14 | 6 | foreach ($list->value() as $index => $element) { |
|
15 | 6 | if ($element->value() == 'unquote') { |
|
16 | 2 | $newValue = $this->eval->getReturn($list->rest()[0]); |
|
|
|||
17 | 2 | $list = $newValue; |
|
18 | } |
||
19 | 6 | else if ($element instanceof ListType && !empty($element->value())) { |
|
20 | 2 | if ($element->first()->value() == 'unquote') { |
|
21 | 1 | $newValue = $this->eval->getReturn($element->rest()[0]); |
|
22 | 6 | $list->set($newValue, $index); |
|
23 | } |
||
24 | } |
||
25 | } |
||
26 | } |
||
27 | 8 | $quote = new Quote(); |
|
28 | 8 | return isset($list) |
|
29 | 6 | ? $quote->run([$list], $this->function, $this->currentEnv, $this->eval) |
|
30 | 8 | : $quote->run($args, $this->function, $this->currentEnv, $this->eval); |
|
31 | } |
||
32 | } |
||
33 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: