public function renderToString() { if (!isset($this->staticRoot)) { throw new \Exception("Please set static root using `setStaticRoot`"); } $controller = new MainController($this); return $controller->handle(); }