protected function getFiles(string $relativeDir, array &$filesystem = []) : array
    {
        $fullDir = $this->getPath($relativeDir);

        $dirIterator = new FilesystemIterator($fullDir, FilesystemIterator::SKIP_DOTS);

        /** @var \SplFileInfo $info */
        foreach ($dirIterator as $info) {
            if ($info->isDir()) {
                $this->getFiles("{$relativeDir}/{$info->getFilename()}", $filesystem);
            } else {
                if (!isset($filesystem[$relativeDir])) {
                    $filesystem[$relativeDir] = [];
                }

                $filesystem[$relativeDir][] = $info->getFilename();
            }
        }

        return $filesystem;
    }
protected function getFiles(string $relativeDir, array &$filesystem = []) : array
    {
        $fullDir = $this->getPath($relativeDir);

        $dirIterator = new FilesystemIterator($fullDir, FilesystemIterator::SKIP_DOTS);

        /** @var \SplFileInfo $info */
        foreach ($dirIterator as $info) {
            if ($info->isDir()) {
                $this->getFiles("{$relativeDir}/{$info->getFilename()}", $filesystem);
            } else {
                if (!isset($filesystem[$relativeDir])) {
                    $filesystem[$relativeDir] = [];
                }

                $filesystem[$relativeDir][] = $info->getFilename();
            }
        }

        return $filesystem;
    }
protected function getFiles ( string $ relativeDir , array & $ filesystem = [ ] ) : array { $ fullDir = $ this -> getPath ( $ relativeDir ) ; $ dirIterator = new FilesystemIterator ( $ fullDir , FilesystemIterator :: SKIP_DOTS ) ; /** @var \SplFileInfo $info */ foreach ( $ dirIterator as $ info ) { if ( $ info -> isDir ( ) ) { $ this -> getFiles ( "{$relativeDir}/{$info->getFilename()}" , $ filesystem ) ; } else { if ( ! isset ( $ filesystem [ $ relativeDir ] ) ) { $ filesystem [ $ relativeDir ] = [ ] ; } $ filesystem [ $ relativeDir ] [ ] = $ info -> getFilename ( ) ; } } return $ filesystem ; }
Load files in templates directory

@param string $relativeDir
@param array  $filesystem
@return array
Load files in templates directory