MenuBundle::getContainerExtension()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
nc 2
nop 0
dl 0
loc 11
rs 10
c 2
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Braunstetter\MenuBundle;
6
7
use Braunstetter\MenuBundle\DependencyInjection\MenuBundleExtension;
8
use Symfony\Component\HttpKernel\Bundle\Bundle;
9
use Webmozart\Assert\Assert;
10
11
class MenuBundle extends Bundle
12
{
13
    public function getContainerExtension(): ?MenuBundleExtension
14
    {
15
        if ($this->extension === null) {
16
            $this->extension = new MenuBundleExtension();
17
        }
18
        Assert::isInstanceOf(
19
            $this->extension,
20
            MenuBundleExtension::class,
21
            'The extension must be an instance of MenuBundleExtension'
22
        );
23
        return $this->extension;
24
    }
25
}
26