src/Viserio/Component/Foundation/Bootstrap/AbstractLoadFiles.php
protected static function getFiles(string $path, $extensions = 'php'): array
    {
        if (! \file_exists($path)) {
            return [];
        }

        $files = [];
        $dir   = new DirectoryIterator($path);

        foreach ($dir as $fileinfo) {
            if (! $fileinfo->isDot()) {
                $extension = \pathinfo($fileinfo->getRealPath(), \PATHINFO_EXTENSION);

                if (\in_array($extension, (array) $extensions, true)) {
                    $filePath = $fileinfo->getRealPath();
                    $key      = \basename($filePath, '.' . $extension);

                    if (\in_array($key, static::$bypassFiles, true)) {
                        continue;
                    }

                    $files[$key] = $filePath;
                }
            }
        }

        \ksort($files, \SORT_NATURAL);

        return $files;
    }
protected static function getFiles(string $path, $extensions = 'php'): array
    {
        if (! \file_exists($path)) {
            return [];
        }

        $files = [];
        $dir   = new DirectoryIterator($path);

        foreach ($dir as $fileinfo) {
            if (! $fileinfo->isDot()) {
                $extension = \pathinfo($fileinfo->getRealPath(), \PATHINFO_EXTENSION);

                if (\in_array($extension, (array) $extensions, true)) {
                    $filePath = $fileinfo->getRealPath();
                    $key      = \basename($filePath, '.' . $extension);

                    if (\in_array($key, static::$bypassFiles, true)) {
                        continue;
                    }

                    $files[$key] = $filePath;
                }
            }
        }

        \ksort($files, \SORT_NATURAL);

        return $files;
    }
Get all of the files for the application.

@param string       $path
@param array|string $extensions

@return array