feat: FakeTemplate -> JsonView
This commit is contained in:
parent
18cc1cad01
commit
5170ed8ed5
2 changed files with 12 additions and 4 deletions
40
src/View/JsonView.php
Normal file
40
src/View/JsonView.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\View;
|
||||
|
||||
class JsonView extends \stdClass {
|
||||
/** @var array */
|
||||
public $_data = [];
|
||||
/** @var string */
|
||||
public $_name = '';
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
function __construct($name) {
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
function set($key, $value): void {
|
||||
$this->_data[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
function __set($key, $value): void {
|
||||
$this->_data[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function execute() {
|
||||
return json_encode($this->_data) ?: '';
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue