Conditions | 4 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | public function process(ContainerBuilder $container) |
||
23 | { |
||
24 | if (!$container->hasDefinition('translator.default')) { |
||
25 | return; |
||
26 | } |
||
27 | |||
28 | $translator = $container->findDefinition('translator.default'); |
||
29 | |||
30 | $finder = Finder::create() |
||
31 | ->files() |
||
32 | ->filter(function (\SplFileInfo $file) { |
||
33 | return 2 === substr_count($file->getBasename(), '.') && preg_match('/\.\w+$/', $file->getBasename()); |
||
34 | }) |
||
35 | ->in(__DIR__.'/../../../../Resources/translations') |
||
36 | ; |
||
37 | |||
38 | foreach ($finder as $file) { |
||
39 | list($domain, $locale, $format) = explode('.', $file->getBasename(), 3); |
||
40 | $translator->addMethodCall('addResource', [$format, (string) $file, $locale, $domain]); |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 |