function DevelGenerateCommands::validate

The standard drush validate hook.

@hook validate

Parameters

\Consolidation\AnnotatedCommand\CommandData $commandData: The data sent from the drush command.

File

devel_generate/src/Commands/DevelGenerateCommands.php, line 265

Class

DevelGenerateCommands
Provide Drush commands for all the Devel Generate processes.

Namespace

Drupal\devel_generate\Commands

Code

public function validate(CommandData $commandData) {
  $manager = $this->getManager();
  $args = $commandData->input()
    ->getArguments();
  // The command name is the first argument but we do not need this.
  array_shift($args);
  /** @var DevelGenerateBaseInterface $instance */
  $instance = $manager->createInstance($commandData->annotationData()
    ->get('pluginId'), []);
  $this->setPluginInstance($instance);
  $parameters = $instance->validateDrushParams($args, $commandData->input()
    ->getOptions());
  $this->setParameters($parameters);
}