public function make($layoutName, $viewResult) { if (!$layoutName) { throw new WebException($this->req->param('controller'), $this->req->param('action'), "Invalid layout name"); } else { $layoutFilePath = self::getFilePath($layoutName); if (is_file($layoutFilePath) && is_readable($layoutFilePath)) { return new Layout($layoutFilePath, $viewResult); } else { throw new WebException($this->req->param('controller'), $this->req->param('action'), "Can't find layout file {$layoutFilePath}"); } } }
public function __get($key) { if (isset($key) && array_key_exists($key, $this->data)) { return $this->data[$key]; } else { throw new WebException($this->req->param('controller'), $this->req->param('action'), "Can't find [{$key}] in data."); } }