DoctrineOci8Extension::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 2
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
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