Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
18 | 6 | public function process(ContainerBuilder $container) |
|
19 | { |
||
20 | 6 | if (false === $container->hasParameter('liip_monitor.mailer.enabled')) { |
|
21 | 2 | return; |
|
22 | } |
||
23 | |||
24 | 4 | if (false === $container->getParameter('liip_monitor.mailer.enabled')) { |
|
25 | 1 | return; |
|
26 | } |
||
27 | |||
28 | 3 | if (!$container->hasDefinition('mailer')) { |
|
29 | 1 | throw new \InvalidArgumentException('To enable mail reporting you have to install the "swiftmailer/swiftmailer" or "symfony/mailer".'); |
|
30 | } |
||
31 | |||
32 | 2 | $definition = $container->getDefinition('mailer'); |
|
33 | 2 | $filename = \Swift_Mailer::class !== $definition->getClass() ? 'symfony_mailer.xml' : 'swift_mailer.xml'; |
|
34 | |||
35 | 2 | $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../../Resources/config')); |
|
36 | 2 | $loader->load($filename); |
|
37 | 2 | } |
|
38 | } |
||
39 |