function DevelGenerateCommands::validate

Same name in this branch
  1. 5.x devel_generate/src/Commands/DevelGenerateCommands.php \Drupal\devel_generate\Commands\DevelGenerateCommands::validate()
Same name in other branches
  1. 8.x-1.x devel_generate/src/Commands/DevelGenerateCommands.php \Drupal\devel_generate\Commands\DevelGenerateCommands::validate()
  2. 4.x devel_generate/src/Commands/DevelGenerateCommands.php \Drupal\devel_generate\Commands\DevelGenerateCommands::validate()

The standard drush validate hook.

Parameters

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

File

devel_generate/src/Drush/Commands/DevelGenerateCommands.php, line 242

Class

DevelGenerateCommands
Provide Drush commands for all the core Devel Generate plugins.

Namespace

Drupal\devel_generate\Drush\Commands

Code

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