Completed
Push — master ( 11b1c7...fa8ea7 )
by Łukasz
18:19
created

EzPublishCoreBundle   C

Complexity

Total Complexity 3

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 53

Importance

Changes 0
Metric Value
dl 0
loc 77
rs 5
c 0
b 0
f 0
wmc 3
lcom 1
cbo 53

2 Methods

Rating   Name   Duplication   Size   Complexity  
B build() 0 41 1
B getContainerExtension() 0 32 2
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\HttpKernel\Bundle\Bundle;
50
use Symfony\Component\DependencyInjection\ContainerBuilder;
51
52
class EzPublishCoreBundle extends Bundle
53
{
54
    public function build(ContainerBuilder $container)
55
    {
56
        parent::build($container);
57
        $container->addCompilerPass(new FieldTypeCollectionPass(), PassConfig::TYPE_OPTIMIZE);
58
        $container->addCompilerPass(new FieldTypeNameableCollectionPass(), PassConfig::TYPE_OPTIMIZE);
59
        $container->addCompilerPass(new FieldTypeParameterProviderRegistryPass());
60
        $container->addCompilerPass(new ChainRoutingPass());
61
        $container->addCompilerPass(new ChainConfigResolverPass());
62
        $container->addCompilerPass(new RegisterLimitationTypePass());
63
        $container->addCompilerPass(new RegisterStorageEnginePass());
64
        $container->addCompilerPass(new RegisterSearchEnginePass());
65
        $container->addCompilerPass(new RegisterSearchEngineIndexerPass());
66
        $container->addCompilerPass(new LocalePass());
67
        $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...
68
        $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...
69
        $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...
70
        $container->addCompilerPass(new SignalSlotPass());
71
        $container->addCompilerPass(new RouterPass());
72
        $container->addCompilerPass(new SecurityPass());
73
        $container->addCompilerPass(new RichTextHtml5ConverterPass());
74
        $container->addCompilerPass(new FragmentPass());
75
        $container->addCompilerPass(new StorageConnectionPass());
76
        $container->addCompilerPass(new ImaginePass());
77
        $container->addCompilerPass(new ComplexSettingsPass(new ComplexSettingParser()));
78
        $container->addCompilerPass(new ConfigResolverParameterPass(new DynamicSettingParser()));
79
        $container->addCompilerPass(new AsseticPass());
80
        $container->addCompilerPass(new URLHandlerPass());
81
        $container->addCompilerPass(new BinaryContentDownloadPass());
82
        $container->addCompilerPass(new ViewProvidersPass());
83
84
        // Storage passes
85
        $container->addCompilerPass(new ExternalStorageRegistryPass());
86
        // Legacy Storage passes
87
        $container->addCompilerPass(new FieldValueConverterRegistryPass());
88
        $container->addCompilerPass(new RoleLimitationConverterPass());
89
        $container->addCompilerPass(new QueryTypePass());
90
91
        $securityExtension = $container->getExtension('security');
92
        $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...
93
        $container->addCompilerPass(new TranslationCollectorPass());
94
    }
95
96
    public function getContainerExtension()
97
    {
98
        if (!isset($this->extension)) {
99
            $this->extension = new EzPublishCoreExtension(
100
                array(
101
                    // LocationView config parser needs to be specified AFTER ContentView config
102
                    // parser since it is used to convert location view override rules to content
103
                    // view override rules. If it were specified before, ContentView provider would
104
                    // just undo the conversion LocationView did.
105
                    new ConfigParser\ContentView(),
106
                    new ConfigParser\LocationView(),
107
                    new ConfigParser\BlockView(),
108
                    new ConfigParser\Common(),
109
                    new ConfigParser\Content(),
110
                    new ConfigParser\FieldType\RichText(),
111
                    new ConfigParser\FieldTemplates(),
112
                    new ConfigParser\FieldEditTemplates(),
113
                    new ConfigParser\FieldDefinitionSettingsTemplates(),
114
                    new ConfigParser\FieldDefinitionEditTemplates(),
115
                    new ConfigParser\Image(),
116
                    new ConfigParser\Page(),
117
                    new ConfigParser\Languages(),
118
                    new ConfigParser\IO(new ComplexSettingParser()),
119
                    new ConfigParser\UrlChecker(),
120
                )
121
            );
122
123
            $this->extension->addPolicyProvider(new RepositoryPolicyProvider());
124
        }
125
126
        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 126 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...
127
    }
128
}
129