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; }
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; }