Completed
Push — foshttpcache_remove ( fe84f8...3c57a5 )
by André
32:47 queued 09:27
created

EzPublishCoreBundle::getContainerExtension()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 32
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 21
nc 2
nop 0
dl 0
loc 32
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * File containing the EzPublishCoreBundle class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Bundle\EzPublishCoreBundle;
10
11
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\AsseticPass;
12
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\BinaryContentDownloadPass;
13
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ComplexSettingsPass;
14
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ConfigResolverParameterPass;
15
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\FieldTypeParameterProviderRegistryPass;
16
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\FragmentPass;
17
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ImaginePass;
18
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\QueryTypePass;
19
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\RegisterSearchEngineIndexerPass;
20
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\RegisterSearchEnginePass;
21
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\RegisterStorageEnginePass;
22
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ChainRoutingPass;
23
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ChainConfigResolverPass;
24
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\LocalePass;
25
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ContentViewPass;
26
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\LocationViewPass;
27
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\BlockViewPass;
28
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\RouterPass;
29
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\SecurityPass;
30
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\SignalSlotPass;
31
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\TranslationCollectorPass;
32
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ViewProvidersPass;
33
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\RichTextHtml5ConverterPass;
34
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\StorageConnectionPass;
35
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ComplexSettings\ComplexSettingParser;
36
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\DynamicSettingParser;
37
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Security\PolicyProvider\RepositoryPolicyProvider;
38
use eZ\Publish\Core\Base\Container\Compiler\FieldTypeCollectionPass;
39
use eZ\Publish\Core\Base\Container\Compiler\FieldTypeNameableCollectionPass;
40
use eZ\Publish\Core\Base\Container\Compiler\RegisterLimitationTypePass;
41
use eZ\Publish\Core\Base\Container\Compiler\Storage\ExternalStorageRegistryPass;
42
use eZ\Publish\Core\Base\Container\Compiler\Storage\Legacy\FieldValueConverterRegistryPass;
43
use eZ\Publish\Core\Base\Container\Compiler\Storage\Legacy\RoleLimitationConverterPass;
44
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\EzPublishCoreExtension;
45
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser as ConfigParser;
46
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Security\HttpBasicFactory;
47
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\URLHandlerPass;
48
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
49
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
50
use Symfony\Component\HttpKernel\Bundle\Bundle;
51
use Symfony\Component\DependencyInjection\ContainerBuilder;
52
53
class EzPublishCoreBundle extends Bundle
54
{
55
    public function build(ContainerBuilder $container)
56
    {
57
        parent::build($container);
58
        $container->addCompilerPass(new FieldTypeCollectionPass(), PassConfig::TYPE_OPTIMIZE);
59
        $container->addCompilerPass(new FieldTypeNameableCollectionPass(), PassConfig::TYPE_OPTIMIZE);
60
        $container->addCompilerPass(new FieldTypeParameterProviderRegistryPass());
61
        $container->addCompilerPass(new ChainRoutingPass());
62
        $container->addCompilerPass(new ChainConfigResolverPass());
63
        $container->addCompilerPass(new RegisterLimitationTypePass());
64
        $container->addCompilerPass(new RegisterStorageEnginePass());
65
        $container->addCompilerPass(new RegisterSearchEnginePass());
66
        $container->addCompilerPass(new RegisterSearchEngineIndexerPass());
67
        $container->addCompilerPass(new LocalePass());
68
        $container->addCompilerPass(new ContentViewPass());
0 ignored issues
show
Deprecated Code introduced by
The class eZ\Bundle\EzPublishCoreB...ompiler\ContentViewPass has been deprecated with message: since 6.0

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
69
        $container->addCompilerPass(new LocationViewPass());
0 ignored issues
show
Deprecated Code introduced by
The class eZ\Bundle\EzPublishCoreB...mpiler\LocationViewPass has been deprecated with message: since 6.0

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
70
        $container->addCompilerPass(new BlockViewPass());
0 ignored issues
show
Deprecated Code introduced by
The class eZ\Bundle\EzPublishCoreB...\Compiler\BlockViewPass has been deprecated with message: since 6.0

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
71
        $container->addCompilerPass(new SignalSlotPass());
72
        $container->addCompilerPass(new RouterPass());
73
        $container->addCompilerPass(new SecurityPass());
74
        $container->addCompilerPass(new RichTextHtml5ConverterPass());
75
        $container->addCompilerPass(new FragmentPass());
76
        $container->addCompilerPass(new StorageConnectionPass());
77
        $container->addCompilerPass(new ImaginePass());
78
        $container->addCompilerPass(new ComplexSettingsPass(new ComplexSettingParser()));
79
        $container->addCompilerPass(new ConfigResolverParameterPass(new DynamicSettingParser()));
80
        $container->addCompilerPass(new AsseticPass());
81
        $container->addCompilerPass(new URLHandlerPass());
82
        $container->addCompilerPass(new BinaryContentDownloadPass());
83
        $container->addCompilerPass(new ViewProvidersPass());
84
85
        // Storage passes
86
        $container->addCompilerPass(new ExternalStorageRegistryPass());
87
        // Legacy Storage passes
88
        $container->addCompilerPass(new FieldValueConverterRegistryPass());
89
        $container->addCompilerPass(new RoleLimitationConverterPass());
90
        $container->addCompilerPass(new QueryTypePass());
91
92
        $securityExtension = $container->getExtension('security');
93
        $securityExtension->addSecurityListenerFactory(new HttpBasicFactory());
0 ignored issues
show
Deprecated Code introduced by
The class eZ\Bundle\EzPublishCoreB...curity\HttpBasicFactory has been deprecated with message: Use http_basic in security.yml instead of ezpublish_http_basic

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
94
        $container->addCompilerPass(new TranslationCollectorPass());
95
    }
96
97
    public function getContainerExtension()
98
    {
99
        if (!isset($this->extension)) {
100
            $this->extension = new EzPublishCoreExtension(
101
                array(
102
                    // LocationView config parser needs to be specified AFTER ContentView config
103
                    // parser since it is used to convert location view override rules to content
104
                    // view override rules. If it were specified before, ContentView provider would
105
                    // just undo the conversion LocationView did.
106
                    new ConfigParser\ContentView(),
107
                    new ConfigParser\LocationView(),
108
                    new ConfigParser\BlockView(),
109
                    new ConfigParser\Common(),
110
                    new ConfigParser\Content(),
111
                    new ConfigParser\FieldType\RichText(),
112
                    new ConfigParser\FieldTemplates(),
113
                    new ConfigParser\FieldEditTemplates(),
114
                    new ConfigParser\FieldDefinitionSettingsTemplates(),
115
                    new ConfigParser\FieldDefinitionEditTemplates(),
116
                    new ConfigParser\Image(),
117
                    new ConfigParser\Page(),
118
                    new ConfigParser\Languages(),
119
                    new ConfigParser\IO(new ComplexSettingParser()),
120
                    new ConfigParser\UrlChecker(),
121
                )
122
            );
123
124
            $this->extension->addPolicyProvider(new RepositoryPolicyProvider());
125
        }
126
127
        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 127 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...
128
    }
129
}
130