Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like FOSElasticaExtension often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use FOSElasticaExtension, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
26 | class FOSElasticaExtension extends Extension |
||
27 | { |
||
28 | /** |
||
29 | * Definition of elastica clients as configured by this extension. |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | private $clients = []; |
||
34 | |||
35 | /** |
||
36 | * An array of indexes as configured by the extension. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | private $indexConfigs = []; |
||
41 | |||
42 | /** |
||
43 | * An array of index templates as configured by the extension. |
||
44 | * |
||
45 | * @var array |
||
46 | */ |
||
47 | private $indexTemplateConfigs = array(); |
||
48 | |||
49 | /** |
||
50 | * If we've encountered a type mapped to a specific persistence driver, it will be loaded |
||
51 | * here. |
||
52 | * |
||
53 | * @var array |
||
54 | */ |
||
55 | private $loadedDrivers = []; |
||
56 | |||
57 | 18 | public function load(array $configs, ContainerBuilder $container) |
|
58 | { |
||
59 | 18 | $configuration = $this->getConfiguration($configs, $container); |
|
60 | 18 | $config = $this->processConfiguration($configuration, $configs); |
|
61 | |||
62 | 18 | $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
63 | |||
64 | 18 | if (empty($config['clients']) || empty($config['indexes'])) { |
|
65 | // No Clients or indexes are defined |
||
66 | return; |
||
67 | } |
||
68 | |||
69 | 18 | foreach (['config', 'index', 'persister', 'provider', 'source', 'transformer', 'event_listener', 'commands'] as $basename) { |
|
70 | 18 | $loader->load(sprintf('%s.xml', $basename)); |
|
71 | } |
||
72 | |||
73 | 18 | if (empty($config['default_client'])) { |
|
74 | 18 | $keys = array_keys($config['clients']); |
|
75 | 18 | $config['default_client'] = reset($keys); |
|
76 | } |
||
77 | |||
78 | 18 | if (empty($config['default_index'])) { |
|
79 | 18 | $keys = array_keys($config['indexes']); |
|
80 | 18 | $config['default_index'] = reset($keys); |
|
81 | } |
||
82 | |||
83 | 18 | if (isset($config['serializer'])) { |
|
84 | 1 | $loader->load('serializer.xml'); |
|
85 | |||
86 | 1 | $this->loadSerializer($config['serializer'], $container); |
|
87 | } |
||
88 | |||
89 | 18 | $this->loadClients($config['clients'], $container); |
|
90 | 18 | $container->setAlias('fos_elastica.client', sprintf('fos_elastica.client.%s', $config['default_client'])); |
|
91 | 18 | $container->getAlias('fos_elastica.client')->setPublic(true); |
|
92 | 18 | $container->setAlias(ElasticaClient::class, new Alias('fos_elastica.client', false)); |
|
93 | 18 | $container->setAlias(Client::class, 'fos_elastica.client'); |
|
94 | 18 | $container->getAlias(Client::class)->setPublic(false); |
|
95 | |||
96 | 18 | $this->loadIndexes($config['indexes'], $container); |
|
97 | 18 | $container->setAlias('fos_elastica.index', sprintf('fos_elastica.index.%s', $config['default_index'])); |
|
98 | 18 | $container->getAlias('fos_elastica.index')->setPublic(true); |
|
99 | 18 | $container->setParameter('fos_elastica.default_index', $config['default_index']); |
|
100 | |||
101 | 18 | $this->loadIndexTemplates($config['index_templates'], $container); |
|
102 | |||
103 | 18 | $container->getDefinition('fos_elastica.config_source.container')->replaceArgument(0, $this->indexConfigs); |
|
104 | $container |
||
105 | 18 | ->getDefinition('fos_elastica.config_source.template_container') |
|
106 | 18 | ->replaceArgument(0, $this->indexTemplateConfigs); |
|
107 | |||
108 | 18 | $this->loadIndexManager($container); |
|
109 | 18 | $this->loadIndexTemplateManager($container); |
|
110 | |||
111 | 18 | $this->createDefaultManagerAlias($config['default_manager'], $container); |
|
112 | 18 | } |
|
113 | |||
114 | /** |
||
115 | * @param array $config |
||
116 | * @param ContainerBuilder $container |
||
117 | * |
||
118 | * @return Configuration |
||
119 | */ |
||
120 | 18 | public function getConfiguration(array $config, ContainerBuilder $container) |
|
121 | { |
||
122 | 18 | return new Configuration($container->getParameter('kernel.debug')); |
|
123 | } |
||
124 | |||
125 | /** |
||
126 | * Loads the configured clients. |
||
127 | * |
||
128 | * @param array $clients An array of clients configurations |
||
129 | * @param ContainerBuilder $container A ContainerBuilder instance |
||
130 | * |
||
131 | * @return array |
||
132 | */ |
||
133 | 18 | private function loadClients(array $clients, ContainerBuilder $container) |
|
134 | { |
||
135 | 18 | foreach ($clients as $name => $clientConfig) { |
|
136 | 18 | $clientId = sprintf('fos_elastica.client.%s', $name); |
|
137 | |||
138 | 18 | $clientDef = new ChildDefinition('fos_elastica.client_prototype'); |
|
139 | 18 | $clientDef->replaceArgument(0, $clientConfig); |
|
140 | |||
141 | 18 | $logger = $clientConfig['connections'][0]['logger']; |
|
142 | 18 | if (false !== $logger) { |
|
143 | 18 | $clientDef->addMethodCall('setLogger', [new Reference($logger)]); |
|
144 | } |
||
145 | |||
146 | 18 | $clientDef->addTag('fos_elastica.client'); |
|
147 | |||
148 | 18 | $container->setDefinition($clientId, $clientDef); |
|
149 | |||
150 | 18 | $this->clients[$name] = [ |
|
151 | 18 | 'id' => $clientId, |
|
152 | 18 | 'reference' => new Reference($clientId), |
|
153 | ]; |
||
154 | } |
||
155 | 18 | } |
|
156 | |||
157 | /** |
||
158 | * Loads the configured indexes. |
||
159 | * |
||
160 | * @param array $indexes An array of indexes configurations |
||
161 | * @param ContainerBuilder $container A ContainerBuilder instance |
||
162 | * |
||
163 | * @throws \InvalidArgumentException |
||
164 | * |
||
165 | * @return array |
||
166 | */ |
||
167 | 18 | private function loadIndexes(array $indexes, ContainerBuilder $container) |
|
168 | { |
||
169 | 18 | $indexableCallbacks = []; |
|
170 | |||
171 | 18 | foreach ($indexes as $name => $index) { |
|
172 | 18 | $indexId = sprintf('fos_elastica.index.%s', $name); |
|
173 | 18 | $indexName = isset($index['index_name']) ? $index['index_name'] : $name; |
|
174 | |||
175 | 18 | $indexDef = new ChildDefinition('fos_elastica.index_prototype'); |
|
176 | 18 | $indexDef->setFactory([new Reference('fos_elastica.client'), 'getIndex']); |
|
177 | 18 | $indexDef->replaceArgument(0, $indexName); |
|
178 | 18 | $indexDef->addTag('fos_elastica.index', [ |
|
179 | 18 | 'name' => $name, |
|
180 | ]); |
||
181 | |||
182 | 18 | if (isset($index['client'])) { |
|
183 | 2 | $client = $this->getClient($index['client']); |
|
184 | |||
185 | 2 | $indexDef->setFactory([$client, 'getIndex']); |
|
186 | } |
||
187 | |||
188 | 18 | $container->setDefinition($indexId, $indexDef); |
|
189 | 18 | $reference = new Reference($indexId); |
|
190 | |||
191 | 18 | $this->indexConfigs[$name] = [ |
|
192 | 18 | 'elasticsearch_name' => $indexName, |
|
193 | 18 | 'reference' => $reference, |
|
194 | 18 | 'name' => $name, |
|
195 | 18 | 'settings' => $index['settings'], |
|
196 | 18 | 'type_prototype' => isset($index['type_prototype']) ? $index['type_prototype'] : [], |
|
197 | 18 | 'use_alias' => $index['use_alias'], |
|
198 | ]; |
||
199 | |||
200 | 18 | if ($index['finder']) { |
|
201 | $this->loadIndexFinder($container, $name, $reference); |
||
202 | } |
||
203 | |||
204 | 18 | $this->loadTypes((array) $index['types'], $container, $this->indexConfigs[$name], $indexableCallbacks); |
|
205 | } |
||
206 | |||
207 | 18 | $indexable = $container->getDefinition('fos_elastica.indexable'); |
|
208 | 18 | $indexable->replaceArgument(0, $indexableCallbacks); |
|
209 | 18 | } |
|
210 | |||
211 | |||
212 | /** |
||
213 | * Loads the configured indexes. |
||
214 | * |
||
215 | * @param array $indexTemplates An array of indexes configurations |
||
216 | * @param ContainerBuilder $container A ContainerBuilder instance |
||
217 | * |
||
218 | * @throws \InvalidArgumentException |
||
219 | * |
||
220 | * @return void |
||
221 | */ |
||
222 | 18 | private function loadIndexTemplates(array $indexTemplates, ContainerBuilder $container) |
|
223 | { |
||
224 | 18 | $indexableCallbacks = array(); |
|
225 | 18 | foreach ($indexTemplates as $name => $indexTemplate) { |
|
226 | $indexId = sprintf('fos_elastica.index_template.%s', $name); |
||
227 | $indexTemplateName = isset($indexTemplate['template_name']) ? $indexTemplate['template_name'] : $name; |
||
228 | |||
229 | $indexDef = new ChildDefinition('fos_elastica.index_template_prototype'); |
||
230 | $indexDef->replaceArgument(0, $indexTemplateName); |
||
231 | $indexDef->addTag('fos_elastica.index_template', array( |
||
232 | 'name' => $name, |
||
233 | )); |
||
234 | |||
235 | if (isset($indexTemplate['client'])) { |
||
236 | $client = $this->getClient($indexTemplate['client']); |
||
237 | // TODO: set factory properly |
||
238 | $indexDef->setFactoryService($client); |
||
|
|||
239 | } |
||
240 | |||
241 | $container->setDefinition($indexId, $indexDef); |
||
242 | $reference = new Reference($indexId); |
||
243 | |||
244 | $this->indexTemplateConfigs[$name] = array( |
||
245 | 'elasticsearch_name' => $indexTemplateName, |
||
246 | 'reference' => $reference, |
||
247 | 'name' => $name, |
||
248 | 'settings' => $indexTemplate['settings'], |
||
249 | 'template' => $indexTemplate['template'], |
||
250 | ); |
||
251 | |||
252 | $this->loadTypes( |
||
253 | (array) $indexTemplate['types'], |
||
254 | $container, |
||
255 | $this->indexTemplateConfigs[$name], |
||
256 | $indexableCallbacks |
||
257 | ); |
||
258 | } |
||
259 | 18 | } |
|
260 | |||
261 | /** |
||
262 | * Loads the configured index finders. |
||
263 | * |
||
264 | * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container |
||
265 | * @param string $name The index name |
||
266 | * @param Reference $index Reference to the related index |
||
267 | * |
||
268 | * @return string |
||
269 | */ |
||
270 | private function loadIndexFinder(ContainerBuilder $container, $name, Reference $index) |
||
271 | { |
||
272 | /* Note: transformer services may conflict with "collection.index", if |
||
273 | * an index and type names were "collection" and an index, respectively. |
||
274 | */ |
||
275 | $transformerId = sprintf('fos_elastica.elastica_to_model_transformer.collection.%s', $name); |
||
276 | $transformerDef = new ChildDefinition('fos_elastica.elastica_to_model_transformer.collection'); |
||
277 | $container->setDefinition($transformerId, $transformerDef); |
||
278 | |||
279 | $finderId = sprintf('fos_elastica.finder.%s', $name); |
||
280 | $finderDef = new ChildDefinition('fos_elastica.finder'); |
||
281 | $finderDef->replaceArgument(0, $index); |
||
282 | $finderDef->replaceArgument(1, new Reference($transformerId)); |
||
283 | |||
284 | $container->setDefinition($finderId, $finderDef); |
||
285 | } |
||
286 | |||
287 | /** |
||
288 | * Loads the configured types. |
||
289 | * |
||
290 | * @param array $types |
||
291 | * @param ContainerBuilder $container |
||
292 | * @param array $indexConfig |
||
293 | * @param array $indexableCallbacks |
||
294 | */ |
||
295 | 18 | private function loadTypes(array $types, ContainerBuilder $container, array &$indexConfig, array &$indexableCallbacks) |
|
296 | { |
||
297 | 18 | foreach ($types as $name => $type) { |
|
298 | 18 | $indexName = $indexConfig['name']; |
|
299 | |||
300 | 18 | $typeId = sprintf('%s.%s', $indexConfig['reference'], $name); |
|
301 | 18 | $typeDef = new ChildDefinition('fos_elastica.type_prototype'); |
|
302 | 18 | $typeDef->setFactory([$indexConfig['reference'], 'getType']); |
|
303 | 18 | $typeDef->replaceArgument(0, $name); |
|
304 | |||
305 | 18 | $container->setDefinition($typeId, $typeDef); |
|
306 | |||
307 | $typeConfig = [ |
||
308 | 18 | 'name' => $name, |
|
309 | 'mapping' => [], // An array containing anything that gets sent directly to ElasticSearch |
||
310 | 'config' => [], |
||
311 | ]; |
||
312 | |||
313 | foreach ([ |
||
314 | 18 | 'dynamic_templates', |
|
315 | 'properties', |
||
316 | '_all', |
||
317 | '_id', |
||
318 | '_parent', |
||
319 | '_routing', |
||
320 | '_source', |
||
321 | ] as $field) { |
||
322 | 18 | if (isset($type[$field])) { |
|
323 | 18 | $typeConfig['mapping'][$field] = $type[$field]; |
|
324 | } |
||
325 | } |
||
326 | |||
327 | foreach ([ |
||
328 | 18 | 'persistence', |
|
329 | 'serializer', |
||
330 | 'analyzer', |
||
331 | 'search_analyzer', |
||
332 | 'dynamic', |
||
333 | 'date_detection', |
||
334 | 'dynamic_date_formats', |
||
335 | 'numeric_detection', |
||
336 | ] as $field) { |
||
337 | 18 | $typeConfig['config'][$field] = array_key_exists($field, $type) ? |
|
338 | 18 | $type[$field] : |
|
339 | 18 | null; |
|
340 | } |
||
341 | |||
342 | 18 | $indexConfig['types'][$name] = $typeConfig; |
|
343 | |||
344 | 18 | if (isset($type['persistence'])) { |
|
345 | 15 | $this->loadTypePersistenceIntegration($type['persistence'], $container, new Reference($typeId), $indexName, $name); |
|
346 | |||
347 | 15 | $typeConfig['persistence'] = $type['persistence']; |
|
348 | } |
||
349 | |||
350 | 18 | if (isset($type['_parent'])) { |
|
351 | // _parent mapping cannot contain `property` and `identifier`, so removing them after building `persistence` |
||
352 | 4 | unset($indexConfig['types'][$name]['mapping']['_parent']['property'], $indexConfig['types'][$name]['mapping']['_parent']['identifier']); |
|
353 | } |
||
354 | |||
355 | 18 | if (isset($type['indexable_callback'])) { |
|
356 | 4 | $indexableCallbacks[sprintf('%s/%s', $indexName, $name)] = $this->buildCallback($type['indexable_callback'], $name); |
|
357 | } |
||
358 | |||
359 | 18 | if ($container->hasDefinition('fos_elastica.serializer_callback_prototype')) { |
|
360 | 1 | $typeSerializerId = sprintf('%s.serializer.callback', $typeId); |
|
361 | 1 | $typeSerializerDef = new ChildDefinition('fos_elastica.serializer_callback_prototype'); |
|
362 | |||
363 | 1 | if (isset($type['serializer']['groups'])) { |
|
364 | 1 | $typeSerializerDef->addMethodCall('setGroups', [$type['serializer']['groups']]); |
|
365 | } |
||
366 | |||
367 | 1 | if (isset($type['serializer']['serialize_null'])) { |
|
368 | 1 | $typeSerializerDef->addMethodCall('setSerializeNull', [$type['serializer']['serialize_null']]); |
|
369 | } |
||
370 | |||
371 | 1 | if (isset($type['serializer']['version'])) { |
|
372 | 1 | $typeSerializerDef->addMethodCall('setVersion', [$type['serializer']['version']]); |
|
373 | } |
||
374 | |||
375 | 1 | $typeDef->addMethodCall('setSerializer', [[new Reference($typeSerializerId), 'serialize']]); |
|
376 | 18 | $container->setDefinition($typeSerializerId, $typeSerializerDef); |
|
377 | } |
||
378 | } |
||
379 | 18 | } |
|
380 | |||
381 | 4 | private function buildCallback($indexCallback, $typeName) |
|
382 | { |
||
383 | 4 | if (is_array($indexCallback)) { |
|
384 | 4 | if (!isset($indexCallback[0])) { |
|
385 | throw new \InvalidArgumentException(sprintf('Invalid indexable_callback for type %s'), $typeName); |
||
386 | } |
||
387 | |||
388 | 4 | $classOrServiceRef = $this->transformServiceReference($indexCallback[0]); |
|
389 | 4 | if ($classOrServiceRef instanceof Reference && !isset($indexCallback[1])) { |
|
390 | return $classOrServiceRef; // __invoke |
||
391 | } |
||
392 | |||
393 | 4 | if (!isset($indexCallback[1])) { |
|
394 | throw new \InvalidArgumentException(sprintf('Invalid indexable_callback for type %s'), $typeName); |
||
395 | } |
||
396 | |||
397 | 4 | return [$classOrServiceRef, $indexCallback[1]]; |
|
398 | } |
||
399 | |||
400 | 4 | if (is_string($indexCallback)) { |
|
401 | 4 | return $this->transformServiceReference($indexCallback); |
|
402 | } |
||
403 | |||
404 | throw new \InvalidArgumentException(sprintf('Invalid indexable_callback for type %s'), $typeName); |
||
405 | } |
||
406 | |||
407 | 4 | private function transformServiceReference($classOrService) |
|
411 | |||
412 | /** |
||
413 | * Loads the optional provider and finder for a type. |
||
414 | * |
||
415 | * @param array $typeConfig |
||
416 | * @param ContainerBuilder $container |
||
417 | * @param Reference $typeRef |
||
418 | * @param string $indexName |
||
419 | * @param string $typeName |
||
420 | */ |
||
421 | 15 | private function loadTypePersistenceIntegration(array $typeConfig, ContainerBuilder $container, Reference $typeRef, $indexName, $typeName) |
|
422 | { |
||
423 | 15 | if (isset($typeConfig['driver'])) { |
|
424 | 15 | $this->loadDriver($container, $typeConfig['driver']); |
|
425 | } |
||
426 | |||
427 | 15 | $elasticaToModelTransformerId = $this->loadElasticaToModelTransformer($typeConfig, $container, $indexName, $typeName); |
|
428 | 15 | $modelToElasticaTransformerId = $this->loadModelToElasticaTransformer($typeConfig, $container, $indexName, $typeName); |
|
429 | 15 | $objectPersisterId = $this->loadObjectPersister($typeConfig, $typeRef, $container, $indexName, $typeName, $modelToElasticaTransformerId); |
|
430 | |||
431 | 15 | if (isset($typeConfig['provider'])) { |
|
432 | 15 | $this->loadTypePagerProvider($typeConfig, $container, $indexName, $typeName); |
|
433 | } |
||
434 | 15 | if (isset($typeConfig['finder'])) { |
|
435 | 15 | $this->loadTypeFinder($typeConfig, $container, $elasticaToModelTransformerId, $typeRef, $indexName, $typeName); |
|
436 | } |
||
437 | 15 | if (isset($typeConfig['listener']) && $typeConfig['listener']['enabled']) { |
|
438 | 14 | $this->loadTypeListener($typeConfig, $container, $objectPersisterId, $indexName, $typeName); |
|
439 | } |
||
440 | 15 | } |
|
441 | |||
442 | /** |
||
443 | * Creates and loads an ElasticaToModelTransformer. |
||
444 | * |
||
445 | * @param array $typeConfig |
||
446 | * @param ContainerBuilder $container |
||
447 | * @param string $indexName |
||
448 | * @param string $typeName |
||
449 | * |
||
450 | * @return string |
||
451 | */ |
||
452 | 15 | private function loadElasticaToModelTransformer(array $typeConfig, ContainerBuilder $container, $indexName, $typeName) |
|
474 | |||
475 | /** |
||
476 | * Creates and loads a ModelToElasticaTransformer for an index/type. |
||
477 | * |
||
478 | * @param array $typeConfig |
||
479 | * @param ContainerBuilder $container |
||
480 | * @param string $indexName |
||
481 | * @param string $typeName |
||
482 | * |
||
483 | * @return string |
||
484 | */ |
||
485 | 15 | private function loadModelToElasticaTransformer(array $typeConfig, ContainerBuilder $container, $indexName, $typeName) |
|
505 | |||
506 | /** |
||
507 | * Creates and loads an object persister for a type. |
||
508 | * |
||
509 | * @param array $typeConfig |
||
510 | * @param Reference $typeRef |
||
511 | * @param ContainerBuilder $container |
||
512 | * @param string $indexName |
||
513 | * @param string $typeName |
||
514 | * @param string $transformerId |
||
515 | * |
||
516 | * @return string |
||
517 | */ |
||
518 | 15 | private function loadObjectPersister(array $typeConfig, Reference $typeRef, ContainerBuilder $container, $indexName, $typeName, $transformerId) |
|
558 | |||
559 | /** |
||
560 | * Loads a pager provider for a type. |
||
561 | * |
||
562 | * @param array $typeConfig |
||
563 | * @param ContainerBuilder $container |
||
564 | * @param string $indexName |
||
565 | * @param string $typeName |
||
566 | * |
||
567 | * @return string |
||
568 | */ |
||
569 | 15 | private function loadTypePagerProvider(array $typeConfig, ContainerBuilder $container, $indexName, $typeName) |
|
613 | |||
614 | /** |
||
615 | * Loads doctrine listeners to handle indexing of new or updated objects. |
||
616 | * |
||
617 | * @param array $typeConfig |
||
618 | * @param ContainerBuilder $container |
||
619 | * @param string $objectPersisterId |
||
620 | * @param string $indexName |
||
621 | * @param string $typeName |
||
622 | * |
||
623 | * @return string |
||
624 | */ |
||
625 | 14 | private function loadTypeListener(array $typeConfig, ContainerBuilder $container, $objectPersisterId, $indexName, $typeName) |
|
686 | |||
687 | /** |
||
688 | * Map Elastica to Doctrine events for the current driver. |
||
689 | */ |
||
690 | 14 | private function getDoctrineEvents(array $typeConfig) |
|
722 | |||
723 | /** |
||
724 | * Loads a Type specific Finder. |
||
725 | * |
||
726 | * @param array $typeConfig |
||
727 | * @param ContainerBuilder $container |
||
728 | * @param string $elasticaToModelId |
||
729 | * @param Reference $typeRef |
||
730 | * @param string $indexName |
||
731 | * @param string $typeName |
||
732 | * |
||
733 | * @return string |
||
734 | */ |
||
735 | 15 | private function loadTypeFinder(array $typeConfig, ContainerBuilder $container, $elasticaToModelId, Reference $typeRef, $indexName, $typeName) |
|
762 | |||
763 | /** |
||
764 | * Loads the index manager. |
||
765 | * |
||
766 | * @param ContainerBuilder $container |
||
767 | **/ |
||
768 | View Code Duplication | private function loadIndexManager(ContainerBuilder $container) |
|
777 | |||
778 | /** |
||
779 | * Load index template manager |
||
780 | * |
||
781 | * @param ContainerBuilder $container |
||
782 | * |
||
783 | * @return void |
||
784 | */ |
||
785 | View Code Duplication | private function loadIndexTemplateManager(ContainerBuilder $container) |
|
794 | |||
795 | /** |
||
796 | * Makes sure a specific driver has been loaded. |
||
797 | * |
||
798 | * @param ContainerBuilder $container |
||
799 | * @param string $driver |
||
800 | */ |
||
801 | 15 | private function loadDriver(ContainerBuilder $container, $driver) |
|
811 | |||
812 | /** |
||
813 | * Loads and configures the serializer prototype. |
||
814 | * |
||
815 | * @param array $config |
||
816 | * @param ContainerBuilder $container |
||
817 | */ |
||
818 | 1 | private function loadSerializer($config, ContainerBuilder $container) |
|
829 | |||
830 | /** |
||
831 | * Creates a default manager alias for defined default manager or the first loaded driver. |
||
832 | * |
||
833 | * @param string $defaultManager |
||
834 | * @param ContainerBuilder $container |
||
835 | */ |
||
836 | 18 | private function createDefaultManagerAlias($defaultManager, ContainerBuilder $container) |
|
855 | |||
856 | /** |
||
857 | * Returns a reference to a client given its configured name. |
||
858 | * |
||
859 | * @param string $clientName |
||
860 | * |
||
861 | * @return Reference |
||
862 | * |
||
863 | * @throws \InvalidArgumentException |
||
864 | */ |
||
865 | 2 | private function getClient($clientName) |
|
873 | } |
||
874 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.