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