DoctrineOci8Extension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 10
c 1
b 0
f 0
dl 0
loc 21
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A prepend() 0 14 2
A load() 0 2 1
1
<?php
2
3
/**
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 *
7
 * @see https://github.com/ecphp
8
 */
9
10
declare(strict_types=1);
11
12
namespace EcPhp\DoctrineOci8Bundle\DependencyInjection;
13
14
use EcPhp\DoctrineOci8\Doctrine\DBAL\Driver\OCI8\Driver;
15
use EcPhp\DoctrineOci8\Doctrine\DBAL\Types\CursorType;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
18
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
19
20
class DoctrineOci8Extension extends Extension implements PrependExtensionInterface
21
{
22
    public function load(array $configs, ContainerBuilder $container): void
23
    {
24
        // noop
25
    }
26
27 2
    public function prepend(ContainerBuilder $container)
28
    {
29 2
        if (false === $container->hasExtension('doctrine')) {
30 1
            return false;
31
        }
32
33
        $container
34 1
            ->loadFromExtension(
35
                'doctrine',
36
                [
37
                    'dbal' => [
38
                        'driver_class' => Driver::class,
39
                        'types' => [
40
                            'cursor' => CursorType::class,
41
                        ],
42
                    ],
43
                ],
44
            );
45
    }
46
}
47