@@ -47,25 +47,25 @@ discard block |
||
| 47 | 47 | $level = 0; |
| 48 | 48 | do { |
| 49 | 49 | $subLevelContainer = []; |
| 50 | - foreach($data as $datum) { |
|
| 51 | - if($childrenContainerKey !== null) { |
|
| 50 | + foreach ($data as $datum) { |
|
| 51 | + if ($childrenContainerKey !== null) { |
|
| 52 | 52 | yield $level => $datum; |
| 53 | 53 | $childrenContainer = MapAccessor::get($datum, $childrenContainerKey); |
| 54 | 54 | } else { |
| 55 | - if(!is_iterable($datum)) { |
|
| 55 | + if (!is_iterable($datum)) { |
|
| 56 | 56 | yield $level => $datum; |
| 57 | 57 | } |
| 58 | 58 | $childrenContainer = $datum; |
| 59 | 59 | } |
| 60 | - if(is_iterable($childrenContainer)) { |
|
| 61 | - foreach($childrenContainer as $child) { |
|
| 60 | + if (is_iterable($childrenContainer)) { |
|
| 61 | + foreach ($childrenContainer as $child) { |
|
| 62 | 62 | $subLevelContainer[] = $child; |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | $data = $subLevelContainer; |
| 67 | 67 | ++$level; |
| 68 | - } while(count($subLevelContainer)); |
|
| 68 | + } while (count($subLevelContainer)); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -83,18 +83,18 @@ discard block |
||
| 83 | 83 | int $initialLevel = 0 |
| 84 | 84 | ): Generator { |
| 85 | 85 | $level = $initialLevel; |
| 86 | - foreach($data as $datum) { |
|
| 87 | - if($childrenContainerKey !== null) { |
|
| 86 | + foreach ($data as $datum) { |
|
| 87 | + if ($childrenContainerKey !== null) { |
|
| 88 | 88 | yield $level => $datum; |
| 89 | 89 | $childrenContainer = MapAccessor::get($datum, $childrenContainerKey); |
| 90 | 90 | } else { |
| 91 | - if(!is_iterable($datum)) { |
|
| 91 | + if (!is_iterable($datum)) { |
|
| 92 | 92 | yield $level => $datum; |
| 93 | 93 | } |
| 94 | 94 | $childrenContainer = $datum; |
| 95 | 95 | } |
| 96 | - if(is_iterable($childrenContainer)) { |
|
| 97 | - yield from static::traverseDepthFirstRecursive($childrenContainer, $childrenContainerKey, $level + 1); |
|
| 96 | + if (is_iterable($childrenContainer)) { |
|
| 97 | + yield from static::traverseDepthFirstRecursive($childrenContainer, $childrenContainerKey, $level+1); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | } |