| Conditions | 7 |
| Paths | 6 |
| Total Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 7 |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | 1941 | public function next(): ?NodeWalkerEvent |
|
| 40 | { |
||
| 41 | 1941 | $current = $this->current; |
|
| 42 | 1941 | $entering = $this->entering; |
|
| 43 | 1941 | if (null === $current) { |
|
| 44 | 1941 | return null; |
|
| 45 | } |
||
| 46 | |||
| 47 | 1941 | if ($entering && $current->isContainer()) { |
|
| 48 | 1941 | if ($current->firstChild()) { |
|
| 49 | 1935 | $this->current = $current->firstChild(); |
|
| 50 | 1935 | $this->entering = true; |
|
| 51 | } else { |
||
| 52 | 1941 | $this->entering = false; |
|
| 53 | } |
||
| 54 | 1941 | } elseif ($current === $this->root) { |
|
| 55 | 1941 | $this->current = null; |
|
| 56 | 1935 | } elseif (null === $current->next()) { |
|
| 57 | 1935 | $this->current = $current->parent(); |
|
| 58 | 1935 | $this->entering = false; |
|
| 59 | } else { |
||
| 60 | 504 | $this->current = $current->next(); |
|
| 61 | 504 | $this->entering = true; |
|
| 62 | } |
||
| 63 | |||
| 64 | 1941 | return new NodeWalkerEvent($current, $entering); |
|
| 65 | } |
||
| 66 | |||
| 79 |