| Conditions | 4 |
| Paths | 6 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 58 | public function getLevels(int $from = 1, ?int $to = null, ?callable $callback = null): array |
||
| 59 | { |
||
| 60 | $parts = explode('.', $this->env); |
||
| 61 | $n = isset($to) ? min(count($parts), $to) : count($parts); |
||
| 62 | |||
| 63 | $levels = []; |
||
| 64 | |||
| 65 | for ($i = $from; $i <= $n; $i++) { |
||
| 66 | $level = join('.', array_slice($parts, 0, $i)); |
||
| 67 | $levels[] = isset($callback) ? $callback($level) : $level; |
||
| 68 | } |
||
| 69 | |||
| 70 | return $levels; |
||
| 71 | } |
||
| 73 |