| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 1 | public function generateLet($program) |
|
| 29 | { |
||
| 30 | // bindings is an array of pairs: [[param, value], [param, value]] |
||
| 31 | 1 | list($_letStar, $bindings) = $program; |
|
|
|
|||
| 32 | 1 | $body = \array_slice($program, 2); |
|
| 33 | |||
| 34 | 1 | if (\count($bindings) > 1) { |
|
| 35 | 1 | return [$this->letSymbol, [$bindings[0]], |
|
| 36 | 1 | $this->generateLet(array_merge( |
|
| 37 | 1 | [$this->letStarSymbol, \array_slice($bindings, 1)], |
|
| 38 | 1 | $body))]; |
|
| 39 | } |
||
| 40 | |||
| 41 | 1 | return array_merge( |
|
| 42 | 1 | [$this->letSymbol, [$bindings[0]]], |
|
| 43 | 1 | $body); // unpack the body of let into the lambda exp |
|
| 44 | |||
| 45 | } |
||
| 46 | |||
| 51 | } |
This checks looks for assignemnts to variables using the
list(...)function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$aand$care used. There was no need to assign$b.Instead, the list call could have been.