Conditions | 6 |
Paths | 6 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | protected function loadRecursively(RegionModel $region, string $code, int $deep = 0) |
||
21 | { |
||
22 | if ($region->code === $code) { |
||
23 | $this->regions = $region->children; |
||
24 | if ($deep > 0) { |
||
25 | foreach ($region->children as $child) { |
||
26 | $this->regions = $this->regions->merge($this->loadRecursively($child, $code, $deep - 1)); |
||
27 | } |
||
28 | } |
||
29 | } else { |
||
30 | foreach ($region->children as $child) { |
||
31 | $this->regions = $this->loadRecursively($child, $code, $deep); |
||
32 | if ($this->regions->isNotEmpty()) { |
||
33 | break; |
||
34 | } |
||
47 | } |