Boot with Silex Application
@param \Silex\Application $app
490423
public function boot(\Silex\Application $app)
    {
        // Register firewalls
        foreach ($this->firewalls as $firewall) {
            $firewall->register($this);
        }

        $i         = 0;
        $firewalls = array();
        foreach ($this->unsecuredPatterns as $pattern => $v) {
            $firewalls['unsecured_'.($i++)] = array('pattern' => $pattern);
        }
        $finalConfig = array_merge($firewalls, $this->firewallConfig);

        $app['security.firewalls'] = $finalConfig;

        parent::boot($app);
    }
975802
public function boot(Container $app)
    {
        $toBoot = (array) $app['config']->get('bootstrap', []);

        foreach ($toBoot as $bootstrapClass) {
            $app->make($bootstrapClass)->boot($app);
        }
    }
783894
public function boot(Application $app)
    {
        $this->strategies = $app['cors.strategies'];
        foreach ($this->strategies as &$strategy) {
            if (is_array($strategy)) {
                $strategy = new CrossOriginResourceSharingStrategy($strategy);
            }
            elseif (!$strategy instanceof CrossOriginResourceSharingStrategy) {
                throw new \InvalidArgumentException(
                    static::class . " must be constructed with array of " . CrossOriginResourceSharingStrategy::class
                );
            }
        }
        
        $app->before([$this, 'onPreRouting'], SilexKernel::BEFORE_PRIORITY_ROUTING + 1);
        $app->before([$this, 'onPostRouting'], SilexKernel::BEFORE_PRIORITY_CORS_PREFLIGHT);
        $app->after([$this, 'onResponse'], Application::LATE_EVENT);
        //$app->error([$this, 'onMethodNotAllowed'], Application::EARLY_EVENT);
        $app->error([$this, 'onMethodNotAllowedHttp'], Application::EARLY_EVENT);
    }
1146027
public function register(Application $app)
    {
        $this->loadProviders();

        foreach ($this->controllerProviders as $class => $values) {
            $app->register(new $class, $values);
        }
    }
403208
public function bootstrap($app)
    {
        $app->on(Application::EVENT_BEFORE_REQUEST, function () {
            $this->retrieveInfo();
            $this->retrieveLanguageFromGeo();
        });
        $app->on(Application::EVENT_BEFORE_ACTION, function () {
            $this->retrieveCookieLanguage();
        });
        $this->registerTranslations();
    }
172566
public function boot(Application $app)
    {
        // Register Monolog error handler for fatal errors here because Symfony's handler overrides it
        $monologErrorHandler = new MonologErrorHandler($app['log']);

        $monologErrorHandler->registerErrorHandler();
        $monologErrorHandler->registerFatalHandler();
    }
35360
public function bootstrap(Application $app)
    {
        $app['actions']->listen(
            'init',
            function () use ($app) {

                $this->extractWordpressClasses($app);

                $this->setDefaultPermalinkStructure($app);

                $this->bootstrapRoutes($app['router']);
            }
        );
    }
1092880
public function boot(Application $app)
    {
        if (!$this->registered) {
            throw new \RuntimeException('Can not boot extensions prior to completion of registration.');
        }
        if ($this->booted) {
            throw new \RuntimeException('Can not re-boot extensions.');
        }

        // Boot all extension loaders that are also service providers
        foreach ($this->extensions as $extension) {
            if ($extension->isEnabled() !== true) {
                continue;
            }
            foreach ($extension->getInnerExtension()->getServiceProviders() as $provider) {
                $provider->boot($app);
            }
        }
        $this->loaded = true;
        $this->booted = true;
    }
210028
public function bootstrap(Application $app)
    {
        if ($app->configurationIsCached()) {
            return;
        }

        $this->checkForSpecificEnvironmentFile($app);

        try {
            $this->createDotenv($app)->safeLoad();
        } catch (InvalidFileException $e) {
            $this->writeErrorAndDie($e);
        }
    }
449935
public function bootstrap(Application $app)
	{
		$this->configureHandlers($app, $this->registerLogger($app));

		// Next, we will bind a Closure that resolves the PSR logger implementation
		// as this will grant us the ability to be interoperable with many other
		// libraries which are able to utilize the PSR standardized interface.
		$app->bind('Psr\Log\LoggerInterface', function($app)
		{
			return $app['log']->getMonolog();
		});
	}
163587
public function bootstrap($app)
    {
        if ($app instanceof yii\web\Application) {
            Yii::$container->set('yii\widgets\ActiveForm', function ($di, $params, $config) {
                if (!isset($config['id'])) {
                    $config['id'] = str_replace('.', '_', uniqid('ActiveForm_', true));
                }

                return new yii\widgets\ActiveForm($config);
            });
        }
    }
466338
public function bootstrap($app)
    {
        if ($app instanceof WebApplication) {
            $this->addUrlManagerRules($app);
            $this->setPodiumLogTarget($app);
        } elseif ($app instanceof ConsoleApplication) {
            $this->controllerNamespace = 'bizley\podium\console';
        }
    }
433420
public function boot(Event $event, Application $app)
    {
        /** @var IConfig $config */
        $config = $this->di->get('config');
        //获取概率xhprof
        $prob = (int)$config->get('xhprof.prob', 1);
        if ($prob <= 0 || $prob > 1) {
            $prob = 1;
        }
        $mtMax = intval(1 / $prob);
        //在一定概率下执行
        if (mt_rand(1, $mtMax) == 1) {
            xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
            $this->xhprofOn = true;
        }
    }
1343421
public function bootstrap($app)
    {
        if ($this->isBootstrapI18n) {
            $this->bootstrapI18n($app);
        }

        $bootstraps = [];
        foreach ($this->getDepends() as $key => $depends) {
            foreach ($depends as $name => $depend) {
                switch ($key) {
                    case 'bootstrap':
                        $bootstraps[$name] = $depend;
                    break;
                    case 'modules':
                        if (!$app->hasModule($name)) {
                            $app->setModule($name, $depend);
                        }
                    break;
                    case 'components':
                        if (in_array($name, self::CORE_COMPONENTS) || !$app->has($name)) {
                            if (in_array($name, self::CORE_COMPONENTS)) {
                                if (!empty(self::$coreComponents[$name])) {
                                    break;
                                }

                                self::$coreComponents[$name] = true;
                            }

                            $app->set($name, $depend);
                        }
                    break;
                }
            }
        }

        foreach ($bootstraps as $bootstrapKey => $bootstrap) {
            if (is_string($bootstrap)) {
                $module = $app->getModule($bootstrap);
                if ($module instanceof BootstrapInterface) {
                    $module->bootstrap($app);
                }
            } else if (is_callable($bootstrap)) {
                if (in_array($bootstrapKey, self::$boostrapped)) {
                    continue;
                }

                $bootstrap();
                self::$boostrapped[] = $key;
            } else {
                $bootstrapKey = $bootstrap['class'];
                if (array_key_exists('moduleId', $bootstrap)) {
                    $bootstrapKey .= '-' . $bootstrap['moduleId'];
                }

                if (in_array($bootstrapKey, self::$boostrapped)) {
                    continue;
                }

                self::$boostrapped[] = $bootstrap['class'];
                $bootstrap = \yii::createObject($bootstrap);
                $bootstrap->bootstrap($app);
            }
        }
    }
234981
public function bootstrap(Application $app)
	{
		try
		{
			Dotenv::load($app->basePath(), $app->environmentFile());
		}
		catch (InvalidArgumentException $e)
		{
			//
		}

		$app->detectEnvironment(function()
		{
			return env('APP_ENV', 'production');
		});
	}
745067
public function boot(Application $app)
    {
        AnnotationRegistry::registerAutoloadNamespace("Swagger\Annotations", $app["swagger.srcDir"]);

        if ($app["logger"]) {
            $logger = Logger::getInstance();
            $originalLog = $logger->log;
            $logger->log = function ($entry, $type) use ($app, $originalLog) {
                $app["logger"]->notice($entry);
                $originalLog($entry, $type);
            };
        }

        $app->get($app["swagger.apiDocPath"], new ResourceListController());
        $app->get("{$app["swagger.apiDocPath"]}/{service}", new ResourceDefinitionController());
    }
72920
protected function registerContextListener(\Silex\Application $app)
    {
        $context_listener       = 'security.context_listener.'.$this->name;
        $app[$context_listener] = $app->share(function () use ($app) {
            return new ContextListener(
                $app['security.token_storage'], $this->userProviders, $this->name, $app['logger'], $app['dispatcher']
            );
        });
        return $context_listener;
    }