Completed
Push — master ( 1494d2...398a9b )
by dan
02:07
created

ChannelFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 22 1
1
<?php
2
3
namespace IrishDan\NotificationBundle\DependencyInjection\Factory;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Definition;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class ChannelFactory
10
{
11
    public function create(ContainerBuilder $container, $channel, array $config = [])
0 ignored issues
show
Unused Code introduced by
The parameter $config is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
12
    {
13
        $definition = new Definition();
14
        $definition->setClass('IrishDan\NotificationBundle\Channel\DirectChannel');
15
        $definition->setArguments(
16
            [
17
                '%notification.channel.' . $channel . '.enabled%',
18
                '%notification.channel.' . $channel . '.configuration%',
19
            ]
20
        );
21
22
        $adapter = new Reference('notification.adapter.' . $channel);
23
        $eventDispatcher = new Reference('event_dispatcher');
24
25
        $definition->setMethodCalls(
26
            [
27
                ['setAdapter', [$adapter]],
28
                ['setEventDispatcher', [$eventDispatcher]],
29
            ]
30
        );
31
        $container->setDefinition('notification.channel.' . $channel, $definition);
32
    }
33
}
34