| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 1 | public static function create(iterable $nodes): ?NodeInterface |
|
| 19 | { |
||
| 20 | 1 | $root = null; |
|
| 21 | |||
| 22 | 1 | foreach ($nodes as $key => $value) { |
|
| 23 | 1 | if (0 === $key) { |
|
| 24 | 1 | $root = self::createNode($value); |
|
| 25 | |||
| 26 | 1 | continue; |
|
| 27 | } |
||
| 28 | |||
| 29 | 1 | if (!$root instanceof NodeInterface) { |
|
| 30 | 1 | continue; |
|
| 31 | } |
||
| 32 | |||
| 33 | 1 | self::pickRandomNode($root)->add(self::createNode($value)); |
|
| 34 | } |
||
| 35 | |||
| 36 | 1 | return $root; |
|
| 37 | } |
||
| 80 |