Passed
Pull Request — master (#1)
by Pol
09:35 queued 35s
created

DoctrineOci8Extension::prepend()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 14
ccs 6
cts 6
cp 1
rs 9.9666
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EcPhp\DoctrineOci8Bundle\DependencyInjection;
6
7
use EcPhp\DoctrineOci8\Doctrine\DBAL\Driver\OCI8\Driver;
8
use EcPhp\DoctrineOci8\Doctrine\DBAL\Types\CursorType;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
11
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
12
13
class DoctrineOci8Extension extends Extension implements PrependExtensionInterface
14
{
15 1
    public function load(array $configs, ContainerBuilder $container): void
16
    {
17
        // noop
18 1
    }
19
20 2
    public function prepend(ContainerBuilder $container)
21
    {
22 2
        if (false === $container->hasExtension('doctrine')) {
23 1
            return false;
24
        }
25
26
        $container
27 1
            ->loadFromExtension(
28 1
                'doctrine',
29
                [
30
                    'dbal' => [
31 1
                        'driver_class' => Driver::class,
32
                        'types' => [
33
                            'cursor' => CursorType::class,
34
                        ],
35
                    ],
36
                ],
37
            );
38 1
    }
39
}
40