Passed
Push — feature/unit-tests ( 84c996...7c5ff9 )
by Daniel
05:24
created

SilverbackApiComponentBundle::build()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 5
c 4
b 0
f 0
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Component Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentBundle;
15
16
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
17
use Silverback\ApiComponentBundle\DependencyInjection\CompilerPass\ApiPlatformCompilerPass;
18
use Silverback\ApiComponentBundle\DependencyInjection\CompilerPass\DoctrineCompilerPass;
19
use Silverback\ApiComponentBundle\DependencyInjection\CompilerPass\ImagineCompilerPass;
20
use Symfony\Component\DependencyInjection\ContainerBuilder;
21
use Symfony\Component\HttpKernel\Bundle\Bundle;
22
use function class_exists;
23
24
/**
25
 * @author Daniel West <[email protected]>
26
 */
27
class SilverbackApiComponentBundle extends Bundle
28
{
29 1
    public function build(ContainerBuilder $container): void
30
    {
31 1
        parent::build($container);
32 1
        if (class_exists(DoctrineOrmMappingsPass::class)) {
33 1
            $container->addCompilerPass(new DoctrineCompilerPass());
34
        }
35 1
        $container->addCompilerPass(new ImagineCompilerPass());
36 1
        $container->addCompilerPass(new ApiPlatformCompilerPass());
37 1
    }
38
}
39