private function getComponent(InputInterface $input, OutputInterface $output)
{
$components = $this->getPluginNames();
$components[] = 'core';
$validate = function ($component) use($components) {
if (!in_array($component, $components)) {
throw new \InvalidArgumentException('You have to enter a name of an existing plugin or "core".');
}
return $component;
};
$component = $input->getOption('component');
if (empty($component)) {
$dialog = $this->getHelperSet()->get('dialog');
$component = $dialog->askAndValidate($output, 'Enter the name of your plugin or "core": ', $validate, false, null, $components);
} else {
$validate($component);
}
return $component;
}