EzPublishLegacySearchEngineBundle::build()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
namespace eZ\Bundle\EzPublishLegacySearchEngineBundle;
8
9
use Symfony\Component\HttpKernel\Bundle\Bundle;
10
use Symfony\Component\DependencyInjection\ContainerBuilder;
11
use eZ\Publish\Core\Base\Container\Compiler\Search\Legacy\CriteriaConverterPass;
12
use eZ\Publish\Core\Base\Container\Compiler\Search\Legacy\CriterionFieldValueHandlerRegistryPass;
13
use eZ\Publish\Core\Base\Container\Compiler\Search\Legacy\SortClauseConverterPass;
14
use eZ\Publish\Core\Base\Container\Compiler\Search\FieldRegistryPass;
15
16
class EzPublishLegacySearchEngineBundle extends Bundle
17
{
18
    public function build(ContainerBuilder $container)
19
    {
20
        parent::build($container);
21
22
        $container->addCompilerPass(new CriteriaConverterPass());
23
        $container->addCompilerPass(new CriterionFieldValueHandlerRegistryPass());
24
        $container->addCompilerPass(new SortClauseConverterPass());
25
        $container->addCompilerPass(new FieldRegistryPass());
26
    }
27
28
    public function getContainerExtension()
29
    {
30
        if (!isset($this->extension)) {
31
            $this->extension = new DependencyInjection\EzPublishLegacySearchEngineExtension();
32
        }
33
34
        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 34 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...
35
    }
36
}
37