ZenstruckFoundryBundle::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 4
ccs 3
cts 4
cp 0.75
crap 2.0625
rs 10
1
<?php
2
3
namespace Zenstruck\Foundry;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
7
use Symfony\Component\HttpKernel\Bundle\Bundle;
8
use Zenstruck\Foundry\Bundle\DependencyInjection\ChainManagerRegistryPass;
9
use Zenstruck\Foundry\Bundle\DependencyInjection\ZenstruckFoundryExtension;
10
11
/**
12
 * Must be at src root to be auto-configured by Symfony Flex.
13
 *
14
 * @author Kevin Bond <[email protected]>
15
 */
16 308
final class ZenstruckFoundryBundle extends Bundle
17
{
18 308
    public function boot(): void
19 256
    {
20
        if (!Factory::isBooted()) {
21 308
            Factory::boot($this->container->get(Configuration::class));
0 ignored issues
show
Bug introduced by
It seems like $this->container->get(Ze...y\Configuration::class) can also be of type null; however, parameter $configuration of Zenstruck\Foundry\Factory::boot() does only seem to accept Zenstruck\Foundry\Configuration, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

21
            Factory::boot(/** @scrutinizer ignore-type */ $this->container->get(Configuration::class));
Loading history...
22
        }
23 4
    }
24
25 4
    public function build(ContainerBuilder $container): void
26
    {
27
        parent::build($container);
28
29
        $container->addCompilerPass(new ChainManagerRegistryPass());
30
    }
31
32
    protected function createContainerExtension(): ?ExtensionInterface
33
    {
34
        return new ZenstruckFoundryExtension();
35
    }
36
}
37