Call on all enabled extensions to extend the Flarum application.

@param Container $app
196594
public function extend(Container $app)
    {
        foreach ($this->getEnabledExtensions() as $extension) {
            $extension->extend($app);
        }
    }
145991
public function bootstrap(Application $app)
    {
        if (app('antares.installed')) {
            //app('antares.license.response')->validate();
        }
        $this->setCurrentTheme($app);
        $this->setThemeResolver($app);
    }
453972
protected function instantiateUploadAdapters(Container $app)
    {
        /** @var Settings $settings */
        $settings = $app->make(Settings::class);

        $settings->getMimeTypesConfiguration()
            ->each(function ($mimetype) use ($app, $settings) {
                $adapter = Arr::get($mimetype, 'adapter', $mimetype);

                // Skip if already bound.
                if ($app->bound("flagrow.upload-adapter.$adapter")) {
                    return;
                }

                $app->bind("flagrow.upload-adapter.$adapter", function () use ($settings, $adapter) {
                    switch ($adapter) {
                        case 'aws-s3':
                            if (class_exists(S3Client::class)) {
                                return $this->awsS3($settings);
                            }
                        case 'ovh-svfs':
                            if (class_exists(OVHClient::class)) {
                                return $this->ovh($settings);
                            }
                        case 'imgur':
                            return $this->imgur($settings);

                        default:
                            return $this->local($settings);
                    }
                });
            });
    }
606233
public function bootstrap(Container $app)
    {
        if (! $app->bound('composer')) {
            $composer = new \Composer\Autoload\ClassLoader();
            $composer->register(true);
            
            $app->instance('composer', $composer);
        }
        
        $composer = $app->make('composer');
        $themeDir = get_template_directory();
        
        $namespace = Str::studly(wp_get_theme()->Name) . '\\';
        $path = [];
        
        foreach (['lib', 'library'] as $directory) {
            $fullPath = $themeDir . '/' . $directory;
            
            if (file_exists($fullPath) && is_dir($fullPath)) {
                $path[] = $fullPath;
            }
        }
        
        $libcfg = $themeDir . '/.libcfg';
        
        if (file_exists($libcfg) && is_file($libcfg)) {
            $libcfg = array_filter(array_map('trim', explode(PHP_EOL, $cfg)));
            
            $path = array_merge($path, $libcfg);
        }
        
        $composer->addPsr4($namespace, $path);
    }
325895
protected function registerAutoloader($app)
    {
        // now configure a new autoloader spl configuration
        $autoloaderApp = new Doozr_Loader_Autoloader_Spl_Config();
        $autoloaderApp
            ->_namespace($app->namespace)
            ->namespaceSeparator('_')
            ->addExtension('php')
            ->path(substr($app->path, 0, -1))
            ->description('Autoloader for App classes with namespace: "'.$app->namespace.'"')
            ->priority(0);

        Doozr_Loader_Autoloader_Spl_Facade::attach([$autoloaderApp]);
    }
547533
protected function injectServices(Container $app)
    {
        if (isset($app['profiler'])) {
            $app['geocoder.logger'] = function($app) {
                return new \Geocoder\Logger\GeocoderLogger();
            };

            $app['geocoder'] = function($app) {
                $geocoder = new \Geocoder\LoggableGeocoder();
                $geocoder->setLogger($app['geocoder.logger']);
                $geocoder->registerProvider($app['geocoder.provider']);

                return $geocoder;
            };
        } else {
            $app['geocoder'] = function($app) {
                $geocoder = new \Geocoder\Geocoder();
                $geocoder->registerProvider($app['geocoder.provider']);

                return $geocoder;
            };
        }

        $app['geocoder.provider'] = function($app) {
            return new \Geocoder\Provider\FreeGeoIpProvider($app['geocoder.adapter']);
        };

        $app['geocoder.adapter'] = function($app) {
            return new \Geocoder\HttpAdapter\CurlHttpAdapter();
        };
    }
845997
public function ensureIlluminateBase(Container $app = null)
    {
        if (! $app->bound('events')) {
            $app->singleton('events', $this->illuminateClasses['events']);
            $app['events']->fire('booting');
        }

        if (! $app->bound('files')) {
            $app->bindIf('files', $this->illuminateClasses['files']);
        }
    }
307688
protected function checkDependencies(Container $app)
    {
        $dependencies = [
            'twig' => 'TwigServiceProvider',
            'session' => 'SessionServiceProvider',
            'translator' => 'TranslationServiceProvider',
            'validator' => 'ValidatorServiceProvider',
            'form.factory' => 'FormServiceProvider',
            'security.token_storage' => 'SecurityServiceProvider'
        ];

        if (!$app['resolver'] instanceof ServiceControllerResolver) {
            throw new LogicException('You must register the ServiceControllerServiceProvider to use the UserServiceProvider');
        }

        foreach ($dependencies as $key => $provider) {
            if (!isset($app[$key])) {
                throw new LogicException(sprintf('You must register the %s to use the UserServiceProvider', $provider));
            }
        }
    }
1251412
public function apply(Application $app)
    {
        $applied = [];

        foreach ($this->upgrades as $upgrade) {
            if ($upgrade->isApplyable($app)) {
                try {
                    $upgrade->apply(
                        $app['orm.em'],
                        $app['phraseanet.appbox'],
                        $app['doctrine-migration.configuration']
                    );
                    $applied[] = $upgrade;
                } catch (\Exception $e) {
                    $upgrade->rollback(
                        $app['orm.em'],
                        $app['phraseanet.appbox'],
                        $app['doctrine-migration.configuration']
                    );
                    foreach (array_reverse($applied) as $done) {
                        $done->rollback(
                            $app['orm.em'],
                            $app['phraseanet.appbox'],
                            $app['doctrine-migration.configuration']
                        );
                    }
                    throw $e;
                }
            }
        }
    }
868345
public function configure(Container $app): Pointcut
    {
        $interceptor = new LoggableInterceptor;
        $interceptor->setLogger($app[LoggerInterface::class]);
        $this->setInterceptor($interceptor);

        return $this->withAnnotatedAnyInterceptor();
    }
638902
public static function AddKernelCommands($app)
    {
        self::setKernelClasses();
        // die(var_dump(self::$kernelCommands));
        //
        foreach (self::$kernelCommands as $value) {
            $app->add(new $value());
        }
    }
1178479
public function bootstrap(Application $app)
	{
		Facade::clearResolvedInstances();

		Facade::setFacadeApplication($app);

		AliasLoader::getInstance($app['config']['app.aliases'])->register();
	}
529854
final protected function resolveApplicationBindings($app): void
    {
        foreach ($this->overrideApplicationBindings($app) as $original => $replacement) {
            $app->bind($original, $replacement);
        }
    }
166565
protected function addHtmlExtensions(Application $app)
    {
        $html = $app->make('html');

        $html->macro('title', function ($title = null) use ($html) {
            $builder = new Title($html, \memorize('site.name'), [
                'site' => \get_meta('html::title.format.site', '{site.name} (Page {page.number})'),
                'page' => \get_meta('html::title.format.page', '{page.title} &mdash; {site.name}'),
            ]);

            return $builder->title($title ?: \trim(\get_meta('title', '')));
        });
    }
537656
public function register(Container $app)
    {
        $app["slaxer.service"] = function (Container $app) {
            $cliApp = new CLIApp("Slaxer", "0.4.*-dev");

            if (isset($app["slaxerCommands"]) === false) {
                return $cliApp;
            }

            foreach ($app["slaxerCommands"] as $key => $value) {
                $params = [];
                if (is_int($key)) {
                    $command = $value;
                } else {
                    $command = $key;
                    if (is_string($value)) {
                        $value = [$value];
                    }
                    foreach ($value as $service) {
                        $params[] = $app[$service];
                    }
                }

                $cmd = new $command($app["logger.service"]("Slaxer"));
                if (method_exists($cmd, "init")) {
                    $cmd->init(...$params);
                }
                $cliApp->add($cmd);
            }

            return $cliApp;
        };
    }
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);
            }
        });
    }
74301
public function register(Container $app)
    {
        $this->kernel                        = $app;
        $app['request_matcher']              = $app->extend(
            'request_matcher',
            function ($urlMatcher, $c) {
                $context = $c['request_context'];
                
                $newMatcher = new GroupUrlMatcher(
                    $context,
                    [
                        new CacheableRouterUrlMatcherWrapper(
                            $this->getRouter($context)->getMatcher(),
                            $c['routing.config.namespaces']
                        ),
                        $urlMatcher,
                    ]
                );
                
                return $newMatcher;
            }
        );
        $app['url_generator']                = $app->extend(
            'url_generator',
            function ($generator, $kernel) {
                /** @var SilexKernel $kernel */
                
                /** @var RequestContext $context */
                //$context = $kernel['request_context'];
                /** @var Router $router */
                $router       = $kernel['router'];
                $newGenerator = $router->getGenerator();
                
                //$newGenerator = new UrlGenerator($router->getRouteCollection(), $context);
                
                return new GroupUrlGenerator(
                    [
                        $newGenerator,
                        $generator,
                    ]
                );
            }
        );
        $app['router']                       = function ($app) {
            return $this->getRouter($app['request_context']);
        };
        $app['routing.config.data_provider'] = function ($app) {
            $routingConfig = $app['routing.config'];
            
            return $this->processConfiguration(
                $routingConfig,
                new CacheableRouterConfiguration()
            );
        };
        $app['routing.config.namespaces']    = function () {
            return $this->getConfigDataProvider()->getOptional(
                'namespaces',
                DataProviderInterface::ARRAY_TYPE,
                []
            );
        };
        $app['routing.config.cache_dir']     = function () {
            return $this->getConfigDataProvider()->getOptional('cache_dir');
        };
    }