Conditions | 3 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public static function install(MoufManager $moufManager) |
||
19 | { |
||
20 | $cascadingTranslator = InstallUtils::getOrCreateInstance("defaultTranslationService", "Mouf\\Utils\\I18n\\Fine\\Common\\FineCascadingTranslator", $moufManager); |
||
21 | |||
22 | if ($moufManager->has('twigEnvironment') && !$moufManager->has('fineTwigExtension')) { |
||
23 | $fineTwigExtension = $moufManager->createInstance(FineTwigExtension::class); |
||
24 | |||
25 | $fineTwigExtension->getConstructorArgumentProperty('translator')->setValue($cascadingTranslator); |
||
26 | |||
27 | $twigEnvironment = $moufManager->getInstanceDescriptor('twigEnvironment'); |
||
28 | $extensions = $twigEnvironment->getSetterProperty('setExtensions')->getValue(); |
||
29 | $extensions[] = $fineTwigExtension; |
||
30 | $twigEnvironment->getSetterProperty('setExtensions')->setValue($extensions); |
||
31 | } |
||
32 | |||
33 | // Let's rewrite the MoufComponents.php file to save the component |
||
34 | $moufManager->rewriteMouf(); |
||
35 | } |
||
36 | } |
||
37 |