| Conditions | 4 |
| Paths | 5 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 2 | private function doTraverse(NodeInterface $node): Traversable |
|
| 36 | { |
||
| 37 | 2 | $middle = floor($node->degree() / 2); |
|
| 38 | |||
| 39 | 2 | foreach ($node->children() as $key => $child) { |
|
| 40 | 2 | if ((int) $key === (int) $middle) { |
|
| 41 | 2 | yield $this->index => $node; |
|
| 42 | 2 | ++$this->index; |
|
| 43 | } |
||
| 44 | |||
| 45 | 2 | if ($child->isLeaf()) { |
|
| 46 | 2 | yield $this->index => $child; |
|
| 47 | 2 | ++$this->index; |
|
| 48 | } |
||
| 49 | |||
| 50 | 2 | yield from $this->doTraverse($child); |
|
| 51 | } |
||
| 54 |