Adds the services needed to build the descriptors.

@param Application $app An Application instance

@return void
433368
public function register(Application $app)
    {
        $app['parser.example.finder'] = new Example\Finder();

        $this->addCache($app);
        $this->addAssemblers($app);
        $this->addFilters($app);
        $this->addValidators($app);
        $this->addBuilder($app);

        // I would prefer to extend it but due to a circular reference will pimple fatal
        $this->attachFiltersToManager($app['descriptor.filter'], $app);

        $app['descriptor.analyzer'] = function () {
            return new ProjectAnalyzer();
        };
    }
1163382
protected function addCommands(Application $app)
    {
        $app->command(
            new Command\Manual\ToHtmlCommand(null, $app[self::TEMPLATE_FACTORY], $app[self::CONVERTER_FACTORY])
        );

        // FIXME: Disabled the ToLatex and ToPdf commands for now to prevent confusion of users.
        // $this->command(new \phpDocumentor\Plugin\Scrybe\Command\Manual\ToLatexCommand());
        // $this->command(new \phpDocumentor\Plugin\Scrybe\Command\Manual\ToPdfCommand());
    }
1309819
protected function registerFactory(Application $app)
    {
        $app->singleton('opensearch.factory', function ($app) {
            return new Factories\OpensearchFactory();
        });
        $app->alias('opensearch.factory', 'Orzcc\Opensearch\Factories\OpensearchFactory');
    }
368059
public function register(Application $app)
    {
        if ($this->registered) {
            throw new \RuntimeException('Can not re-register extensions.');
        }
        foreach ($this->extensions as $extension) {
            if ($extension->isEnabled() !== true) {
                continue;
            }
            $extension->getInnerExtension()->setContainer($app);
            foreach ($extension->getInnerExtension()->getServiceProviders() as $provider) {
                $app->register($provider);
            }
        }
        $this->registered = true;

        // @deprecated Deprecated since 3.0, to be removed in 4.0.
        $this->app = $app;
    }
712603
public function run(Application $app)
    {
        $this->trigger(self::EVENT_BEFORE_RUN);
        if (count($this->_afterCallbacks) > 0) {
            $this->runCommandInForeground($app);
        } else {
            $this->runCommandInBackground($app);
        }
        $this->trigger(self::EVENT_AFTER_RUN);
    }
1089834
public function boot(Application $app)
    {

        // Register our filters to use
        if (isset($app['assetic.filters']) && is_callable($app['assetic.filters'])) {
            $app['assetic.filters']($app['assetic.filter_manager']);
        }

        /**
         * Writes down all lazy asset manager and asset managers assets
         */
        $app->after(function () use ($app) {
            // Boot assetic
            $assetic = $app['assetic'];

            if (!isset($app['assetic.options']['auto_dump_assets']) ||
                !$app['assetic.options']['auto_dump_assets']) {
                return;
            }
            $helper = $app['assetic.dumper'];
            if (isset($app['twig'])) {
                $helper->addTwigAssets();
            }
            $helper->dumpAssets();
        });
    }
1147240
public function bootstrap(Application $app)
    {
        try
        {
            Dotenv::makeMutable();
            Dotenv::load($app->environmentPath(), $app->environmentFile());
            Dotenv::makeImmutable();
        } catch (InvalidArgumentException $e)
        {
            //
        }

        $app->detectEnvironment(
            function ()
            {
                return env('APP_ENV', 'production');
            }
        );
    }
95834
public function bootstrap(Application $app)
    {
        $this->app = $app;

        error_reporting(-1);

        set_error_handler([$this, 'handleError']);

        set_exception_handler([$this, 'handleException']);

        register_shutdown_function([$this, 'handleShutdown']);

        if (! $app->environment('testing')) {
            ini_set('display_errors', 'Off');
        }
    }
610155
public function bootstrap(Application $app)
    {
        if ($app->configurationIsCached()) {
            return;
        }

        $this->checkForSpecificEnvironmentFile($app);
        try {
            (new Dotenv($app->environmentPath(), $app->environmentFile()))->load();
        } catch (InvalidPathException $e) {
            //
        }
    }
716684
public function boot(Application $app)
    {
        $config = $app['config'];
        if (isset($config['orm.subscribers'])) {
            $app->extend('db.event_manager', function($eventMgr) use($app, $config) {
                /** @var EventManager $eventMgr */
                foreach ($config['orm.subscribers'] as $class) {
                    if (isset($app[$class])) {
                        $eventMgr->addEventSubscriber($app[$class]);
                    } else {
                        $eventMgr->addEventSubscriber(new $class());
                    }
                }
                return $eventMgr;
            });
        }
    }
196594
public function extend(Container $app)
    {
        foreach ($this->getEnabledExtensions() as $extension) {
            $extension->extend($app);
        }
    }
802221
public function register(Application $app)
    {
        /** @var Translator $translator  */
        $translator = $app['translator'];
        $translator->addTranslationFolder(__DIR__ . DIRECTORY_SEPARATOR . 'Messages');

        /** @var ApplicationConfiguration $config */
        $config = $app['config'];

        $partialsCollection = new PartialsCollection($app['markdown']);
        $app['partials'] = $partialsCollection;

        /** @var Partial[] $partials */
        $partials = $config->getPartials();
        if ($partials) {
            foreach ($partials as $partial) {
                if (! $partial->getName()) {
                    throw new Exception\MissingNameForPartialException('The name of the partial to load is missing');
                }

                $content = '';
                if ($partial->getContent()) {
                    $content = $partial->getContent();
                } elseif ($partial->getLink()) {
                    if (! is_readable($partial->getLink())) {
                        $app['monolog']->error(
                            sprintf($translator->translate('PPCPP:EXC-NOPARTIAL'), $partial->getLink())
                        );
                        continue;
                    }

                    $content = file_get_contents($partial->getLink());
                }
                $partialsCollection->set($partial->getName(), $content);
            }
        }
    }
1317946
private function initializeConfig(Application $app)
    {
        $config_provider = $app->make('Concrete\Core\Config\ConfigServiceProvider');
        $config_provider->register();

        /*
         * @var \Concrete\Core\Config\Repository\Repository
         */
        $config = $app->make('config');

        return $config;
    }
990443
protected function callAfterCallbacks(Application $app)
    {
        foreach ($this->_afterCallbacks as $callback) {
            call_user_func($callback, $app);
        }
    }
529854
final protected function resolveApplicationBindings($app): void
    {
        foreach ($this->overrideApplicationBindings($app) as $original => $replacement) {
            $app->bind($original, $replacement);
        }
    }
688744
public function register(Application $app)
    {
        foreach ($this->services as $key => $class) {
            if (is_numeric($key)) {
                $key = $class;
            }
            $app[$key] = $app->share(function() use ($class, $app) {
                $result = new $class();
                $app->initialize($result);
                return $result;
            });
        }

        if (!empty($this->doctrineEventSubscribers)) {
            $config = $app['config'];
            foreach ($this->doctrineEventSubscribers as $class) {
                $config['orm.subscribers'][] = $class;
            }
        }

        if (!empty($this->entityFolders)) {
            if (!isset($config)) {
                $config = $app['config'];
            }
            foreach ($this->entityFolders as $namespace => $path) {
                $config['orm.options']['orm.em.options']['mappings'][] = [
                    'type' => 'annotation',
                    'namespace' => $namespace,
                    'path' => $path,
                    'use_simple_annotation_reader' => false,
                ];
            }
        }

        if (isset($config)) {
            $app['config'] = $config;
        }

        if (php_sapi_name() === 'cli' && !empty($this->commands)) {
            $app['base_commands'] = $app->extend('base_commands', function(array $commands) {
                return array_merge($commands, $this->commands);
            });
        }
    }
940431
public function refreshApplication($app = null)
    {
        $this->app = $app instanceof Application ? $app : $this->createApplication();
    }