Completed
Push — master ( 8a683b...96b103 )
by Matthew
05:26 queued 53s
created

BeanstalkdCompilerPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 16
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 13 3
1
<?php
2
3
namespace Dtc\QueueBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\Definition;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
class BeanstalkdCompilerPass implements CompilerPassInterface
11
{
12 1
    public function process(ContainerBuilder $container)
13
    {
14 1
        if ($container->hasParameter('dtc_queue.beanstalkd.host')) {
15 1
            $definition = new Definition('Pheanstalk\\Pheanstalk',
16 1
                [$container->getParameter('dtc_queue.beanstalkd.host')]);
17 1
            $container->setDefinition('dtc_queue.beanstalkd', $definition);
18 1
            $definition = $container->getDefinition('dtc_queue.job_manager.beanstalkd');
19 1
            $definition->addMethodCall('setBeanstalkd', [new Reference('dtc_queue.beanstalkd')]);
20 1
            if ($container->hasParameter('dtc_queue.beanstalkd.tube')) {
21 1
                $definition->addMethodCall('setTube', [$container->getParameter('dtc_queue.beanstalkd.tube')]);
22 1
            }
23 1
        }
24 1
    }
25
}
26