Completed
Push — master ( 4e719a...6b75eb )
by David
04:31
created

SessionListenerRemovePass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 60%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 14
ccs 3
cts 5
cp 0.6
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 8 2
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
 * Remove the session listener decorator again if the application has no session listener.
19
 *
20
 * This will happen on some APIs when the session system is not activated.
21
 */
22
class SessionListenerRemovePass implements CompilerPassInterface
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27 2
    public function process(ContainerBuilder $container)
28
    {
29 2
        if ($container->has('session_listener')) {
30 2
            return;
31
        }
32
33
        $container->removeDefinition('fos_http_cache.user_context.session_listener');
34
    }
35
}
36