1 | <?php |
||
10 | class Indexer |
||
11 | { |
||
12 | /** |
||
13 | * Operations indexed by key and operation index. |
||
14 | |||
15 | * @var Operation[][] |
||
16 | */ |
||
17 | protected $index = []; |
||
18 | |||
19 | /** |
||
20 | * The connection used by this indexer. |
||
21 | * |
||
22 | * @var Connection |
||
23 | */ |
||
24 | protected $connection; |
||
25 | |||
26 | /** |
||
27 | * Indexer constructor. |
||
28 | * |
||
29 | * @param Connection $connection |
||
30 | */ |
||
31 | 5 | public function __construct(Connection $connection) |
|
35 | |||
36 | /** |
||
37 | * Get connection. |
||
38 | * |
||
39 | * @return Connection |
||
40 | */ |
||
41 | 1 | public function getConnection() |
|
45 | |||
46 | /** |
||
47 | * Index operation. |
||
48 | * |
||
49 | * @param string $key |
||
50 | * The key to index under. |
||
51 | * @param Operation $operation |
||
52 | * The operation to index. |
||
53 | * |
||
54 | * @return Operation |
||
55 | * The operation indexed. |
||
56 | */ |
||
57 | 4 | public function index($key, Operation $operation) |
|
69 | |||
70 | /** |
||
71 | * De-index operation. |
||
72 | * |
||
73 | * @param string $key |
||
74 | * The key to index under. |
||
75 | * @param Operation $operation |
||
76 | * The operation to index. |
||
77 | * |
||
78 | * @return Operation |
||
79 | * The operation de-indexed. |
||
80 | */ |
||
81 | 2 | public function deIndex($key, Operation $operation) |
|
86 | |||
87 | /** |
||
88 | * Lookup operation. |
||
89 | * |
||
90 | * @param string $key |
||
91 | * The key to look up. |
||
92 | * |
||
93 | * @return Operation[] |
||
94 | * Operations keyed by operation index. |
||
95 | */ |
||
96 | 3 | public function lookup($key) |
|
100 | |||
101 | /** |
||
102 | * Lookup operation values. |
||
103 | * |
||
104 | * @param string $key |
||
105 | * The key to look up. |
||
106 | * |
||
107 | * @return array |
||
108 | * Values keyed by operation index. |
||
109 | */ |
||
110 | 1 | public function lookupValues($key) |
|
120 | } |
||
121 |