| Conditions | 5 |
| Paths | 6 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function __construct(array $choices) |
||
| 15 | { |
||
| 16 | foreach ($choices as [$condition, $element]) { |
||
| 17 | if ($condition) { |
||
| 18 | if (is_callable($element)) { |
||
| 19 | $element = $element(); |
||
| 20 | } |
||
| 21 | if ($element !== null) { |
||
| 22 | $this->children[] = $element; |
||
| 23 | } |
||
| 24 | // The function exits once a condition is matched. |
||
| 25 | return; |
||
| 26 | } |
||
| 30 |