1 | <?php |
||
16 | class IndexManager |
||
17 | { |
||
18 | /** |
||
19 | * @var Index |
||
20 | */ |
||
21 | private $defaultIndex; |
||
22 | |||
23 | /** |
||
24 | * @var array |
||
25 | */ |
||
26 | private $indexes; |
||
27 | |||
28 | /** |
||
29 | * @param array $indexes |
||
30 | * @param Index $defaultIndex |
||
31 | */ |
||
32 | public function __construct(array $indexes, Index $defaultIndex) |
||
37 | |||
38 | /** |
||
39 | * Gets all registered indexes. |
||
40 | * |
||
41 | * @return array |
||
42 | */ |
||
43 | public function getAllIndexes() |
||
47 | |||
48 | /** |
||
49 | * Gets an index by its name. |
||
50 | * |
||
51 | * @param string $name Index to return, or the default index if null |
||
52 | * |
||
53 | * @return Index |
||
54 | * |
||
55 | * @throws \InvalidArgumentException if no index exists for the given name |
||
56 | */ |
||
57 | public function getIndex($name = null) |
||
69 | |||
70 | /** |
||
71 | * Gets the default index. |
||
72 | * |
||
73 | * @return Index |
||
74 | */ |
||
75 | public function getDefaultIndex() |
||
79 | } |
||
80 |