WebuniCommonMarkBundle::getContainerExtension()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
/*
4
 * This is part of the webuni/commonmark-bundle package.
5
 *
6
 * (c) Martin Hasoň <[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
namespace Webuni\Bundle\CommonMarkBundle;
13
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
use Symfony\Component\HttpKernel\Bundle\Bundle;
16
use Webuni\Bundle\CommonMarkBundle\DependencyInjection\Compiler\CommonMarkExtensionPass;
17
use Webuni\Bundle\CommonMarkBundle\DependencyInjection\WebuniCommonMarkExtension;
18
19
class WebuniCommonMarkBundle extends Bundle
20
{
21
    public function build(ContainerBuilder $container)
22
    {
23
        $container->addCompilerPass(new CommonMarkExtensionPass());
24
    }
25
26
    public function getContainerExtension()
27
    {
28
        if (null === $this->extension) {
29
            $this->extension = new WebuniCommonMarkExtension();
30
        }
31
32
        return $this->extension;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression $this->extension; of type Symfony\Component\Depend...xtensionInterface|false adds false to the return on line 32 which is incompatible with the return type declared by the interface Symfony\Component\HttpKe...::getContainerExtension of type Symfony\Component\Depend...ExtensionInterface|null. It seems like you forgot to handle an error condition.
Loading history...
33
    }
34
}
35