Piwik\Plugins\CoreConsole\Commands\GenerateUpdate::getComponent PHP Method

getComponent() private method

private getComponent ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) : array
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
return array
    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;
    }