LoggerPass::process()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 9.9
cc 3
nc 2
nop 1
crap 3
1
<?php
2
3
/*
4
 * This file is part of the FOSHttpCacheBundle package.
5
 *
6
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\HttpCacheBundle\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
17
/**
18
 * Announce the log listener to the symfony event system.
19
 */
20
class LoggerPass implements CompilerPassInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25 4
    public function process(ContainerBuilder $container)
26
    {
27 4
        if (!$container->has('logger') || !$container->has('fos_http_cache.event_listener.log')) {
28 1
            return;
29
        }
30
31 3
        $container->getDefinition('fos_http_cache.event_listener.log')
32 3
            ->setAbstract(false)
33 3
            ->addTag('kernel.event_subscriber')
34
        ;
35 3
    }
36
}
37