XabbuhXApiClientBundle::build()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the xAPI package.
5
 *
6
 * (c) Christian Flothmann <[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 Xabbuh\XApi\Bundle\ClientBundle;
13
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
use Symfony\Component\HttpKernel\Bundle\Bundle;
16
use Xabbuh\XApi\Bundle\ClientBundle\DependencyInjection\Compiler\RegisterClientsPass;
17
use Xabbuh\XApi\Bundle\ClientBundle\DependencyInjection\Compiler\RegisterSerializerMetadataPass;
18
use Xabbuh\XApi\Bundle\ClientBundle\DependencyInjection\XabbuhXApiClientExtension;
19
20
/**
21
 * Experience API client bundle.
22
 *
23
 * @author Christian Flothmann <[email protected]>
24
 */
25
class XabbuhXApiClientBundle extends Bundle
26
{
27
    /**
28
     * {@inheritDoc}
29
     */
30
    public function build(ContainerBuilder $container)
31
    {
32
        $container->addCompilerPass(new RegisterClientsPass());
33
        $container->addCompilerPass(new RegisterSerializerMetadataPass());
34
    }
35
36
    /**
37
     * {@inheritDoc}
38
     */
39
    public function getContainerExtension()
40
    {
41
        if (null === $this->extension) {
42
            $this->extension = new XabbuhXApiClientExtension();
43
        }
44
45
        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 45 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...
46
    }
47
}
48