1 | <?php |
||
16 | class KeyBag |
||
17 | { |
||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $storage = []; |
||
22 | |||
23 | /** |
||
24 | * Stores key to local storage and returns it's index |
||
25 | * |
||
26 | * @param string $namespace |
||
27 | * @param string $key |
||
28 | * |
||
29 | * @return int Stored key index |
||
30 | */ |
||
31 | 3 | public function add($namespace, $key) |
|
37 | |||
38 | /** |
||
39 | * Returns key from local storage |
||
40 | * |
||
41 | * @param string $namespace |
||
42 | * @param int $index |
||
43 | * |
||
44 | * @return string|null |
||
45 | */ |
||
46 | 3 | public function get($namespace, $index) |
|
54 | |||
55 | /** |
||
56 | * Registers namespace |
||
57 | * |
||
58 | * @param string $namespace |
||
59 | */ |
||
60 | 1 | public function registerNamespace($namespace) |
|
64 | |||
65 | /** |
||
66 | * Returns names of all stored namespaces |
||
67 | * |
||
68 | * @return array |
||
69 | */ |
||
70 | 2 | public function getNamespaces() |
|
74 | } |
||
75 |