function DevelGenerateCommands::validate

Same name in this branch
  1. 5.x devel_generate/src/Drush/Commands/DevelGenerateCommands.php \Drupal\devel_generate\Drush\Commands\DevelGenerateCommands::validate()
Same name in other branches
  1. 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 267

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