Bootstrap method to be called during application bootstrap stage.
@param Application $app the application currently running
771677
public function bootstrap($app)
    {
        if ($app instanceof \yii\console\Application) {
            if (!isset($app->controllerMap['schedule'])) {
                $app->controllerMap['schedule'] = 'omnilight\scheduling\ScheduleController';
            }
        }
    }
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');
        }
    }
234981
public function bootstrap(Application $app)
	{
		try
		{
			Dotenv::load($app->basePath(), $app->environmentFile());
		}
		catch (InvalidArgumentException $e)
		{
			//
		}

		$app->detectEnvironment(function()
		{
			return env('APP_ENV', 'production');
		});
	}
444773
public function bootstrap($app)
    {
        if (!$app instanceof \yii\web\Application) {
            return;
        }

        $app->on(Application::EVENT_BEFORE_ACTION, function (ActionEvent $event) use ($app) {
            if ($app->user->getIsGuest()) {
                return;
            }

            if ($app->request->getIsAjax()) {
                return;
            }

            $action = $event->action->getUniqueId();
            if (
                strpos($action, 'client/') === 0
                || strpos($action, 'monitoring/') === 0
                || strpos($action, 'site/logout') === 0
            ) {
                return;
            }

            $session = $app->session;
            if ($session->get('contact.gdpr.accepted')) {
                return;
            }

            $contact = Contact::findOne(['id' => $app->user->getId()]);
            if ($contact->gdpr_consent && $contact->policy_consent) {
                $app->session->set('contact.gdpr.accepted', true);

                return;
            }

            $app->response->redirect(Url::to(['@contact/update', 'id' => $app->user->getId()]));
            Yii::$app->end();
        });
    }
462052
public function bootstrap(Application $app)
    {
        $this->app = $app;
        define('DEBUG', (ENVIRON == 'local' || ENVIRON == 'test'));
        if (DEBUG) {
            error_reporting(E_ALL ^ E_NOTICE);
            ini_set('display_errors', 'On');
        } else {
            error_reporting(0);
            ini_set('display_errors', 'Off');
        }
        set_error_handler([$this, 'handleError']);
        set_exception_handler([$this, 'handleException']);
        register_shutdown_function([$this, 'handleShutdown']);
    }
1073229
public function bootstrap($app)
    {
        if ($app->hasModule('user') && ($module = $app->getModule('user')) instanceof Module) {
            //监听用户活动时间
            /** @var \yii\web\UserEvent $event */
            $app->on(Application::EVENT_AFTER_REQUEST, function ($event) use ($app) {
                if (!$app->user->isGuest && Yii::$app->has('queue')) {
                    $user = UserExtra::findOne(['user_id' => $app->user->id]);
                    $user->updateAttributesAsync(['last_visit' => time()]);
                }
            });

            //监听用户登录事件
            /** @var \yii\web\UserEvent $event */
            $app->user->on(User::EVENT_AFTER_LOGIN, function ($event) use ($app) {
                //记录最后登录时间记录最后登录IP记录登录次数
                $user = UserExtra::findOne(['user_id' => $app->user->id]);
                $user->updateAttributesAsync(['login_at' => time(), 'login_ip' => Yii::$app->request->userIP]);
                $user->updateCountersAsync(['login_num' => 1]);
            });
        }
    }
1178479
public function bootstrap(Application $app)
	{
		Facade::clearResolvedInstances();

		Facade::setFacadeApplication($app);

		AliasLoader::getInstance($app['config']['app.aliases'])->register();
	}
342547
public function bootstrap(Container $app)
    {
        foreach ($app->make('config')->get('app.providers') as $provider) {
            $app->register(new $provider($app));
        }
        
        foreach ($app->make('config')->get('app.theme.providers', []) as $provider) {
            $app->register(new $provider($app));
        }
    }
313985
public function bootstrap(PluginApplicationInterface $app)
    {
        parent::bootstrap($app);

        //Sets directories to be created and must be writable
        Configure::write('WRITABLE_DIRS', [
            LOGS,
            TMP,
            CACHE,
            CACHE . 'models',
            CACHE . 'persistent',
            CACHE . 'views',
            TMP . 'sessions',
            TMP . 'tests',
            WWW_ROOT . 'files',
            WWW_ROOT . 'vendor',
        ]);

        //Sets symbolic links for vendor assets to be created
        Configure::write('VENDOR_LINKS', [
            'eonasdan' . DS . 'bootstrap-datetimepicker' . DS . 'build' => 'bootstrap-datetimepicker',
            'components' . DS . 'jquery' => 'jquery',
            'components' . DS . 'moment' . DS . 'min' => 'moment',
            'newerton' . DS . 'fancy-box' . DS . 'source' => 'fancybox',
            'npm-asset' . DS . 'fortawesome--fontawesome-free' => 'font-awesome',
            'twbs' . DS . 'bootstrap' . DS . 'dist' => 'bootstrap',
        ]);

        if (class_exists(Assets::class) && !$app->getPlugins()->has('Assets')) {
            $plugin = new Assets;
            $plugin->bootstrap($app);
            $app->addPlugin($plugin);
        }
    }
809788
public function boot(Application $app, array $addons)
    {
        foreach ($addons as $addon) {
            $this->registerPackage($app, $addon);
        }
    }
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);
    }
1336634
public function boot(Application $app)
    {
        if (!$app instanceof SilexKernel) {
            throw new \LogicException(static::class . " can only be used with " . SilexKernel::class);
        }
        
        $app->addControllerInjectedArg($this->cookieContainer);
        $app->after(
            function (/** @noinspection PhpUnusedParameterInspection */
                Request $request,
                Response $response) {
                foreach ($this->cookieContainer->getCookies() as $cookie) {
                    $response->headers->setCookie($cookie);
                }
            }
        );
    }
1017627
public function bootstrap($app)
    {
        if ($app instanceof Application) {
            if (is_callable($this->languages)) {
                $this->languages = call_user_func($this->languages);
            }
            if (!is_array($this->languages)) {
                throw new InvalidConfigException(
                    'The "languages" property must be an array or callable function that returns an array'
                );
            }

            if (!is_bool($this->appendSetLanguageHandler)) {
            	throw new InvalidConfigException(
            		'The "appendSetLanguageHandler" property must be a boolean'
	            );
            }
            foreach ($this->handlers as &$handler) {
                if (is_object($handler) === false) {
                    $handler = Yii::createObject($handler);
                }
                if (!$handler instanceof AbstractHandler) {
                    throw new InvalidConfigException(sprintf(
                        'The handler must be an instance of "%s"',
                        AbstractHandler::className()
                    ));
                }
            }
            $app->on($app::EVENT_BEFORE_ACTION, [$this, 'setLanguage'], $app, $this->appendSetLanguageHandler);
        }
    }
940681
public function bootstrap(Container $app)
    {
        Facade::clearResolvedInstances();
        
        Facade::setFacadeApplication($app);
        
        AliasLoader::getInstance($app->make('config')->get('app.aliases'))->register();
        AliasLoader::getInstance($app->make('config')->get('app.theme.aliases', []))->register();
    }
1347826
public function run(Application $app)
    {
        $this->trigger(self::EVENT_BEFORE_RUN);
        $response = call_user_func_array($this->callback, array_merge($this->parameters, [$app]));
        parent::callAfterCallbacks($app);
        $this->trigger(self::EVENT_AFTER_RUN);
        return $response;
    }
1143464
protected function bootstrapExtensions($app)
    {
        $rhoone = Yii::$app->rhoone;
        /* @var $rhoone \rhoone\base\Rhoone */
        $extensions = $rhoone->extensions;
        if (empty($extensions)) {
            return 0;
        }
        foreach ($extensions as $id => $extension) {
            if ($extension instanceof BootstrapInterface) {
                try {
                    $extension->bootstrap($app);
                } catch (\Exception $ex) {
                    Yii::error($ex->getMessage(), __METHOD__);
                    continue;
                }
            }
        }

        $count = 0;
        foreach ($extensions as $ext) {
            $moduleConfig = [];
            try {
                $moduleConfig = $ext->getModule();
            } catch (\Exception $ex) {
                continue;
            }
            if (empty($moduleConfig)) {
                continue;
            }
            Yii::info("`" . $moduleConfig['id'] . '` enabled.', __METHOD__);
            $app->setModule($moduleConfig['id'], $moduleConfig);
            $module = $app->getModule($moduleConfig['id']);
            if ($module instanceof BootstrapInterface) {
                $app->bootstrap[] = $module->id;
                Yii::trace('Bootstrap with ' . $module->className() . '::' . 'bootstrap()', __METHOD__);
                $module->bootstrap($app);
                $count++;
            }
        }
        return $count;
    }
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');
            }
        );
    }