diff --git a/src/Controller/Component.php b/src/Controller/Component.php index a6916a5..fbf04b7 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -16,7 +16,7 @@ use ctiso\Controller\SiteInterface; use ctiso\Database\PDOStatement; use PHPTAL; use PHPTAL_PreFilter_Normalize; -use ctiso\View\FakeTemplate; +use ctiso\View\JsonView; /** * Класс компонента @@ -117,12 +117,12 @@ class Component /** * Получить шаблон * @param string $name - * @return PHPTAL|FakeTemplate + * @return PHPTAL|JsonView */ public function getView($name) { if ($this->output === 'json') { - return new FakeTemplate($name); + return new JsonView($name); } /** @var Registry $config */ diff --git a/src/View/FakeTemplate.php b/src/View/JsonView.php similarity index 73% rename from src/View/FakeTemplate.php rename to src/View/JsonView.php index 223fa46..3ba8fd4 100644 --- a/src/View/FakeTemplate.php +++ b/src/View/JsonView.php @@ -2,7 +2,7 @@ namespace ctiso\View; -class FakeTemplate extends \stdClass { +class JsonView extends \stdClass { /** @var array */ public $_data = []; /** @var string */ @@ -15,6 +15,14 @@ class FakeTemplate extends \stdClass { $this->_name = $name; } + /** + * @param string $key + * @param mixed $value + */ + function set($key, $value): void { + $this->_data[$key] = $value; + } + /** * @param string $key * @param mixed $value