| Conditions | 3 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 35 | protected function flatten(RegionModel $region): array |
||
| 36 | { |
||
| 37 | $children = $region->children; |
||
| 38 | $region->children = new Collection(); |
||
| 39 | $newArray = [ |
||
| 40 | $region |
||
| 41 | ]; |
||
| 42 | if ($children) { |
||
|
|
|||
| 43 | foreach ($children as $child) { |
||
| 44 | $newArray[] = $this->flatten($child); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | return $newArray; |
||
| 48 | } |
||
| 74 | } |