public function getGenerators(array $command_directories, $namespace = '\DrupalCodeGenerator\Command') {
    $commands = [];

    foreach ($command_directories as $directory) {
      $iterator = new RecursiveIteratorIterator(
        new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS)
      );
      foreach ($iterator as $path => $file) {
        if ($file->getExtension() == 'php') {
          $relative_path = $this->filesystem->makePathRelative($path, $directory);
          $class = $namespace . '\\' . str_replace('/', '\\', preg_replace('#\.php/$#', '', $relative_path));
          if (class_exists($class)) {
            $reflected_class = new ReflectionClass($class);
            if (!$reflected_class->isInterface() && !$reflected_class->isAbstract() && $reflected_class->implementsInterface(self::COMMAND_INTERFACE)) {
              $commands[] = new $class();
            }
          }
        }
      }
    }

    return $commands;
  }
public function getGenerators(array $command_directories, $namespace = '\DrupalCodeGenerator\Command') {
    $commands = [];

    foreach ($command_directories as $directory) {
      $iterator = new RecursiveIteratorIterator(
        new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS)
      );
      foreach ($iterator as $path => $file) {
        if ($file->getExtension() == 'php') {
          $relative_path = $this->filesystem->makePathRelative($path, $directory);
          $class = $namespace . '\\' . str_replace('/', '\\', preg_replace('#\.php/$#', '', $relative_path));
          if (class_exists($class)) {
            $reflected_class = new ReflectionClass($class);
            if (!$reflected_class->isInterface() && !$reflected_class->isAbstract() && $reflected_class->implementsInterface(self::COMMAND_INTERFACE)) {
              $commands[] = new $class();
            }
          }
        }
      }
    }

    return $commands;
  }
public function getGenerators ( array $ command_directories , $ namespace = '\DrupalCodeGenerator\Command' ) { $ commands = [ ] ; foreach ( $ command_directories as $ directory ) { $ iterator = new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ directory , RecursiveDirectoryIterator :: SKIP_DOTS ) ) ; foreach ( $ iterator as $ path => $ file ) { if ( $ file -> getExtension ( ) == 'php' ) { $ relative_path = $ this -> filesystem -> makePathRelative ( $ path , $ directory ) ; $ class = $ namespace . '\\' . str_replace ( '/' , '\\' , preg_replace ( '#\.php/$#' , '' , $ relative_path ) ) ; if ( class_exists ( $ class ) ) { $ reflected_class = new ReflectionClass ( $ class ) ; if ( ! $ reflected_class -> isInterface ( ) && ! $ reflected_class -> isAbstract ( ) && $ reflected_class -> implementsInterface ( self :: COMMAND_INTERFACE ) ) { $ commands [ ] = new $ class ( ) ; } } } } } return $ commands ; }
Finds and instantiates generator commands.

@param array $command_directories
Directories to look up for commands.
@param string $namespace
(Optional) The namespace to filter out commands.

@return \Symfony\Component\Console\Command\Command[]
Array of generators.
Finds and instantiates generator commands .