You are here

public function DevelGenerateCommands::validate in Devel 8.3

Same name and namespace in other branches
  1. 8 devel_generate/src/Commands/DevelGenerateCommands.php \Drupal\devel_generate\Commands\DevelGenerateCommands::validate()
  2. 8.2 devel_generate/src/Commands/DevelGenerateCommands.php \Drupal\devel_generate\Commands\DevelGenerateCommands::validate()
  3. 4.x devel_generate/src/Commands/DevelGenerateCommands.php \Drupal\devel_generate\Commands\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 258

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);
}