示例#1
0
文件: View.php 项目: exts/app
 /**
  * @param array $data
  * @param bool $merge
  * @return mixed
  * @throws \Exception
  */
 public function render(array $data = [], bool $merge = false)
 {
     if (empty($this->template)) {
         throw new \Exception("Please set a template to render");
     }
     $data = $merge === true ? array_merge($this->data, $data) : $data;
     $data = empty($data) ? $this->data : $data;
     if (!preg_match(sprintf('#%s$#i', preg_quote($this->extension)), $this->template)) {
         $this->template .= $this->extension;
     }
     return $this->renderer->render($this->template, $data);
 }
示例#2
0
 /**
  *
  */
 public function render()
 {
     $this->renderService->render();
 }