Configuration::setContainer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Liip\MonitorBundle\DoctrineMigrations;
4
5
use Doctrine\Bundle\MigrationsBundle\Command\DoctrineCommand;
6
use Doctrine\Migrations\Configuration\Configuration as BaseConfiguration;
7
use Symfony\Component\DependencyInjection\ContainerInterface;
8
9
/**
10
 * Class Configuration.
11
 */
12
class Configuration extends BaseConfiguration
13
{
14
    /**
15
     * Flag whether doctrine migrations bundle is installed.
16
     *
17
     * @var bool
18
     */
19
    private static $haveMigrationBundle;
20
21
    /**
22
     * Service container.
23
     *
24
     * @var ContainerInterface
25
     */
26
    private $container;
27
28
    /**
29
     * Set service container.
30
     *
31
     * @param ContainerInterface $container Service container
32
     *
33
     * @return void
34
     */
35
    public function setContainer(ContainerInterface $container)
36
    {
37
        $this->container = $container;
38
    }
39
40
    /**
41
     * Tune this configuration parameters according to migrations bundle.
42
     *
43
     * @return void
44
     */
45
    public function configure()
46
    {
47
        if (null === self::$haveMigrationBundle) {
48
            self::$haveMigrationBundle = class_exists(DoctrineCommand::class);
49
        }
50
51
        if (!self::$haveMigrationBundle) {
52
            return;
53
        }
54
55
        DoctrineCommand::configureMigrations($this->container, $this);
56
    }
57
}
58