src/Leevel/Console/Load.php
public function findConsoleFile(array $namespaces): array
    {
        $files = [];

        foreach ($namespaces as $key => $dir) {
            if (!is_dir($dir)) {
                throw new RuntimeException(sprintf('Console load dir %s is not exits.', $dir));
            }

            $currentFiles = glob($dir.'/*.php');
            $currentFiles = array_map(function ($item) use ($key) {
                return $key.'\\'.basename($item, '.php');
            }, $currentFiles);

            // 忽略索引
            $currentFiles = array_filter($currentFiles, function ($item) {
                return !ends_with($item, '\\index');
            });

            $files = array_merge($files, $currentFiles);
        }

        return $files;
    }
public function findConsoleFile(array $namespaces): array
    {
        $files = [];

        foreach ($namespaces as $key => $dir) {
            if (!is_dir($dir)) {
                throw new RuntimeException(sprintf('Console load dir %s is not exits.', $dir));
            }

            $currentFiles = glob($dir.'/*.php');
            $currentFiles = array_map(function ($item) use ($key) {
                return $key.'\\'.basename($item, '.php');
            }, $currentFiles);

            // 忽略索引
            $currentFiles = array_filter($currentFiles, function ($item) {
                return !ends_with($item, '\\index');
            });

            $files = array_merge($files, $currentFiles);
        }

        return $files;
    }
分析目录中的 PHP 命令包包含的文件.

@param array $namespaces

@return array