for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace nebula\component\template;
class EmptyTemplate implements Template
{
/**
* 值
*
* @var array
*/
protected $value;
* 继承
* @var Template
protected $extens;
public function get(string $name=null, $default=null)
if (is_null($name)) {
return $this->value;
}
return $this->value[$name] ?? $default;
public function set(string $name, $value)
$this->value[$name] = $value;
return $this;
public function has(string $name)
return \array_key_exists($name, $this->value);
public function assign(array $values)
$this->value=array_merge($this->value, $values);
public function include(Template $template)
$template->assign($this->value);
$template->getRenderedString();
public function extends(Template $template)
$this->extends = $template;
extends
public function insert(string $name, $callback)
public function exec(string $name)
public function getRenderedString()
$text = 'EmptyTemplate<'.$this->get('name', 'null').'>';
if ($this->extends) {
$text = $this->extends->getRenderedString();
return $text;