| 1 | <?php |
||
| 8 | class ArrayBackend implements BackendInterface |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Storage contents |
||
| 12 | * |
||
| 13 | * @var array |
||
| 14 | */ |
||
| 15 | private $storage = []; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Load information by given key from storage |
||
| 19 | * |
||
| 20 | * @param string $key |
||
| 21 | * @return mixed |
||
| 22 | */ |
||
| 23 | 4 | public function load($key) |
|
| 30 | |||
| 31 | /** |
||
| 32 | * Save given contents into storage |
||
| 33 | * |
||
| 34 | * @param string $key |
||
| 35 | * @param mixed $contents |
||
| 36 | * @return void |
||
| 37 | */ |
||
| 38 | 7 | public function save($key, $contents) |
|
| 42 | |||
| 43 | /** |
||
| 44 | * Check if storage has an entry with given key |
||
| 45 | * |
||
| 46 | * @param string $key |
||
| 47 | * @return boolean |
||
| 48 | */ |
||
| 49 | 81 | public function has($key) |
|
| 53 | |||
| 54 | /** |
||
| 55 | * Remove storage entry with given key |
||
| 56 | * |
||
| 57 | * @param string $key |
||
| 58 | * @return void |
||
| 59 | */ |
||
| 60 | 2 | public function remove($key) |
|
| 64 | |||
| 65 | /** |
||
| 66 | * Clear storage contents |
||
| 67 | * |
||
| 68 | * @return void |
||
| 69 | */ |
||
| 70 | 1 | public function clear() |
|
| 74 | } |
||
| 75 |