1 | <?php |
||
27 | trait StoreDataTrait |
||
28 | { |
||
29 | |||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | protected $internalData = []; |
||
34 | |||
35 | /** |
||
36 | * Returns the asked data. If `$key` is null, the full data array is |
||
37 | * returned. The argument `$key` can be a path to a value in the array, with |
||
38 | * a dot (`.`) being the keys separator. |
||
39 | * |
||
40 | * Example: `$key = foo.bar` - the result will be the value stored in |
||
41 | * `$data['foo']['bar']` (if it is found). |
||
42 | * |
||
43 | * @param string|null $key |
||
44 | * @return array |
||
45 | */ |
||
46 | public function getData($key = null) |
||
64 | |||
65 | /** |
||
66 | * Stores the given value at the given key. The argument `$key` can be a |
||
67 | * path to a value in an array, with a dot (`.`) being the keys separator. |
||
68 | * |
||
69 | * Example: `$key = foo.bar` - the value will be stored in |
||
70 | * `$data['foo']['bar']` |
||
71 | * |
||
72 | * @param string $key |
||
73 | * @param mixed $value |
||
74 | */ |
||
75 | public function setData($key, $value) |
||
83 | } |
||
84 |