Adds the caching mechanism to the dependency injection container with key 'descriptor.cache'.

@param Application $app

@return void
543996
protected function addCache(Application $app)
    {
        $app['descriptor.cache'] = $app->share(
            function () {
                $cache = new Filesystem();
                $cache->setOptions(
                    array(
                         'namespace' => 'phpdoc-cache',
                         'cache_dir' => sys_get_temp_dir(),
                    )
                );
                $plugin = new SerializerPlugin();

                if (extension_loaded('igbinary')) {
                    $options = new PluginOptions();
                    $options->setSerializer('igbinary');

                    $plugin->setOptions($options);
                }

                $cache->addPlugin($plugin);

                return $cache;
            }
        );
    }
901976
protected function startBindingsPlugin($app)
    {
        /* @var \Illuminate\Foundation\Application $app */
        $this->requiresPlugins(Commands::class, Events::class);

        $this->onRegister('bindings', function (Application $app) {

            // Container bindings and aliases
            $legacy = ! class_exists('Illuminate\Foundation\Application') || version_compare(\Illuminate\Foundation\Application::VERSION, '5.7.0', '<');
            if ($legacy) {
                foreach ($this->bindings as $binding => $class) {
                    $this->app->bind($binding, $class);
                }
            }

            foreach ($this->weaklings as $binding => $class) {
                $this->bindIf($binding, $class);
            }

            foreach ([ 'share' => $this->share, 'shared' => $this->shared ] as $type => $bindings) {
                foreach ($bindings as $binding => $class) {
                    $this->share($binding, $class, [], $type === 'shared');
                }
            }

            if ($legacy) {
                foreach ($this->singletons as $binding => $class) {
                    if ($this->strict && ! class_exists($class) && ! interface_exists($class)) {
                        throw new \Exception(get_called_class() . ": Could not find alias class [{$class}]. This exception is only thrown when \$strict checking is enabled");
                    }
                    $this->app->singleton($binding, $class);
                }
            }

            foreach ($this->aliases as $alias => $full) {
                if ($this->strict && ! class_exists($full) && ! interface_exists($full)) {
                    throw new \Exception(get_called_class() . ": Could not find alias class [{$full}]. This exception is only thrown when \$strict checking is enabled");
                }
                $this->app->alias($alias, $full);
            }
        });
    }
1297222
public function register(Application $app)
    {
        if (!isset($app['descriptor.builder'])) {
            throw new Exception\MissingDependencyException(
                'The builder object that is used to construct the ProjectDescriptor is missing'
            );
        }

        $app['parser'] = $app->share(
            function ($app) {
                $parser = new Parser();
                $parser->setStopwatch($app['kernel.stopwatch']);
                $parser->setLogger($app['monolog']);

                return $parser;
            }
        );

        $app['markdown'] = $app->share(
            function () {
                return \Parsedown::instance();
            }
        );

        /** @var Translator $translator  */
        $translator = $app['translator'];
        $translator->addTranslationFolder(__DIR__ . DIRECTORY_SEPARATOR . 'Messages');

        $app['parser.files'] = new Collection();
        $app->command(new ParseCommand($app['descriptor.builder'], $app['parser'], $translator, $app['parser.files']));
    }
308621
public function setInstance(Container $app)
    {
        $app->instance('app', $app);
        $app->instance(Container::class, $app);

        if ($this->framework === 'lumen') {
            $app->instance(LumenApplication::class, $app);
        }

        Container::setInstance($app);
        Context::setApp($app);
        Facade::clearResolvedInstances();
        Facade::setFacadeApplication($app);
    }
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();
        };
    }
1361121
protected function setThemeResolver(Application $app)
    {
        if ($app->resolved('view')) {
            $app->make('antares.theme')->resolving();
        } else {
            $app->resolving('view', function () use ($app) {
                $app->make('antares.theme')->resolving();
            });
        }
    }
1354977
public function register(Container $app)
    {
        $app[DataInterface::class] = $app->factory(Data::class);
        $app[ConfigInterface::class] = $app->factory(FileConfig::class);
    }
285237
public function setApp(Application $app)
    {
        $this->app = $app;
        AppSingleton::set($app);
        $this->pathResolver = $app['path_resolver'];

        // if RM is passed directly into Application c.v.a won't be set
        // but if called later then we don't want to override the value if someone else has changed it,
        // unless disableApacheChecks has been called.
        $default = true;
        if (isset($this->app['config.validator.apache_enabled'])) {
            $default = $this->app['config.validator.apache_enabled'];
        }
        $this->app['config.validator.apache_enabled'] = function () use ($default) {
            return $this->disableApacheChecks ? false : $default;
        };
    }
223315
public function register(Application $app)
    {
        parent::register($app);
        $app['cache'] = $app->share(function ($app) {
            $config = $app['config'];
            if (! array_key_exists('cache.driver', $config)) {
                return new ArrayCache();
            }
            switch ($config['cache.driver']) {
                case 'array':
                    return new ArrayCache();
                case 'redis':
                    $cache = new RedisCache();
                    if (isset($config['cache.redis'])) {
                        $redis = new \Redis();
                        $redis->connect($config['cache.redis']['host'], $config['cache.redis']['port']);
                        $cache->setRedis($redis);
                    } else {
                        $cache->setRedis($app['redis']);
                    }
                    return $cache;
                case 'xcache':
                    return new XcacheCache();
                default:
                    throw new \RuntimeException('Unknown cache driver: '.$config['cache.driver']);
            }
        });
    }
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();
        });
    }
1303205
public function boot(Application $app)
    {
        $app->on(KernelEvents::EXCEPTION, function (GetResponseForExceptionEvent $event) {
            $e = $event->getException();
            if ($e instanceof MethodNotAllowedHttpException && $e->getHeaders()["Allow"] === "OPTIONS") {
                $event->setException(new NotFoundHttpException("No route found for \"{$event->getRequest()->getMethod()} {$event->getRequest()->getPathInfo()}\""));
            }
        });
    }
1189830
public function beforeRequest(Request $request, Application $app)
    {
        $this->root = $request->attributes->get('_root');
    }
688259
public function boot(Application $app)
    {
        if ($app['capsule.options']['bootEloquent']) {
            $app->before(function () use ($app) {
                $app['capsule'];
            }, Application::EARLY_EVENT);
        }
    }
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);
            }
        }
    }
938017
public function resetApp(Container $app)
    {
        foreach ($this->resetters as $resetter) {
            $resetter->handle($app, $this);
        }
    }
602524
public function boot(Application $app)
    {
        foreach ($app['alchemy_queues.queues'] as $name => $configuration) {
            /** @var MessageQueueRegistry $targetRegistry */
            $targetRegistry = $app['alchemy_queues.registry'];

            if (isset($configuration['registry'])) {
                $targetRegistry = $app[$configuration['registry']];
            }

            $targetRegistry->bindConfiguration($name, $configuration);
        }
    }
1268395
public function initialize(ApplicationInterface $application)
    {

        /** @var \AppserverIo\Appserver\Core\DgClassLoader $dgClassLoader */
        $dgClassLoader = $application->search('DgClassLoader');

        // if we did not get the correct class loader our efforts are for naught
        if (!$dgClassLoader instanceof DgClassLoader) {
            $application->getInitialContext()->getSystemLogger()->warning(
                sprintf(
                    'Application %s uses the aspect manager but does not have access to the required Doppelgaenger class loader, AOP functionality will be omitted.',
                    $application->getName()
                )
            );
            return;
        }

        // register the aspects and tell the class loader it can fill the cache
        $this->registerAspects($application);

        // inject the filled aspect register and create the cache based on it
        $dgClassLoader->injectAspectRegister($this->getAspectRegister());
        $dgClassLoader->createCache();
    }