src/Utility/DirectoryScanner.php
public static function scanChildNamespaces($directory, $root = "")
    {
        $allChildDirectories = [];
        if (is_dir($directory)) {

            $childFiles = scandir($directory);

            foreach ($childFiles as $childFile) {
                if ($childFile != '.' && $childFile != '..') {
                    $childDirectoryFullPath = $directory . DIRECTORY_SEPARATOR . $childFile;
                    if (is_dir($childDirectoryFullPath)) {

                        $childDirectory = $root . "\\" . $childFile;
                        $allChildDirectories[] = $childDirectory;

                        $childDirectories = self::scanChildNamespaces($childDirectoryFullPath, $childDirectory);
                        $allChildDirectories = array_merge($allChildDirectories, $childDirectories);

                    }
                }
            }
        }

        return $allChildDirectories;
    }
public static function scanChildNamespaces($directory, $root = "")
    {
        $allChildDirectories = [];
        if (is_dir($directory)) {

            $childFiles = scandir($directory);

            foreach ($childFiles as $childFile) {
                if ($childFile != '.' && $childFile != '..') {
                    $childDirectoryFullPath = $directory . DIRECTORY_SEPARATOR . $childFile;
                    if (is_dir($childDirectoryFullPath)) {

                        $childDirectory = $root . "\\" . $childFile;
                        $allChildDirectories[] = $childDirectory;

                        $childDirectories = self::scanChildNamespaces($childDirectoryFullPath, $childDirectory);
                        $allChildDirectories = array_merge($allChildDirectories, $childDirectories);

                    }
                }
            }
        }

        return $allChildDirectories;
    }
获取目录下的所有子命名空间
@param $directory
@param string $root
@return array