public function setLayout($layout)
    {
        if ($layout === "" || $layout === null) {
            $this->layout = null;
        } else {
            $layoutPath = $this->templatePath . $layout;
            if (!is_file($layoutPath)) {
                throw new \RuntimeException("Layout template `$layout` does not exist");
            }
            $this->layout = $layoutPath;
        }
    }