@param ContainerInterface $container
@param IoInterface        $inOut

@return void

@throws ContainerExceptionInterface
@throws NotFoundExceptionInterface
518753
private function executeConnect(ContainerInterface $container, IoInterface $inOut): void
    {
        assert($container->has(CommandStorageInterface::class));
        /** @var CommandStorageInterface $commandStorage */
        $commandStorage = $container->get(CommandStorageInterface::class);

        $commandClasses = [];
        foreach ($commandStorage->getAll() as $commandClass) {
            if (class_exists($commandClass) === false ||
                array_key_exists(CommandInterface::class, class_implements($commandClass)) === false
            ) {
                $inOut->writeWarning("Class `$commandClass` either do not exist or not a command class." . PHP_EOL);
                continue;
            }

            $inOut->writeInfo("Found command class `$commandClass`." . PHP_EOL, IoInterface::VERBOSITY_VERBOSE);

            $commandClasses[] = $this->commandClassToArray($commandClass);
        }

        if (empty($commandClasses) === false) {
            $now           = date(DATE_RFC2822);
            $data          = var_export($commandClasses, true);
            $content       = <<<EOT
<?php

// THIS FILE IS AUTO GENERATED. DO NOT EDIT IT MANUALLY.
// Generated at: $now

    return $data;

EOT;
            $cacheFilePath = $this->getCommandsCacheFilePath($this->getComposer());
            if (empty($cacheFilePath) === true) {
                $inOut->writeError("Commands cache file path is not set. Check your `Application` settings." . PHP_EOL);

                return;
            }

            $this->getFileSystem($container)->write($cacheFilePath, $content);

            $inOut->writeInfo('Commands connected.' . PHP_EOL);

            return;
        }

        $inOut->writeWarning('No commands found.' . PHP_EOL);
    }
797197
public function setContainer(ContainerInterface $container)
    {
        $application = $this;
        $container->share(ApplicationInterface::class, $application);
        $container->share(\Interop\Container\ContainerInterface::class, $container);

        $this->container = $container;

        return $this;
    }
559533
protected function executeSeedInit(ContainerInterface $container, string $seedClass): void
    {
        if ($this->seedInit !== null) {
            call_user_func($this->seedInit, $container, $seedClass);
        }
    }
843189
protected function run(ContainerInterface $container, IoInterface $inOut): void
    {
        $arguments = $inOut->getArguments();
        $options   = $inOut->getOptions();

        /** @var SettingsProviderInterface $provider */
        $provider = $container->get(SettingsProviderInterface::class);
        $settings = $provider->get(DataSettings::class);

        $path   = $options[static::OPT_PATH] ?? false;
        $action = $arguments[static::ARG_ACTION];
        switch ($action) {
            case static::ACTION_MIGRATE:
                $path = $path !== false ? $path : $settings[DataSettings::KEY_MIGRATIONS_LIST_FILE] ?? '';
                $this->createMigrationRunner($inOut, $path)->migrate($container);
                break;
            case static::ACTION_ROLLBACK:
                $path = $path !== false ? $path : $settings[DataSettings::KEY_MIGRATIONS_LIST_FILE] ?? '';
                $this->createMigrationRunner($inOut, $path)->rollback($container);
                break;
            case static::ACTION_SEED:
                $path     = $path !== false ? $path : $settings[DataSettings::KEY_SEEDS_LIST_FILE] ?? '';
                $seedInit = $settings[DataSettings::KEY_SEED_INIT] ?? null;
                $this->createSeedRunner($inOut, $path, $seedInit)->run($container);
                break;
            default:
                $inOut->writeError("Unsupported action `$action`." . PHP_EOL);
                break;
        }
    }
138880
private function initAdmingeneratorClassLoader(ContainerInterface $container)
    {
        if (!$this->classLoaderInitialized) {
            $this->classLoaderInitialized = true;

            $AdmingeneratedClassLoader = new AdmingeneratedClassLoader();
            $AdmingeneratedClassLoader->setBasePath($container->getParameter('kernel.cache_dir'));
            $AdmingeneratedClassLoader->register();
        }
    }
998775
protected function execute(InputInterface $oInput, OutputInterface $oOutput)
    {
        parent::execute($oInput, $oOutput);

        $oOutput->writeln('');
        $oOutput->writeln('<info>----------------------</info>');
        $oOutput->writeln('<info>Nails Database Rebuild </info>');
        $oOutput->writeln('<info>----------------------</info>');
        $oOutput->writeln('');

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

        //  Check environment
        if (Environment::is(Environment::ENV_PROD)) {

            $oOutput->writeln('--------------------------------------');
            $oOutput->writeln('| <info>WARNING: The app is in PRODUCTION.</info> |');
            $oOutput->writeln('--------------------------------------');
            $oOutput->writeln('');
            $oOutput->writeln('Aborting rebuild.');

            return static::EXIT_CODE_FAILURE;
        }

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

        //  Work out the DB credentials to use
        $sDbHost = $oInput->getOption('dbHost') ?: (defined('DEPLOY_DB_HOST') ? DEPLOY_DB_HOST : '');
        $sDbUser = $oInput->getOption('dbUser') ?: (defined('DEPLOY_DB_USERNAME') ? DEPLOY_DB_USERNAME : '');
        $sDbPass = $oInput->getOption('dbPass') ?: (defined('DEPLOY_DB_PASSWORD') ? DEPLOY_DB_PASSWORD : '');
        $sDbName = $oInput->getOption('dbName') ?: (defined('DEPLOY_DB_DATABASE') ? DEPLOY_DB_DATABASE : '');

        //  Check we have a database to connect to
        if (empty($sDbName)) {
            return $this->abort(static::EXIT_CODE_NO_DB);
        }

        //  Get the DB object
        $oDb = Factory::service('PDODatabase');
        $oDb->connect($sDbHost, $sDbUser, $sDbPass, $sDbName);

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

        //  Which tables are we going to drop; all those which match our prefixes
        $oDb      = Factory::service('PDODatabase');
        $oResult  = $oDb->query('SHOW TABLES');
        $aResults = $oResult->fetchAll(\PDO::FETCH_OBJ);
        $aTables  = [];
        foreach ($aResults as $aResult) {
            $sTable = reset($aResult);
            if (preg_match('/^(' . NAILS_DB_PREFIX . '|' . APP_DB_PREFIX . ')/', $sTable)) {
                $aTables[] = $sTable;
            }
        }

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

        $oOutput->writeln('The following database tables will be dropped, and migrations run.');
        $oOutput->writeln('');
        foreach ($aTables as $sTable) {
            $oOutput->writeln(' - <comment>' . $sTable . '</comment>');
        }
        $oOutput->writeln('');

        if ($this->confirm('Continue?', true)) {
            $oOutput->writeln('');
            $oOutput->write('Dropping tables... ');
            $oDb->query('SET FOREIGN_KEY_CHECKS = 0;');
            foreach ($aTables as $sTable) {
                $oDb->query('DROP TABLE IF EXISTS `' . $sTable . '`;');
            }
            $oDb->query('SET FOREIGN_KEY_CHECKS = 1;');
            $oOutput->writeln('<info>done!</info>');
            $oOutput->write('Migrating database... ');
            $iExitCode = $this->callCommand(
                'db:migrate',
                [
                    '--dbHost' => $sDbHost,
                    '--dbUser' => $sDbUser,
                    '--dbPass' => $sDbPass,
                    '--dbName' => $sDbName,
                ],
                false,
                true
            );

            if ($iExitCode == static::EXIT_CODE_SUCCESS) {
                $oOutput->writeln('<info>done!</info>');
            } else {
                $oOutput->writeln('<error>fail!</error>');
                return $this->abort(
                    self::EXIT_CODE_FAILURE,
                    [
                        'The Migration tool encountered issues and aborted the migration.',
                        'You should run it manually and investigate any issues.',
                        'The exit code was ' . $iExitCode,
                    ]
                );
            }
        }

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

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

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

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

        return static::EXIT_CODE_SUCCESS;
    }
462491
public function execute(InputInterface $input, OutputInterface $output)
    {
        $inOut     = $this->wrapIo($input, $output);
        $container = $this->createContainer($this->getComposer(), static::NAME);

        $argAction = static::ARG_ACTION;
        $action    = $inOut->getArgument($argAction);
        switch ($action) {
            case static::ACTION_CONNECT:
                $this->executeConnect($container, $inOut);
                break;
            case static::ACTION_CREATE:
                $this->executeCreate($container, $inOut);
                break;
            default:
                $inOut->writeError("Unknown value `$action` for argument `$argAction`." . PHP_EOL);
                break;
        }
    }
927131
static public function run(ContainerInterface $container)
    {
        $request = ServerRequestFactory::fromGlobals();
        $response = $container->get('HttpDispatcher')->dispatch($request);
        (new SapiEmitter())->emit($response);
    }
869200
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $context = json_decode($input->getOption('context') ?: '{}', true);
        $context['tenant_id'] = (string)$input->getOption('tenant-id');

        $io = new SymfonyStyle($input, $output);
        $io->title('EventStore Storage Describer');
        $io->comment(sprintf('context: %s', json_encode($context)));

        $details = $this->getPbjx()->getEventStore()->describeStorage($context);
        $io->text($details);
        $io->newLine();
    }
175187
protected function initialize(InputInterface $input, OutputInterface $output)
    {
        $this->getApplication()->getDispatcher()->dispatch(
            GushEvents::INITIALIZE,
            new ConsoleCommandEvent($this, $input, $output)
        );
    }
691400
protected function executeCache(ContainerInterface $container, IoInterface $inOut): void
    {
        assert($inOut);

        $appConfig     = $this->getApplicationConfiguration($container);
        $cacheDir      = $appConfig[ApplicationConfigurationInterface::KEY_CACHE_FOLDER];
        $cacheCallable = $appConfig[ApplicationConfigurationInterface::KEY_CACHE_CALLABLE];
        list ($namespace, $class, $method) = $this->parseCacheCallable($cacheCallable);
        if ($class === null || $namespace === null || $method === null) {
            // parsing of cache callable failed (most likely error in settings)
            throw new ConfigurationException();
        }

        /** @var CacheSettingsProviderInterface $settingsProvider */
        $settingsProvider = $container->get(CacheSettingsProviderInterface::class);
        $settingsData     = $settingsProvider->serialize();
        $content          = $this->composeContent($settingsData, $namespace, $class, $method);

        $path = $cacheDir . DIRECTORY_SEPARATOR . $class . '.php';
        $this->getFileSystem($container)->write($path, $content);

        $inOut->writeInfo('Cache created.' . PHP_EOL);
        $inOut->writeInfo("Cache written to `$path`." . PHP_EOL, IoInterface::VERBOSITY_VERBOSE);
    }
1076970
public function build(ContainerInterface $container, BuildDataDefinitionEvent $event)
    {
        if (!$this->loadDca($container->getName(), $this->getDispatcher())) {
            return;
        }

        $this->parseCallbacks($container, $this->getDispatcher());
        $this->parseBasicDefinition($container);
        $this->parseDataProvider($container);
        $this->parseRootEntries($container);
        $this->parseParentChildConditions($container);
        $this->parseBackendView($container);
        $this->parsePalettes($container);
        $this->parseProperties($container);
        $this->parseOderPropertyInPalette($container);
    }
1192812
private static function injectContainerToMigrations(ContainerInterface $container, array $versions) : void
    {
        foreach ($versions as $version) {
            $migration = $version->getMigration();
            if (! ($migration instanceof ContainerAwareInterface)) {
                continue;
            }

            $migration->setContainer($container);
        }
    }
1010327
public void eInit(XtendTypeDeclaration container, String name, String modifier, IJvmTypeProvider context) {
		this.builder.eInit(container, name, modifier, context);
	}
708171
public function daemon(InputInterface $input, OutputInterface $output)
    {
        // Init services
        $container = $this->getContainer();

        if (is_null($this->dispatcher) && $container->has('event_dispatcher')) {
            $this->dispatcher = $this->getContainer()->get('event_dispatcher');
        }

        $this->loop = $container->get('m6_daemon_bundle.event_loop');

        // Last configuration
        $this->configureEvents();

        // Options
        $this->setShutdownOnException($input->hasOption('shutdown-on-exception') ? $input->getOption('shutdown-on-exception') : false);
        $this->setMemoryMax($input->hasOption('memory-max') ? $input->getOption('memory-max') : -1);
        $this->setShowExceptions($input->hasOption('show-exceptions') ? $input->getOption('show-exceptions') : false);

        if ($input->hasOption('run-once') && (bool) $input->getOption('run-once')) {
            $this->setLoopMax(1);
        } else {
            if ($input->hasOption('run-max')) {
                $this->setLoopMax($input->getOption('run-max'));
            }
        }

        // Ok starting...
        $this->dispatchEvent(DaemonEvents::DAEMON_START);

        // Setup
        $this->setup($input, $output);

        // General loop
        $this->dispatchEvent(DaemonEvents::DAEMON_LOOP_BEGIN);

        // First tick
        $this->loop->futureTick(function () use ($input, $output) {
            $this->loop($input, $output);
        });

        // Go !
        $this->loop->run();

        $this->dispatchEvent(DaemonEvents::DAEMON_LOOP_END);

        // Prepare for shutdown
        $this->tearDown($input, $output);
        $this->dispatchEvent(DaemonEvents::DAEMON_STOP);

        return $this->returnCode;
    }
1267863
public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
        $this->application = null !== $container ? $this->container->get('bbapp') : null;
    }
821227
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = new SymfonyOutput($output);

        $this->input = $input;

        if (method_exists($this, 'handle')) {
            $this->handle();
        }
    }