1 | <?php |
||
15 | class StorageLayerManager |
||
16 | { |
||
17 | /** |
||
18 | * All registered Persister services. |
||
19 | * |
||
20 | * @var PersisterInterface[] |
||
21 | */ |
||
22 | private $persisters = []; |
||
23 | |||
24 | /** |
||
25 | * All Search Client services. |
||
26 | * |
||
27 | * @var ClientInterface[] |
||
28 | */ |
||
29 | private $searchClients = []; |
||
30 | |||
31 | /** |
||
32 | * Adds/registers a Persister service to the manager. |
||
33 | * |
||
34 | * @param PersisterInterface $persister |
||
35 | * @return self |
||
36 | */ |
||
37 | public function addPersister(PersisterInterface $persister) |
||
42 | |||
43 | /** |
||
44 | * Adds/registers a Search Client service to the manager. |
||
45 | * |
||
46 | * @param ClientInterface $client |
||
47 | * @return self |
||
48 | */ |
||
49 | public function addSearchClient(ClientInterface $client) |
||
54 | |||
55 | /** |
||
56 | * Gets a Persister service by key. |
||
57 | * |
||
58 | * @param string $key |
||
59 | * @return PersisterInterface |
||
60 | * @throws PersisterException If the service was not found. |
||
61 | */ |
||
62 | public function getPersister($key) |
||
69 | |||
70 | /** |
||
71 | * Determines if a Persister exists. |
||
72 | * |
||
73 | * @param string $key |
||
74 | * @return bool |
||
75 | */ |
||
76 | public function hasPersister($key) |
||
80 | |||
81 | /** |
||
82 | * Gets a Search Client service by key. |
||
83 | * |
||
84 | * @param string $key |
||
85 | * @return ClientInterface |
||
86 | * @throws ClientException If the service was not found. |
||
87 | */ |
||
88 | public function getSearchClient($key) |
||
95 | |||
96 | /** |
||
97 | * Determines if a Search Client exists. |
||
98 | * |
||
99 | * @param string $key |
||
100 | * @return bool |
||
101 | */ |
||
102 | public function hasSearchClient($key) |
||
106 | } |
||
107 |