code: 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;
      }
docs: 获取目录下的所有子命名空间
  @param $directory
  @param string $root
  @return array