protected function detectRecursive($folder, $pattern, $levels)
    {
        $path = trim(Folder::getRelativePath($folder), '/');

        if (is_dir($folder)) {
            // Find all system and user configuration files.
            $options = [
                'levels'  => $levels,
                'compare' => 'Filename',
                'pattern' => $pattern,
                'filters' => [
                    'pre-key' => $this->base,
                    'key' => $pattern,
                    'value' => function (\RecursiveDirectoryIterator $file) use ($path) {
                        return ['file' => "{$path}/{$file->getSubPathname()}", 'modified' => $file->getMTime()];
                    }
                ],
                'key' => 'SubPathname'
            ];

            $list = Folder::all($folder, $options);

            ksort($list);
        } else {
            $list = [];
        }

        return [$path => $list];
    }
protected function detectRecursive($folder, $pattern, $levels)
    {
        $path = trim(Folder::getRelativePath($folder), '/');

        if (is_dir($folder)) {
            // Find all system and user configuration files.
            $options = [
                'levels'  => $levels,
                'compare' => 'Filename',
                'pattern' => $pattern,
                'filters' => [
                    'pre-key' => $this->base,
                    'key' => $pattern,
                    'value' => function (\RecursiveDirectoryIterator $file) use ($path) {
                        return ['file' => "{$path}/{$file->getSubPathname()}", 'modified' => $file->getMTime()];
                    }
                ],
                'key' => 'SubPathname'
            ];

            $list = Folder::all($folder, $options);

            ksort($list);
        } else {
            $list = [];
        }

        return [$path => $list];
    }
protected function detectRecursive ( $ folder , $ pattern , $ levels ) { $ path = trim ( Folder :: getRelativePath ( $ folder ) , '/' ) ; if ( is_dir ( $ folder ) ) { // Find all system and user configuration files. $ options = [ 'levels' => $ levels , 'compare' => 'Filename' , 'pattern' => $ pattern , 'filters' => [ 'pre-key' => $ this -> base , 'key' => $ pattern , 'value' => function ( \ RecursiveDirectoryIterator $ file ) use ( $ path ) { return [ 'file' => "{$path}/{$file->getSubPathname()}" , 'modified' => $ file -> getMTime ( ) ] ; } ] , 'key' => 'SubPathname' ] ; $ list = Folder :: all ( $ folder , $ options ) ; ksort ( $ list ) ; } else { $ list = [ ] ; } return [ $ path => $ list ] ; }
Detects all directories with a configuration file and returns them with last modification time.

@param  string $folder   Location to look up from.
@param  string $pattern  Pattern to match the file. Pattern will also be removed from the key.
@param  int    $levels   Maximum number of recursive directories.
@return array
@internal
Detects all directories with a configuration file and returns them with last modification time .