Executes the app

@param  InputInterface $oInput The Input Interface provided by Symfony
@param  OutputInterface $oOutput The Output Interface provided by Symfony
@return int
168478
protected function execute(InputInterface $oInput, OutputInterface $oOutput)
    {
        parent::execute($oInput, $oOutput);

        $aArguments = $oInput->getArguments();
        //  This is re-set in callCommand()
        unset($aArguments['command']);

        $aOptions = [];
        foreach ($oInput->getOptions() as $k => $v) {
            $aOptions['--' . $k] = $v;
        }

        // --------------------------------------------------------------------------

        //  Symfony seems to ignore calls to --no-interaction, so if it has been passed
        //  remove it and use the callCommand() argument instead
        $bInteractive = true;
        if (!empty($aOptions['--no-interaction'])) {
            unset($aOptions['--no-interaction']);
            $bInteractive = false;
        }

        // --------------------------------------------------------------------------

        return $this->callCommand(static::COMMAND, $aArguments + $aOptions, $bInteractive);
    }
1370430
protected function execute(InputInterface $oInput, OutputInterface $oOutput)
    {
        parent::execute($oInput, $oOutput);

        $sFilter     = $this->oInput->getArgument('component');
        $aEvents     = [];
        $aComponents = array_merge(
            [
                (object) [
                    'namespace' => 'App\\',
                    'slug'      => 'app',
                ],
            ],
            Components::available()
        );

        foreach ($aComponents as $oComponent) {

            $sPattern = '/' . str_replace('/', '\/', $sFilter) . '/';
            if (!empty($sFilter) && !preg_match($sPattern, $oComponent->slug)) {
                continue;
            }

            $sClass = '\\' . $oComponent->namespace . 'Events';
            if (class_exists($sClass)) {

                if (!classExtends($sClass, \Nails\Common\Events\Base::class)) {
                    throw new EventException($sClass . ' must extend ' . \Nails\Common\Events\Base::class);
                }

                if (method_exists($sClass, 'info')) {
                    $aComponentEvents = call_user_func([$sClass, 'info']);
                    if (!empty($aComponentEvents)) {
                        $aEvents[$oComponent->slug] = $aComponentEvents;
                    }
                }
            }
        }

        $oOutput->writeln('');

        if (!empty($sFilter)) {
            $oOutput->writeln('The following events are available for <info>' . $sFilter . '</info>:');
        } else {
            $oOutput->writeln('The following events are available in this application:');
        }

        foreach ($aEvents as $sComponent => $aComponentEvents) {
            $oOutput->writeln('');
            $oOutput->writeln('<comment>' . $sComponent . '</comment>');
            $oOutput->writeln('<comment>' . str_repeat('-', strlen($sComponent)) . '</comment>');
            $oOutput->writeln('');
            foreach ($aComponentEvents as $oEvent) {
                $oOutput->writeln('  <info>' . $oEvent->constant . '</info>');

                if (strlen($oEvent->description) > 100) {
                    $sDescription = wordwrap($oEvent->description, 100);
                    $aDescription = explode("\n", $sDescription);
                    $aDescription = array_map('trim', $aDescription);
                } else {
                    $aDescription = [$oEvent->description];
                }

                foreach ($aDescription as $sLine) {
                    $oOutput->writeln('  ' . $sLine);
                }

                $oOutput->writeln('  <comment>@namespace</comment> ' . $oEvent->namespace);

                if (!empty($oEvent->arguments)) {
                    $sParamPrefix = '  <comment>@param</comment> ';
                    $oOutput->writeln($sParamPrefix . implode("\n" . $sParamPrefix, $oEvent->arguments));
                }
                $oOutput->writeln('');
            }
        }
        $oOutput->writeln('');

        return static::EXIT_CODE_SUCCESS;
    }
534714
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->getHelper('phpdocumentor_logger')->connectOutputToLogging($output, $this);

        $converter = $this->getConverter($input);
        $converter->setOption('title', $input->getOption('title'));

        $output->writeln('Collect all documents');
        $files = $this->buildCollection(
            $input->getArgument('source'),
            $converter->getDefinition()->getInputFormat()->getExtensions()
        );

        $output->writeln('Converting documents');
        $files = $converter->convert($files, $this->getTemplate($input));

        $output->writeln('Writing converted documents to disk');
        $this->writeToDisk($files, $input->getOption('target'));

        $output->writeln('Writing assets to disk');
        $converter->getAssets()->copyTo($input->getOption('target'));
    }
601942
protected function execute(InputInterface $input, OutputInterface $output)
        {
            $aData = array();
            // set colors and formats
            $oErrStyle  = new OutputFormatterStyle('red', null, array('bold'));
            $oOkStyle   = new OutputFormatterStyle('green', null, array('bold'));
            $oLogoStyle = new OutputFormatterStyle('cyan', null);
            $output->getFormatter()->setStyle('err', $oErrStyle);
            $output->getFormatter()->setStyle('ok', $oOkStyle);
            $output->getFormatter()->setStyle('sw', $oLogoStyle);

            // print logo
            $this->_printLogo($output);


            // Get active remote apps
            $aRemoteApps = RemoteAppQuery::create()->findByActivated(true);
            /** @var RemoteApp $oRemoteApp */
            $iCnt       = 0;
            foreach ($aRemoteApps as $oRemoteApp) {
                // get cron string
                $aData[] = array(
                    $oRemoteApp->getId(),
                    $oRemoteApp->getName(),
                    $oRemoteApp->getLastRun()->format("d.m.Y H:i:s"),
                );
                $iCnt++;
            }

            // get tablehelper for cli
            $oTable = $this->getHelper('table');
            $oTable
                ->setHeaders(array('ID', 'Title', 'Lastrun'))
                ->setRows($aData)
            ;
            $oTable->render($output);

            // green text
            $output->writeln("\n<fg=white;options=bold>     " . $iCnt . " Job(s) found</fg=white;options=bold>\n");

        }
534591
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $container = $this->getApplication()->getContainer();
        $container->configure();

        $classname = $input->getArgument('class');
        $method = $input->getArgument('method');

        if (!$this->confirm($input, $classname, $method)) {
            return;
        }

        $resource = $container->get('locator.resource_manager')->createResource($classname);

        $container->get('code_generator')->generate($resource, 'specification_method', [
            'method' => $method,
            'type' => $this->confirmMethodType($input, $output),
        ]);
    }
1169993
protected function execute(InputInterface $oInput, OutputInterface $oOutput)
    {
        parent::execute($oInput, $oOutput);

        $oOutput->writeln('');
        $oOutput->writeln('<info>--------------------</info>');
        $oOutput->writeln('<info>Nails Routes Rewrite</info>');
        $oOutput->writeln('<info>--------------------</info>');
        $oOutput->writeln('');

        $oRoutesService = Factory::service('Routes');

        try {
            if (!$oRoutesService->update(null, $oOutput)) {
                throw new NailsException($oRoutesService->lastError());
            }
        } catch (\Exception $e) {
            $this->abort(
                static::EXIT_CODE_FAILURE,
                [
                    'There was a problem writing the routes.',
                    $e->getMessage(),
                ]
            );
        }

        //  Cleaning up
        $oOutput->writeln('');
        $oOutput->writeln('<comment>Cleaning up...</comment>');

        //  And we're done!
        $oOutput->writeln('');
        $oOutput->writeln('Complete!');

        return static::EXIT_CODE_SUCCESS;
    }
1188387
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;
        $io = new SymfonyStyle($input, $output);

        $config = $this->getConfigHelper()->load($input);
        $typeMap = TypeMap::fromMetadata(
            $config->getTypeNamespace(),
            $config->getEngine()->getMetadata()->getTypes()
        );

        $generator = new ClassMapGenerator(
            $config->getRuleSet(),
            $config->getClassMapName(),
            $config->getClassMapNamespace()
        );
        $path = $config->getClassMapDestination().DIRECTORY_SEPARATOR.$config->getClassMapName().'.php';
        $this->handleClassmap($generator, $typeMap, $path);

        $io->success('Generated classmap at ' . $path);
    }
136572
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $start = microtime(true);
        $style = new SymfonyStyle($input, $output);
        $style->setDecorated(true);
        $style->title($this->description);

        $util = new Util();
        $source = $util->checkSource($input);
        if ($input->getOption('diff')) {
            $source = $util->getDiffSource();
        }

        $sources = $this->getAllFiles(explode(' ', $source));
        $exitCode = 0;
        $columnSize = 80;
        $errors = '';
        foreach ($sources as $line => $source) {
            if (($line % $columnSize) == 0) {
                $style->newLine();
            }

            $cmd = 'php -l '.$source;
            $process = new Process($cmd);
            $process->setTimeout(3600)->run(function ($type, $buffer) use ($style, &$errors) {
                if (strpos($buffer, 'No syntax errors') !== false || Process::ERR == $type) {
                    $style->write('.');

                    return;
                }

                $style->write('<error>E</>');
                $errors = $buffer;
            });

            if (!$exitCode) {
                $exitCode = $process->getExitCode();
            }
        }

        $end = microtime(true);
        $time = round($end - $start);

        $style->newLine();
        $output->write($errors);
        $style->newLine();

        $style->section('Results');
        $output->writeln('<info>Command: php -l FILE</>');
        $output->writeln('<info>Files: '.count($sources).'</>');
        $output->writeln('<info>Time: '.$time.' seconds</>');
        $style->newLine();

        return $exitCode;
    }
310074
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->injectOutputIntoLogger($output, $this->logger);
        $adapter = $this->databaseImportExportAdapterManager->getAdapter($input->getOption('adapter'));
        $adapter->setLogger($this->logger);

        $database = $input->getArgument('database');
        $filename = $input->getArgument('filename');

        $this->logger->info("Importing \"$filename\" into database \"$database\".");
        $adapter->importFromFile(
            $filename,
            $database,
            [] // This command does not yet support any options
        );
        $this->logger->info("\"$filename\" imported into database \"$database\".");
        return 0;
    }
1351511
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->injectOutputIntoLogger($output, $this->logger);
        $source = $input->getArgument('source');
        $destination = $input->getArgument('destination');
        // @todo Add config options like whether to overwrite files. Not sure which go here vs. the filesystem itself
        $this->mountManager->copy($source, $destination);
        return 0;
    }
370118
public function run(InputInterface $input, OutputInterface $output): int
    {
        $command = (string) $input;
        $command = strtr($command, [
            ' -name' => ' -N',
            ' -type' => ' -T',
            ' -maxdepth' => ' -M',
            ' -delete' => ' -d true',
        ]);

        return parent::run(new StringInput($command), $output);
    }
749200
protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $output->writeln('phpDocumentor ' . $this->getApplication()->getVersion());
        $output->writeln('');

        $this->observeProgressToShowProgressBars($output);

        $pipeLine = $this->pipeline;
        $pipeLine($input->getOptions());

        if ($output->getVerbosity() === OutputInterface::VERBOSITY_DEBUG) {
            file_put_contents('ast.dump', serialize($this->projectDescriptorBuilder->getProjectDescriptor()));
        }

        $output->writeln('');
        $output->writeln('All done!');

        return 0;
    }
347975
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->setInputAndOutput($input, $output);

        return $this->doExecute();
    }
19439
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new SymfonyStyle($input, $output);
        $aliasId = $input->getArgument('aliasId');
        $limit = 20;

        $objectManager = $this->getContainer()->get('object_manager');
        $siteClass = $this->getContainer()->getParameter('open_orchestra_model.document.site.class');
        $nodeClass = $this->getContainer()->getParameter('open_orchestra_model.document.node.class');

        $site = $objectManager->getRepository($siteClass)
            ->findOneBy(array(
                'aliases.'.$aliasId => array('$exists' => true)
                )
            );

        if($site instanceof $siteClass) {
            $aliases = $site->getAliases();
            if ($aliases->containsKey($aliasId)) {
                $siteId = $site->getSiteId();
                $language = $aliases[$aliasId]->getLanguage();
                $lastAlias = true;
                foreach ($aliases as $key => $alias) {
                    if ($alias->getLanguage() == $language && $key != $aliasId) {
                        $lastAlias = false;
                    }
                }
            }

            if ($lastAlias) {
                $io->comment('Remove use references of nodes');

                $deleteSiteTools = $this->getContainer()->get('open_orchestra_backoffice.command.orchestra_delete_site_tools');

                $nodes = $objectManager->createQueryBuilder($nodeClass)
                    ->field('siteId')->equals($siteId)
                    ->field('language')->equals($language)
                    ->getQuery()->execute();

                $usedInNodes = $deleteSiteTools->findUsageReferenceInOtherSite($siteId, $nodes);
                if (!empty($usedInNodes)) {
                    $io->section('Usage of nodes in other sites');
                    $deleteSiteTools->displayUsedReferences($io, $usedInNodes);
                    throw new \RuntimeException('You should remove usage of nodes before remove alias ' . $aliasId);
                }

                $count = count($nodes);

                for ($skip = 0; $skip < $count; $skip += $limit) {
                    $nodes = $objectManager->createQueryBuilder($nodeClass)
                        ->field('siteId')->equals($siteId)
                        ->field('language')->equals($language)
                        ->sort('id', 'asc')
                        ->skip($skip)
                        ->limit($limit)
                        ->getQuery()->execute();
                    foreach ($nodes as $node) {
                        $this->getContainer()->get('open_orchestra_backoffice.reference.manager')->removeReferencesToEntity($node);
                    }
                    $objectManager->clear();
                }

                $io->comment('Remove nodes');
                $objectManager->createQueryBuilder($nodeClass)
                    ->field('siteId')->equals($siteId)
                    ->field('language')->equals($language)
                    ->remove()->getQuery()->execute();
            }

            $site->removeAlias($aliases->get($aliasId));
            $objectManager->persist($site);
            $objectManager->flush();

        }
    }
565404
protected function execute(InputInterface $oInput, OutputInterface $oOutput)
    {
        parent::execute($oInput, $oOutput);

        $oOutput->writeln('');
        $oOutput->writeln('<info>--------------------</info>');
        $oOutput->writeln('<info>CDN Driver Migration</info>');
        $oOutput->writeln('<info>--------------------</info>');
        $oOutput->writeln('');

        $oStorageDriver = Factory::service('StorageDriver', 'nails/module-cdn');
        $sDriver        = $oInput->getArgument('driver');
        $bOverwrite     = $oInput->getOption('overwrite');
        $bRemove        = $oInput->getOption('remove-src');
        $aAllDrivers    = $oStorageDriver->getAll();

        //  Auto-detect the driver if not specified
        if (empty($sDriver)) {
            $oEnabledDriver = $oStorageDriver->getEnabled();
            if (empty($oEnabledDriver)) {
                throw new NailsException('No CDN drivers are enabled');
            } else {
                $sDriver = $oEnabledDriver->slug;
            }
        }

        //  Validate driver
        $aDrivers    = [];
        $aDriversOld = [];
        foreach ($aAllDrivers as $oDriver) {
            $aDrivers[$oDriver->slug] = $oDriver;
            if ($oDriver->slug != $sDriver) {
                $aDriversOld[$oDriver->slug] = $oDriver;
            }
        }

        if (!array_key_exists($sDriver, $aDrivers)) {
            throw new NailsException('"' . $sDriver . '" is not a valid storage driver.');
        }

        // --------------------------------------------------------------------------

        //  Work out what's going to happen
        $oObjectModel = Factory::model('Object', 'nails/module-cdn');

        //  How many objects are already migrated
        $iMigrated = $oObjectModel->countAll([
            'where' => [
                ['driver', $sDriver],
            ],
        ]);

        //  How many objects will be migrated
        $iToMigrate = $oObjectModel->countAll([
            'where_in' => [
                ['driver', array_keys($aDriversOld)],
            ],
        ]);

        //  How many objects which need to be migrated but won't be
        $iCannotMigrate = $oObjectModel->countAll([
            'where_not_in' => [
                ['driver', array_keys($aDrivers)],
            ],
        ]);

        //  Summarise for the user and seek confirmation
        $oOutput->writeln('');
        $oOutput->writeln('Migrate CDN objects to <info>' . $sDriver . '</info>');
        $oOutput->writeln('');
        if ($iToMigrate) {
            $oOutput->writeln('- <info>' . $iToMigrate . '</info> objects will be migrated');
            $oOutput->writeln('- <info>' . $iMigrated . '</info> objects already exist and will not be migrated');
            if (!empty($iCannotMigrate)) {
                $oOutput->writeln(
                    '- <info>' . $iCannotMigrate . '</info> objects cannot be migrated as their driver is not available'
                );
            }

            if ($bOverwrite) {
                $oOutput->writeln('- <fg=red;options=bold>Target overwriting is enabled</>');
            }

            if ($bRemove) {
                $oOutput->writeln('- <fg=red;options=bold>The original file will be deleted</>');
            }

            $oOutput->writeln('');
            if ($this->confirm('Continue?', true)) {
                $oOutput->writeln('<comment>Migrating...</comment>');
                $this->doMigrate($sDriver, $bOverwrite, $bRemove, $aDriversOld);
            } else {
                $oOutput->writeln('');
                $oOutput->writeln('Aborting Migration');
            }

        } else {
            $oOutput->writeln('There are no objects requiring migration.');
        }

        // --------------------------------------------------------------------------

        //  Cleaning up
        $oOutput->writeln('');
        $oOutput->writeln('<comment>Cleaning up...</comment>');

        //  And we're done!
        $oOutput->writeln('');
        $oOutput->writeln('Complete!');
    }
821227
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = new SymfonyOutput($output);

        $this->input = $input;

        if (method_exists($this, 'handle')) {
            $this->handle();
        }
    }
922936
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $inputFile = $input->getArgument('input-file');
        $outputFile = $input->getArgument('output-file');

        if ($outputFile === null) {
            $outputFile = preg_replace('/\\.[^.]*$/', '.php', $inputFile);
        }

        $parserGenerator = new ParserGenerator(new PegFile());

        $output = "<?php\n\n" . $parserGenerator->createClass($inputFile);

        file_put_contents($outputFile, $output);
    }