Piwik\Plugins\CoreConsole\Commands\GenerateSettings::getSettingsType PHP Method

getSettingsType() private method

private getSettingsType ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    private function getSettingsType(InputInterface $input, OutputInterface $output)
    {
        $availableTypes = $this->getSettingTypes();
        $validate = function ($type) use($availableTypes) {
            if (empty($type) || !in_array($type, $availableTypes)) {
                throw new \InvalidArgumentException('Please enter a valid settings type (' . implode(', ', $availableTypes) . '). ');
            }
            return $type;
        };
        $settingsType = $input->getOption('settingstype');
        if (empty($settingsType)) {
            $dialog = $this->getHelperSet()->get('dialog');
            $settingsType = $dialog->askAndValidate($output, 'Please choose the type of settings you want to create (' . implode(', ', $availableTypes) . '): ', $validate, false, null, $availableTypes);
        } else {
            $validate($settingsType);
        }
        return ucfirst($settingsType) . 'Settings';
    }