Completed
Push — master ( 57209e...689d32 )
by Tobias
96:45 queued 61:24
created

FileDumperBackupPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 12
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 9 2
1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[email protected]>
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 Translation\Bundle\DependencyInjection\CompilerPass;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\HttpKernel\Kernel;
17
18
/**
19
 * The FileDumper::setBackup is deprecated since Symfony 4.1.
20
 * This compiler pass assures our service definition remains unchanged for older symfony versions (3 or lower)
21
 * while keeping the latest version clean of deprecation notices.
22
 */
23
class FileDumperBackupPass implements CompilerPassInterface
24
{
25
    public function process(ContainerBuilder $container)
26
    {
27
        if (Kernel::MAJOR_VERSION >= 4) {
28
            return;
29
        }
30
31
        $definition = $container->getDefinition('php_translation.storage.xlf_dumper');
32
        $definition->addMethodCall('setBackup', [false]);
33
    }
34
}
35