getServicesIdList()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hgraca\DoctrineTestDbRegenerationBundle\DependencyInjection;
6
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
9
10
class HgracaDoctrineTestDbRegenerationExtension extends Extension
11
{
12
    /**
13
     * @var array
14
     */
15
    private $processedConfig;
16
17 10
    public function load(array $configs, ContainerBuilder $containerBuilder): void
18
    {
19 10
        $configuration = new Configuration();
20 10
        $this->processedConfig = $this->processConfiguration($configuration, $configs);
21
22 10
        $containerBuilder->setParameter(
23 10
            Configuration::ROOT . '.' . Configuration::FIXTURES_LOADER_SERVICE_ID,
24 10
            $this->getFixturesLoaderServiceId()
25
        );
26
27 10
        $containerBuilder->setParameter(
28 10
            Configuration::ROOT . '.' . Configuration::DOCTRINE_SERVICE_ID,
29 10
            $this->getDoctrineServiceId()
30
        );
31
32 10
        $containerBuilder->setParameter(
33 10
            Configuration::ROOT . '.' . Configuration::TEST_DB_BKP_PATH,
34 10
            $this->getTestDbBkpPath()
35
        );
36 10
    }
37
38 10
    public function getFixturesLoaderServiceId(): string
39
    {
40 10
        return $this->processedConfig[Configuration::FIXTURES_LOADER_SERVICE_ID];
41
    }
42
43 10
    public function getDoctrineServiceId(): string
44
    {
45 10
        return $this->processedConfig[Configuration::DOCTRINE_SERVICE_ID];
46
    }
47
48 10
    public function getTestDbBkpPath(): string
49
    {
50 10
        return $this->processedConfig[Configuration::TEST_DB_BKP_PATH];
51
    }
52
53 8
    private function getExtraServiceList(): array
54
    {
55 8
        return $this->processedConfig[Configuration::EXTRA_SERVICE_LIST] ?? [];
56
    }
57
58
    /**
59
     * @return string[]
60
     */
61 8
    public function getServicesIdList(): array
62
    {
63 8
        return array_merge(
64
            [
65 8
                $this->getFixturesLoaderServiceId(),
66 8
                $this->getDoctrineServiceId(),
67
            ],
68 8
            $this->getExtraServiceList()
69
        );
70
    }
71
}
72