| Conditions | 6 |
| Paths | 5 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | 5 | public function process(ContainerBuilder $container) |
|
| 29 | { |
||
| 30 | 5 | if (!$container->hasDefinition('runopencode.exchange_rate.notifications.email')) { |
|
| 31 | 1 | return; |
|
| 32 | } |
||
| 33 | |||
| 34 | 4 | if (!$container->hasParameter('runopencode.exchange_rate.notifications.email.recipients')) { |
|
| 35 | 1 | $container->removeDefinition('runopencode.exchange_rate.notifications.email'); |
|
| 36 | 1 | return; |
|
| 37 | } |
||
| 38 | |||
| 39 | 3 | if (!$container->hasDefinition('mailer') || !class_exists('\\Symfony\\Bundle\\SwiftmailerBundle\\SwiftmailerBundle')) { |
|
| 40 | 1 | throw new RuntimeException('Bundle "symfony/swiftmailer-bundle" is required for email notifications.'); |
|
| 41 | } |
||
| 42 | |||
| 43 | 2 | $recipients = $container->getParameter('runopencode.exchange_rate.notifications.email.recipients'); |
|
| 44 | |||
| 45 | 2 | if (0 === count($recipients)) { |
|
| 46 | 1 | throw new RuntimeException('At least one recipient for e-mail notifications must be provided.'); |
|
| 47 | } |
||
| 48 | |||
| 49 | $container |
||
| 50 | 1 | ->getDefinition('runopencode.exchange_rate.notifications.email') |
|
| 51 | 1 | ->setArgument(2, $recipients); |
|
| 52 | 1 | } |
|
| 53 | } |
||
| 54 |