Conditions | 4 |
Paths | 4 |
Total Lines | 26 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4.7691 |
Changes | 0 |
1 | <?php |
||
13 | public function process(ContainerBuilder $container): void |
||
14 | { |
||
15 | if (!$container->hasDefinition('incenteev_translation_checker.exposing_translator')) { |
||
16 | 1 | return; |
|
17 | } |
||
18 | |||
19 | if (!$container->has('translator.default')) { |
||
20 | 1 | return; |
|
21 | } |
||
22 | |||
23 | 1 | $translatorDef = $container->findDefinition('translator.default'); |
|
24 | 1 | ||
25 | $optionsArgumentIndex = 4; |
||
26 | |||
27 | $options = $translatorDef->getArgument($optionsArgumentIndex); |
||
28 | |||
29 | 1 | if (!is_array($options)) { |
|
30 | // Weird setup. Reset all options |
||
31 | 1 | $options = array(); |
|
32 | } |
||
33 | |||
34 | // use a separate cache as we have no fallback locales |
||
35 | $options['cache_dir'] = '%kernel.cache_dir%/incenteev_translations'; |
||
36 | |||
37 | 1 | $container->findDefinition('incenteev_translation_checker.exposing_translator') |
|
38 | ->replaceArgument($optionsArgumentIndex, $options); |
||
39 | 1 | } |
|
41 |