RegisterSwiftmailerConfiguratorCompilerPass   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 30
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A process() 0 11 3
1
<?php
2
3
namespace Yokai\MessengerBundle\DependencyInjection\CompilerPass;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Yokai\DependencyInjection\CompilerPass\ArgumentRegisterTaggedServicesCompilerPass;
7
use Yokai\MessengerBundle\Channel\Swiftmailer\Configurator\SwiftMessageConfiguratorInterface;
8
9
/**
10
 * @author Yann Eugoné <[email protected]>
11
 */
12
class RegisterSwiftmailerConfiguratorCompilerPass extends ArgumentRegisterTaggedServicesCompilerPass
13
{
14
    /**
15
     * Constructor
16
     */
17 15
    public function __construct()
18
    {
19 15
        parent::__construct(
20 15
            'yokai_messenger.swiftmailer_chain_message_configurator',
21 15
            'yokai_messenger.swiftmailer_message_configurator',
22 15
            SwiftMessageConfiguratorInterface::class,
23
            0
24
        );
25 15
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30 11
    public function process(ContainerBuilder $container)
31
    {
32
        // If swiftmailer is not enabled just return (avoid exceptions)
33 11
        if (!$container->hasParameter('yokai_messenger.swiftmailer_enabled') ||
34 11
            !$container->getParameter('yokai_messenger.swiftmailer_enabled')
35
        ) {
36 7
            return;
37
        }
38
39 4
        parent::process($container);
40 4
    }
41
}
42