Completed
Push — ezp_30981_content_info_proxy ( 01dade...014174 )
by
unknown
14:51
created

EzPublishCoreBundle::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
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\BinaryContentDownloadPass;
12
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ComplexSettingsPass;
13
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ConfigResolverParameterPass;
14
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ConsoleCacheWarmupPass;
15
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\FieldTypeParameterProviderRegistryPass;
16
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\FragmentPass;
17
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ViewMatcherRegistryPass;
18
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\NotificationRendererPass;
19
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\PlaceholderProviderPass;
20
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ImaginePass;
21
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\QueryTypePass;
22
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\RegisterSearchEngineIndexerPass;
23
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\RegisterSearchEnginePass;
24
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\RegisterStorageEnginePass;
25
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ChainRoutingPass;
26
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ChainConfigResolverPass;
27
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ContentViewPass;
28
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\LocationViewPass;
29
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\RouterPass;
30
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\SecurityPass;
31
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\SiteAccessMatcherRegistryPass;
32
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\SlugConverterConfigurationPass;
33
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\TranslationCollectorPass;
34
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ViewProvidersPass;
35
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\StorageConnectionPass;
36
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ComplexSettings\ComplexSettingParser;
37
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\DynamicSettingParser;
38
use eZ\Publish\Core\Base\Container\Compiler\GenericFieldTypeConverterPass;
39
use eZ\Publish\Core\Base\Container\Compiler\FieldTypeRegistryPass;
40
use eZ\Publish\Core\Base\Container\Compiler\Persistence\FieldTypeRegistryPass as PersistenceFieldTypeRegistryPass;
41
use eZ\Publish\Core\Base\Container\Compiler\RegisterLimitationTypePass;
42
use eZ\Publish\Core\Base\Container\Compiler\Storage\ExternalStorageRegistryPass;
43
use eZ\Publish\Core\Base\Container\Compiler\Storage\Legacy\FieldValueConverterRegistryPass;
44
use eZ\Publish\Core\Base\Container\Compiler\Storage\Legacy\RoleLimitationConverterPass;
45
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\EzPublishCoreExtension;
46
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser as ConfigParser;
47
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Security\HttpBasicFactory;
48
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\URLHandlerPass;
49
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
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 GenericFieldTypeConverterPass(), PassConfig::TYPE_OPTIMIZE);
59
        $container->addCompilerPass(new FieldTypeRegistryPass(), PassConfig::TYPE_OPTIMIZE);
60
        $container->addCompilerPass(new PersistenceFieldTypeRegistryPass(), PassConfig::TYPE_OPTIMIZE);
61
        $container->addCompilerPass(new FieldTypeParameterProviderRegistryPass());
62
        $container->addCompilerPass(new ChainRoutingPass());
63
        $container->addCompilerPass(new ChainConfigResolverPass());
64
        $container->addCompilerPass(new RegisterLimitationTypePass());
65
        $container->addCompilerPass(new RegisterStorageEnginePass());
66
        $container->addCompilerPass(new RegisterSearchEnginePass());
67
        $container->addCompilerPass(new RegisterSearchEngineIndexerPass());
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 RouterPass());
71
        $container->addCompilerPass(new SecurityPass());
72
        $container->addCompilerPass(new FragmentPass());
73
        $container->addCompilerPass(new StorageConnectionPass());
74
        $container->addCompilerPass(new ImaginePass());
75
        $container->addCompilerPass(new ComplexSettingsPass(new ComplexSettingParser()));
76
        $container->addCompilerPass(new ConfigResolverParameterPass(new DynamicSettingParser()));
77
        $container->addCompilerPass(new URLHandlerPass());
78
        $container->addCompilerPass(new BinaryContentDownloadPass());
79
        $container->addCompilerPass(new ViewProvidersPass());
80
        $container->addCompilerPass(new PlaceholderProviderPass());
81
        $container->addCompilerPass(new NotificationRendererPass());
82
        $container->addCompilerPass(new ConsoleCacheWarmupPass());
83
        $container->addCompilerPass(new ViewMatcherRegistryPass());
84
        $container->addCompilerPass(new SiteAccessMatcherRegistryPass());
85
86
        // Storage passes
87
        $container->addCompilerPass(new ExternalStorageRegistryPass());
88
        // Legacy Storage passes
89
        $container->addCompilerPass(new FieldValueConverterRegistryPass());
90
        $container->addCompilerPass(new RoleLimitationConverterPass());
91
        $container->addCompilerPass(new QueryTypePass());
92
93
        $securityExtension = $container->getExtension('security');
94
        $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...
95
        $container->addCompilerPass(new TranslationCollectorPass());
96
        $container->addCompilerPass(new SlugConverterConfigurationPass());
97
    }
98
99
    public function getContainerExtension()
100
    {
101
        if (!isset($this->extension)) {
102
            $this->extension = new EzPublishCoreExtension([
103
                // LocationView config parser needs to be specified AFTER ContentView config
104
                // parser since it is used to convert location view override rules to content
105
                // view override rules. If it were specified before, ContentView provider would
106
                // just undo the conversion LocationView did.
107
                new ConfigParser\ContentView(),
108
                new ConfigParser\LocationView(),
109
                new ConfigParser\Common(),
110
                new ConfigParser\Content(),
111
                new ConfigParser\FieldType\ImageAsset(),
112
                new ConfigParser\FieldTemplates(),
113
                new ConfigParser\FieldEditTemplates(),
114
                new ConfigParser\FieldDefinitionSettingsTemplates(),
115
                new ConfigParser\FieldDefinitionEditTemplates(),
116
                new ConfigParser\Image(),
117
                new ConfigParser\Languages(),
118
                new ConfigParser\IO(new ComplexSettingParser()),
119
                new ConfigParser\UrlChecker(),
120
            ]);
121
        }
122
123
        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 123 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...
124
    }
125
}
126