src/ApplicationEnv.php
public function getLevels(int $from = 1, ?int $to = null, ?callable $callback = null): array
    {
        $parts = explode('.', $this->env);
        $n = isset($to) ? min(count($parts), $to) : count($parts);

        $levels = [];

        for ($i = $from; $i <= $n; $i++) {
            $level = join('.', array_slice($parts, 0, $i));
            $levels[] = isset($callback) ? $callback($level) : $level;
        }

        return $levels;
    }
public function getLevels(int $from = 1, ?int $to = null, ?callable $callback = null): array
    {
        $parts = explode('.', $this->env);
        $n = isset($to) ? min(count($parts), $to) : count($parts);

        $levels = [];

        for ($i = $from; $i <= $n; $i++) {
            $level = join('.', array_slice($parts, 0, $i));
            $levels[] = isset($callback) ? $callback($level) : $level;
        }

        return $levels;
    }
public function getLevels ( int $ from = 1 , ? int $ to = null , ? callable $ callback = null ) : array { $ parts = explode ( '.' , $ this -> env ) ; $ n = isset ( $ to ) ? min ( count ( $ parts ) , $ to ) : count ( $ parts ) ; $ levels = [ ] ; for ( $ i = $ from ; $ i <= $ n ; $ i ++ ) { $ level = join ( '.' , array_slice ( $ parts , 0 , $ i ) ) ; $ levels [ ] = isset ( $ callback ) ? $ callback ( $ level ) : $ level ; } return $ levels ; }
Traverse through each level of the application env.

@param int           $from
@param int|null      $to
@param callable|null $callback
@return array
Traverse through each level of the application env .