1 | <?php |
||
8 | class IndexManager |
||
9 | { |
||
10 | /** |
||
11 | * @var Index |
||
12 | */ |
||
13 | private $defaultIndex; |
||
14 | |||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | private $indexes; |
||
19 | |||
20 | /** |
||
21 | * @var IndexTemplate[] |
||
22 | */ |
||
23 | private $indexTemplates; |
||
24 | |||
25 | /** |
||
26 | * @param array $indexes |
||
27 | * @param Index $defaultIndex |
||
28 | * @param array $templates |
||
29 | */ |
||
30 | 4 | public function __construct(array $indexes, Index $defaultIndex, array $templates = array()) |
|
36 | |||
37 | /** |
||
38 | * Gets all registered indexes. |
||
39 | * |
||
40 | * @return array |
||
41 | */ |
||
42 | 1 | public function getAllIndexes() |
|
46 | |||
47 | /** |
||
48 | * Gets an index by its name. |
||
49 | * |
||
50 | * @param string $name Index to return, or the default index if null |
||
51 | * |
||
52 | * @return Index |
||
53 | * |
||
54 | * @throws \InvalidArgumentException if no index exists for the given name |
||
55 | */ |
||
56 | 3 | public function getIndex($name = null) |
|
68 | |||
69 | /** |
||
70 | * Gets an index template by its name. |
||
71 | * |
||
72 | * @param string $name Index template to return |
||
73 | * |
||
74 | * @return IndexTemplate |
||
75 | * |
||
76 | * @throws \InvalidArgumentException if no index template exists for the given name |
||
77 | */ |
||
78 | public function getIndexTemplate($name = null) |
||
86 | |||
87 | /** |
||
88 | * Gets the default index. |
||
89 | * |
||
90 | * @return Index |
||
91 | */ |
||
92 | 1 | public function getDefaultIndex() |
|
96 | } |
||
97 |