1 | <?php |
||
14 | class ConfigurationParser |
||
15 | { |
||
16 | /** |
||
17 | * Name of index configuration file |
||
18 | */ |
||
19 | const INDEX_CONF_FILENAME = 'IndexConfiguration.yaml'; |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | private $configFolder; |
||
25 | /** |
||
26 | * @var \Psr\Log\LoggerInterface |
||
27 | */ |
||
28 | private $logger; |
||
29 | |||
30 | /** |
||
31 | * ConfigurationParser constructor. |
||
32 | * |
||
33 | * @param \Psr\Log\LoggerInterface $logger |
||
34 | * @param string $configPath |
||
|
|||
35 | */ |
||
36 | public function __construct(LoggerInterface $logger) |
||
40 | |||
41 | /** |
||
42 | * Get configurations for all indices |
||
43 | * |
||
44 | * @return array |
||
45 | */ |
||
46 | public function getIndexConfigurations(): array |
||
61 | |||
62 | /** |
||
63 | * Get Configuration for specified index1 |
||
64 | * |
||
65 | * @param string $indexName |
||
66 | * |
||
67 | * @return array |
||
68 | */ |
||
69 | public function getIndexConfiguration(string $indexName): array |
||
74 | |||
75 | /** |
||
76 | * Get all document type configurations for index |
||
77 | * |
||
78 | * @param string $indexName |
||
79 | * @param string $language |
||
80 | * |
||
81 | * @return array |
||
82 | */ |
||
83 | public function getDocumentTypeConfigurations(string $indexName, string $language = ''): array |
||
100 | |||
101 | /** |
||
102 | * Convert document type configuration to mapping as returned from elastica (for comparison for example) |
||
103 | * |
||
104 | * @param array $configurations |
||
105 | * |
||
106 | * @return array |
||
107 | */ |
||
108 | public function convertDocumentTypeConfigurationToMappingFromElastica(array $configurations): array |
||
116 | |||
117 | /** |
||
118 | * Get configuration for document type in index |
||
119 | * |
||
120 | * @param string $indexName |
||
121 | * @param string $documentType |
||
122 | * |
||
123 | * @return array |
||
124 | */ |
||
125 | public function getDocumentTypeConfiguration(string $indexName, string $documentType): array |
||
130 | |||
131 | /** |
||
132 | * @param string $language |
||
133 | * @param $configs |
||
134 | * |
||
135 | * @return mixed |
||
136 | */ |
||
137 | private function addAnalyzerToConfig(string $language, $configs) |
||
148 | |||
149 | /** |
||
150 | * @param string $indexName |
||
151 | * |
||
152 | * @return string |
||
153 | */ |
||
154 | private function getDocumentTypesDirectory(string $indexName): string |
||
158 | |||
159 | /** |
||
160 | * @param string $directory |
||
161 | * |
||
162 | * @return array |
||
163 | */ |
||
164 | private function getFilesInFolder(string $directory): array |
||
168 | |||
169 | /** |
||
170 | * @param string $indexName |
||
171 | * |
||
172 | * @return string |
||
173 | */ |
||
174 | private function getIndexDirectory(string $indexName): string |
||
184 | |||
185 | /** |
||
186 | * @param string $filePath |
||
187 | * |
||
188 | * @return array |
||
189 | * @throws \InvalidArgumentException |
||
190 | */ |
||
191 | private function getConfig(string $filePath): array |
||
199 | |||
200 | public function createConfigurationForIndex(string $indexName, array $mapping, array $settings) |
||
213 | |||
214 | /** |
||
215 | * Remove array keys from settings the remote server returns |
||
216 | * but we don't want in the config file |
||
217 | * |
||
218 | * @param array $settings |
||
219 | * |
||
220 | * @return array |
||
221 | */ |
||
222 | public function cleanSettingsArray(array $settings): array |
||
233 | |||
234 | private function createConfigurationDirectories(string $indexName) |
||
240 | } |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.