public function setTemplate(Template $template) { if ($this->compiled) { throw new \LogicException('Template cannot be changed after the response is compiled'); } $this->template = $template; }