You are here

public function UserDevelGenerate::validateDrushParams in Devel 8

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

Responsible for validating Drush params.

@Return an array of values ready to be used for generateElements()

Overrides DevelGenerateBaseInterface::validateDrushParams

File

devel_generate/src/Plugin/DevelGenerate/UserDevelGenerate.php, line 181

Class

UserDevelGenerate
Provides a UserDevelGenerate plugin.

Namespace

Drupal\devel_generate\Plugin\DevelGenerate

Code

public function validateDrushParams($args, $options = []) {
  $values = array(
    'num' => array_shift($args),
    'time_range' => 0,
  );
  if ($this
    ->isDrush8()) {
    $values += [
      'roles' => explode(',', drush_get_option('roles', '')),
      'kill' => drush_get_option('kill'),
      'pass' => drush_get_option('pass', NULL),
    ];
  }
  else {
    $values += [
      'roles' => StringUtils::csvToArray($options['roles']),
      'kill' => $options['kill'],
      'pass' => $options['pass'],
    ];
  }
  return $values;
}