| Conditions | 2 |
| Paths | 1 |
| Total Lines | 21 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | 1 | private static function createNode(array $parameters = []): NodeInterface |
|
| 43 | { |
||
| 44 | 1 | $parameters = array_map( |
|
| 45 | /** |
||
| 46 | * @param class-string|callable():(NodeInterface)|mixed $parameter |
||
| 47 | * |
||
| 48 | * @return class-string|mixed |
||
| 49 | */ |
||
| 50 | static function ($parameter) { |
||
| 51 | 1 | if (is_callable($parameter)) { |
|
| 52 | 1 | return $parameter(); |
|
| 53 | } |
||
| 54 | |||
| 55 | 1 | return $parameter; |
|
| 56 | 1 | }, |
|
| 57 | $parameters |
||
| 58 | ); |
||
| 59 | |||
| 60 | 1 | $class = array_shift($parameters); |
|
| 61 | |||
| 62 | 1 | return new $class(...$parameters); |
|
| 63 | } |
||
| 80 |