Creates factory

@param InputInterface $input
@param OutputInterface $output
@param HelperSet $helperSet
@return ConsoleIOFactory
@author stev leibelt <artodeto@arcor.de>
@since 2013-06-01
542970
public static function buildDefault(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
    {
        $factory = new self();

        $factory->setHelperSet($helperSet);
        $factory->setInput($input);
        $factory->setOutput($output);

        return $factory;
    }
1031126
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $questionHelper = $this->getQuestionHelper();
        $dialog = $this->getHelper('dialog');

        if ($input->isInteractive()) {
            if (!$dialog->askConfirmation($output, $questionHelper->getQuestion('Do you confirm generation', 'yes', '?'), true)) {
                $output->writeln('<error>Command aborted</error>');

                return 1;
            }
        }

        foreach (array('namespace', 'dir') as $option) {
            if (null === $input->getOption($option)) {
                throw new \RuntimeException(sprintf('The "%s" option must be provided.', $option));
            }
        }

        $namespace = Validators::validateBundleNamespace($input->getOption('namespace'));
        if (!$bundle = $input->getOption('bundle-name')) {
            $bundle = strtr($namespace, array('\\' => ''));
        }
        $bundle = Validators::validateBundleName($bundle);
        $dir = Validators::validateTargetDir($input->getOption('dir'), $bundle, $namespace);

        if (null === $input->getOption('format')) {
            $input->setOption('format', 'xml');
        }
        $format = Validators::validateFormat($input->getOption('format'));
        $structure = $input->getOption('structure');

        if (null === $input->getOption('db-driver')) {
            $input->setOption('db-driver', 'orm');
        }
        $dbDriver = Validators::validateDbDriver($input->getOption('db-driver'));

        $questionHelper->writeSection($output, 'Bundle generation');

        if (!$this->getContainer()->get('filesystem')->isAbsolutePath($dir)) {
            $dir = getcwd().'/'.$dir;
        }

        $generator = $this->getGenerator();
        $generator->generate($namespace, $bundle, $dir, $format, $structure, $dbDriver);

        $output->writeln('Generating the bundle code: <info>OK</info>');

        $errors = array();
        $runner = $questionHelper->getRunner($output, $errors);

        // check that the namespace is already autoloaded
        $runner($this->checkAutoloader($output, $namespace, $bundle, $dir));

        // register the bundle in the Kernel class
        $runner($this->updateKernel($questionHelper, $input, $output, $this->getContainer()->get('kernel'), $namespace, $bundle));

        $questionHelper->writeGeneratorSummary($output, $errors);
    }
967208
public function doRun(InputInterface $input, OutputInterface $output)
	{
		$this->io = new ConsoleIO($input, $output, $this->getHelperSet());
		ErrorHandler::register($this->io);

		return parent::doRun($input, $output);
	}
277970
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (null === $this->widgetManager) {
            $this->widgetManager = $this->getContainer()->get('kunstmaan_dashboard.manager.widgets');
        }

        /** @var DashboardWidget[] $widgets */
        $widgets = $this->widgetManager->getWidgets();
        foreach ($widgets as $widget) {
            /* @var DashboardWidget $widget */
            $widget->getCommand()->execute($input, $output);
        }
    }
496387
protected function execute(InputInterface $input, OutputInterface $output)
    {


        $serverHelper = new DetermineServer();

        $from = $input->getArgument('from');
        $to = $input->getArgument('to');
        $options = $input->getArgument('options');

        $credentials = $GLOBALS['TYPO3_CONF_VARS']['DB']["Connections"]["Default"];

        $fromServer = $serverHelper->getServerForCommand($from);
        $fromPath = $serverHelper->getPathForCommand($from);
        $toServer = $serverHelper->getServerForCommand($to);
        $toPath = $serverHelper->getPathForCommand($to);
        $filename = "database";
        $output->writeln('<comment>Sync database from ' . $from . ' to ' . $to . '.</comment>');
        $output->writeln('<comment>Start to dump database.</comment>');


        if(!empty($options)) {
            if($options === "noCache"){
                $excludeService = new DatabaseExcludes();
                $excludes = $excludeService->createExcludes($options,$credentials['dbname']);

            }elseif($options === "minimal"){
                $includeService = new DatabaseExcludes();
                $includes = $includeService->createincludes($options,$credentials['dbname']);

            }else {
                $output->writeln('<error>Option not found...Exit!</error>');

            }
        }

        if (strpos($from, '@') === 0) {
            exec('ssh ' . $fromServer . ' "cd ' . $fromPath . ' ; ../vendor/bin/typo3 database:dumpthis"');
        } else {
            exec('cd ' . PATH_site . '; mysqldump  --verbose -u' . $credentials['user'] . ' -h' . $credentials['host'] . ' -p' . $credentials['password'] . ' ' . $credentials['dbname'] . ' '.$excludes.$includes.' -r ' . $filename . '.dump');
        }

        $output->writeln('<comment>Copy database from ' . $from . ' to ' . $to . '.</comment>');
        if (strpos($from, '@') === 0) {
            exec('ssh -A ' . $fromServer . ' rsync -chavzP --progress --stats --exclude=_processed_ --exclude=_temp_ --exclude=log --exclude=sys ' . $fromPath . 'database.dump ' . $toServer . ':' . $toPath . 'database.dump');
        }else {
            exec('rsync -chavzP --progress --stats --exclude=_processed_ --exclude=_temp_ --exclude=log --exclude=sys ' .$fromPath . 'database.dump ' . $toServer . ':' . $toPath . 'database.dump');
        }
        // if foreign, clean up!
        if (strpos($to, '@') === 0) {
            $output->writeln('<comment>Clean up on Server.</comment>');
            exec('ssh ' . $fromServer . ' "cd ' . $fromPath . ' ; rm database.dump"');
        }


        $output->writeln('<comment>Import database to ' . $to . '.</comment>');
        if (strpos($to, '@') === 0) {
            exec('ssh ' . $toServer . ' "cd ' . $toPath . ' ; ../vendor/bin/typo3 database:importthis"');
        } else {
            exec('mysql --verbose -u' . $credentials['user'] . ' -h' . $credentials['host'] . ' -p' . $credentials['password'] . ' ' . $credentials['dbname'] . ' < ' . $filename . '.dump');
        }

        return 0;

    }
326693
final public function console(InputInterface $input)
    {
        if (!$input) {
            $input = new ArgvInput();
        }
        $application = new Application($this);
        return $application->run($input);
    }
72678
protected function getConfiguration(InputInterface $input): ConsoleConfigInterface
    {
        // If the configuration to use is the default.
        if ($input->getOption('default')) {
            $this->validatePathsExist($input);
            // If it is a directory.
            if ($input->getOption('dir')) {
                return (new DefaultConsoleConfigFactory())
                    ->invokeDir($input->getArgument('source'), $input->getArgument('target'));
            }
            return (new DefaultConsoleConfigFactory())
                ->invokeFile($input->getArgument('source'), $input->getArgument('target'));
        }

        $path = $input->getOption('config');
        // If we have a "=" at the beginning of the option value
        $path = preg_replace('/^\=/', '', $path);

        $factory = $this->getConfigurationFactory($path);

        if ($input->getOption('dir')) {
            $this->validatePathsExist($input);
            return $factory->invokeDir(
                $path,
                $input->getArgument('source'),
                $input->getArgument('target')
            );
        }
        if ($input->getOption('file')) {
            $this->validatePathsExist($input);
            return $factory->invokeFile(
                $path,
                $input->getArgument('source'),
                $input->getArgument('target')
            );
        }
        return $factory->invoke($path);
    }
370565
public function run(InputInterface $input = null, OutputInterface $output = null)
    {
        $input  = $input ?: new ArgvInput();
        $output = $output ?: new ConsoleOutput(OutputInterface::VERBOSITY_NORMAL, null, $this->formatter());

        return parent::run($input, $output);
    }
821227
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = new SymfonyOutput($output);

        $this->input = $input;

        if (method_exists($this, 'handle')) {
            $this->handle();
        }
    }
765115
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $container = $this->getContainer();
        $configBuilder = $container->get('admin.configuration.configbuilder');
        $pool = $container->get('admin.configuration.pool');
        foreach ($pool->getConfigurations() as $id => $attributes) {
            $config = $container->get($id);
            $config->build($configBuilder);
        }
    }
136960
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $config = new Config(
            $input->getOption('prod'),
            $input->getOption('destination'),
            '/sites/all/modules/%s',
            '/sites/all/themes/%s',
            '/sites/all/drush/%s',
            '/profiles/%s',
            '/sites/default/files',
            '/sites/default/files-private',
            '/sites/default/settings.php'
        );

        $finder = new Finder(
             $input->getOption('source'),
            $input->getOption('destination'),
            'cnf/files',
            'cnf/private',
            'cnf/settings.php'
        );

        $im = $this->getComposer()->getInstallationManager();
        $rm = $this->getComposer()->getRepositoryManager();

        $mapper = new Mapper($config, $finder, $im, $rm);
        $mapper->clear();
        $mapper->mirror($mapper->getMap());
    }
1177029
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $start = microtime(true);

        $this->setOutput($output);
        $this->setVerbosity($output->getVerbosity());

        $isChild = $input->getOption('child');

        if ($isChild && $output->getVerbosity() <= OutputInterface::VERBOSITY_NORMAL) {
            $this->setVerbosity(self::VERBOSITY_CHILD);
        }

        $this->getContainer()->get('ez_migration_bundle.step_executed_listener.tracing')->setOutput($output);

        // q: is it worth declaring a new, dedicated migration service ?
        $migrationService = $this->getMigrationService();
        $migrationService->setLoader($this->getContainer()->get('ez_migration_bundle.loader.filesystem_recursive'));

        $force = $input->getOption('force');

        $toExecute = $this->buildMigrationsList($input->getOption('path'), $migrationService, $force, $isChild);

        if (!count($toExecute)) {
            $this->writeln('<info>No migrations to execute</info>');
            return 0;
        }

        if ($isChild) {
            return $this->executeAsChild($input, $output, $toExecute, $force, $migrationService);
        } else {
            return $this->executeAsParent($input, $output, $toExecute, $start);
        }
    }
647463
protected function createConsoleHelper(InputInterface $input, OutputInterface $output)
    {
        /* Check if it runs in Symfony3 env — than use QuestionHelper, because DialogHelper is absent */
        if (class_exists('\Symfony\Component\Console\Helper\QuestionHelper')) {
            $helper = new ConsoleHelper3($input, $output);
        } else {
            $helper = new ConsoleHelper($input, $output);
        }
        $this->getHelperSet()->set($helper);

        return $helper;
    }
179560
public static function installBackendBundle(InputInterface $input, OutputInterface $output, QuestionHelper $helper)
    {
        $rootDir = getcwd();

        $question = new ConfirmationQuestion('Would you like to install default backend bundle (Recommended)? [y/n] ', true);
        if (!$helper->ask($input, $output, $question)) {
            return;
        }

        $applicationName = self::getApplicationName($input, $output, $helper);

        if (is_dir($rootDir.'/src/' . $applicationName . '/BackendBundle')) {
            return;
        }

        $output->writeln('<info>Installing Backend bundle.</info>');
        $output->writeln('');

        $bundleDir = $rootDir . '/src/' . $applicationName;

        $fileSystem = new Filesystem();
        $fileSystem->setTwigEnvironment(self::getTwigEnvironment());

        self::buildBackendFiles($bundleDir . '/Bundle/BackendBundle/', $applicationName, $fileSystem);

        $routingPath = $rootDir . '/app/config/routing.yml';
        $namePrefix = strtolower($applicationName) . '_backend';
        $bundleName = $applicationName . 'BackendBundle';
        $content = file_get_contents($routingPath);
        $nodeDeclaration = <<<EOF
$namePrefix:
    resource: @$bundleName/Resources/config/routing/main.yml
    prefix: /administration

fos_user_security:
    resource: "@FOSUserBundle/Resources/config/routing/security.xml"

fos_user_register:
    resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
    prefix: /register

fos_user_resetting:
    resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
    prefix: /resetting

fos_user_change_password:
    resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
    prefix: /account

EOF;

        if (false === strpos($content, $namePrefix)) {
            $updatedContent = $nodeDeclaration . "\n" . $content;

            $fileSystem->dumpFile($routingPath, $updatedContent);
        }

        $configFile = $rootDir . '/app/config/config.yml';
        $ref = '- { resource: security.yml }';
        $configDeclaration = '- { resource: @' . $applicationName . 'BackendBundle/Resources/config/app/' . strtolower($applicationName) . '.yml }';
        $content = file_get_contents($configFile);

        if (false === strpos($content, $configDeclaration)) {
            $updatedContent = str_replace($ref, $ref . "\n    " . $configDeclaration, $content);
            if ($content === $updatedContent) {
                throw new \RuntimeException('Unable to patch %s.', $configFile);
            }

            $fileSystem->dumpFile($configFile, $updatedContent);
        }

        $kernelFile = $rootDir . '/app/AppKernel.php';

        $fileSystem = new Filesystem();
        $ref = '$bundles = array(';
        $bundleDeclaration = 'new ' . $applicationName . '\\Bundle\\BackendBundle\\' . $applicationName . 'BackendBundle(),';
        $content = file_get_contents($kernelFile);

        if (false === strpos($content, $bundleDeclaration)) {
            $updatedContent = str_replace($ref, $ref . "\n            " . $bundleDeclaration, $content);
            if ($content === $updatedContent) {
                throw new \RuntimeException('Unable to patch %s.', $kernelFile);
            }

            $fileSystem->dumpFile($kernelFile, $updatedContent);
        }
    }
763607
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new SymfonyStyle($input, $output);

        if ($input->isInteractive() && !$io->confirm('Do you confirm generation?', true)) {
            $io->error('Command aborted');

            return 1;
        }

        foreach (['namespace', 'dir'] as $option) {
            if (null === $input->getOption($option)) {
                throw new RuntimeException(sprintf('The "%s" option must be provided.', $option));
            }
        }

        $namespace = Validators::validateBundleNamespace($input->getOption('namespace'));
        if (!$bundle = $input->getOption('module-name')) {
            $bundle = strtr($namespace, ['\\' => '']);
        }
        $bundle = Validators::validateBundleName($bundle);
        $dir = Validators::validateTargetDir($input->getOption('dir'), $bundle, $namespace);
        if (null === $input->getOption('format')) {
            $input->setOption('format', 'annotation');
        }
        $format = Validators::validateFormat($input->getOption('format'));

        $io->block('Module generation', null, 'bg=blue;fg=white', '  ', true);

        if (!$this->getContainer()->get('filesystem')->isAbsolutePath($dir)) {
            $dir = getcwd().'/'.$dir;
        }

        $io->text('Generating the module code...');
        $generator = $this->getGenerator();
        $generator->generate($namespace, $bundle, $dir, $format);
        $io->success('Code generated!');

        $io->block('You can now start using the generated code!', null, 'bg=blue;fg=white', '  ', true);

        return 0;
    }
1071262
public function createTable(InputInterface $input, OutputInterface $output)
    {
        $databse = $this->getApplication()->find('create:table');
        $databse_arguments = array(
            'command'   => 'create:table',
            'table'     => $input->getArgument('table'),
            'column'    => $input->getArgument('column')
        );
        $input_db   = new ArrayInput($databse_arguments);
        $return_db  = $databse->run($input_db,$output);
        return $output->writeln($return_db);
    }
632971
private function setInputAndOutput(InputInterface $input, OutputInterface $output)
    {
        if (is_null($this->assistant)) {
            $this->assistant = new CommandAssistant();
            $this->assistant->setQuestionHelper($this->getQuestionHelper());
            $this->assistant->setKernel($this->getApplication()->getKernel());
        }
        $this->assistant->setOutput($output);
        $this->assistant->setInput($input);
    }