blink\core\Application::bootstrap PHP Method

bootstrap() public method

public bootstrap ( )
    public function bootstrap()
    {
        if (!$this->bootstrapped) {
            try {
                $this->initializeConfig();
                $this->registerServices();
                $this->registerPlugins();
                $this->registerRoutes();
                $this->bootstrapped = true;
            } catch (\Exception $e) {
                if ($this->environment === 'test') {
                    throw $e;
                }
                $this->lastError = $e;
                $this->get('log')->emergency($e);
            } catch (\Throwable $e) {
                if ($this->environment === 'test') {
                    throw $e;
                }
                $this->lastError = $e;
                $this->get('log')->emergency($e);
            }
        }
        return $this;
    }

Usage Example

Example #1
0
 protected function createApp($callback = null)
 {
     $app = new Application(['root' => '.', 'services' => ['log' => $this->createLogger($this->logFile)]]);
     if ($callback) {
         $app->route('GET', '/', $callback);
     }
     $app->bootstrap();
     return $app;
 }