| 1 | <?php |
||
| 5 | class DataLayer |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var array |
||
| 9 | */ |
||
| 10 | protected $data; |
||
| 11 | |||
| 12 | public function __construct($data = []) |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Add data to the data layer. Supports dot notation. |
||
| 19 | * Inspired by laravel's config repository class. |
||
| 20 | * |
||
| 21 | * @param array|string $key |
||
| 22 | * @param mixed $value |
||
| 23 | */ |
||
| 24 | public function set($key, $value = null) |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Empty the data layer. |
||
| 39 | */ |
||
| 40 | public function clear() |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Return a json representation of the data layer. |
||
| 47 | * |
||
| 48 | * @return string |
||
| 49 | */ |
||
| 50 | public function toJson() |
||
| 54 | } |
||
| 55 |