You are here

public function VocabularyDevelGenerate::validateDrushParams in Devel 8.3

Same name and namespace in other branches
  1. 8 devel_generate/src/Plugin/DevelGenerate/VocabularyDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\VocabularyDevelGenerate::validateDrushParams()
  2. 8.2 devel_generate/src/Plugin/DevelGenerate/VocabularyDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\VocabularyDevelGenerate::validateDrushParams()
  3. 4.x devel_generate/src/Plugin/DevelGenerate/VocabularyDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\VocabularyDevelGenerate::validateDrushParams()

Responsible for validating Drush params.

Parameters

array $args: The command arguments.

array $options: The commend options.

Return value

array An array of values ready to be used for generateElements().

Overrides DevelGenerateBaseInterface::validateDrushParams

File

devel_generate/src/Plugin/DevelGenerate/VocabularyDevelGenerate.php, line 160

Class

VocabularyDevelGenerate
Provides a VocabularyDevelGenerate plugin.

Namespace

Drupal\devel_generate\Plugin\DevelGenerate

Code

public function validateDrushParams(array $args, array $options = []) {
  $values = [
    'num' => array_shift($args),
    'kill' => $this
      ->isDrush8() ? drush_get_option('kill') : $options['kill'],
    'title_length' => 12,
  ];
  if ($this
    ->isNumber($values['num']) == FALSE) {
    throw new \Exception(dt('Invalid number of vocabularies: @num.', [
      '@num' => $values['num'],
    ]));
  }
  return $values;
}