Passed
Pull Request — master (#213)
by Ruslan
18:45
created

EventDispatcherDependencyProvider   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 114
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 7
eloc 70
dl 0
loc 114
rs 10
c 2
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getMerchantPortalEventDispatcherPlugins() 0 4 1
A getEventDispatcherPlugins() 0 34 2
A getBackofficeEventDispatcherPlugins() 0 33 2
A getBackendApiEventDispatcherPlugins() 0 7 1
A getBackendGatewayEventDispatcherPlugins() 0 9 1
1
<?php
2
3
/**
4
 * This file is part of the Spryker Commerce OS.
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace Pyz\Zed\EventDispatcher;
9
10
use Spryker\Shared\Http\Plugin\EventDispatcher\ResponseListenerEventDispatcherPlugin;
11
use Spryker\Zed\Acl\Communication\Plugin\EventDispatcher\AccessControlEventDispatcherPlugin;
12
use Spryker\Zed\Application\Communication\Plugin\EventDispatcher\HeadersSecurityEventDispatcherPlugin;
13
use Spryker\Zed\ErrorHandler\Communication\Plugin\EventDispatcher\ErrorPageEventDispatcherPlugin;
14
use Spryker\Zed\EventBehavior\Communication\Plugin\EventDispatcher\EventBehaviorEventDispatcherPlugin;
15
use Spryker\Zed\EventDispatcher\EventDispatcherDependencyProvider as SprykerEventDispatcherDependencyProvider;
16
use Spryker\Zed\Http\Communication\Plugin\EventDispatcher\CacheControlHeaderEventDispatcherPlugin;
17
use Spryker\Zed\Http\Communication\Plugin\EventDispatcher\CookieEventDispatcherPlugin;
18
use Spryker\Zed\Http\Communication\Plugin\EventDispatcher\EnvironmentInfoHeaderEventDispatcherPlugin;
19
use Spryker\Zed\Http\Communication\Plugin\EventDispatcher\FragmentEventDispatcherPlugin;
20
use Spryker\Zed\Http\Communication\Plugin\EventDispatcher\HstsHeaderEventDispatcher;
21
use Spryker\Zed\Kernel\Communication\Plugin\AutoloaderCacheEventDispatcherPlugin;
22
use Spryker\Zed\Kernel\Communication\Plugin\EventDispatcher\RedirectUrlValidationEventDispatcherPlugin;
23
use Spryker\Zed\Locale\Communication\Plugin\EventDispatcher\LocaleEventDispatcherPlugin;
24
use Spryker\Zed\MerchantPortalApplication\Communication\Plugin\EventDispatcher\HeadersSecurityEventDispatcherPlugin as MerchantPortalHeadersSecurityEventDispatcherPlugin;
25
use Spryker\Zed\Monitoring\Communication\Plugin\EventDispatcher\GatewayMonitoringRequestTransactionEventDispatcherPlugin;
26
use Spryker\Zed\Monitoring\Communication\Plugin\EventDispatcher\MonitoringRequestTransactionEventDispatcherPlugin;
27
use Spryker\Zed\Profiler\Communication\Plugin\EventDispatcher\ProfilerRequestEventDispatcherPlugin;
28
use Spryker\Zed\Router\Communication\Plugin\EventDispatcher\RequestAttributesEventDispatcherPlugin;
29
use Spryker\Zed\Router\Communication\Plugin\EventDispatcher\RouterListenerEventDispatcherPlugin;
30
use Spryker\Zed\Router\Communication\Plugin\EventDispatcher\RouterLocaleEventDispatcherPlugin;
31
use Spryker\Zed\Router\Communication\Plugin\EventDispatcher\RouterSslRedirectEventDispatcherPlugin;
32
use Spryker\Zed\SecurityBlockerBackofficeGui\Communication\Plugin\EventDispatcher\SecurityBlockerBackofficeUserEventDispatcherPlugin;
33
use Spryker\Zed\SecurityBlockerMerchantPortalGui\Communication\Plugin\EventDispatcher\SecurityBlockerMerchantPortalUserEventDispatcherPlugin;
34
use Spryker\Zed\Session\Communication\Plugin\EventDispatcher\SaveSessionEventDispatcherPlugin;
35
use Spryker\Zed\Session\Communication\Plugin\EventDispatcher\SessionEventDispatcherPlugin;
36
use Spryker\Zed\Twig\Communication\Plugin\EventDispatcher\TwigEventDispatcherPlugin;
37
use Spryker\Zed\ZedRequest\Communication\Plugin\EventDispatcher\GatewayControllerEventDispatcherPlugin;
38
39
class EventDispatcherDependencyProvider extends SprykerEventDispatcherDependencyProvider
40
{
41
    /**
42
     * @return array<\Spryker\Shared\EventDispatcherExtension\Dependency\Plugin\EventDispatcherPluginInterface>
43
     */
44
    protected function getEventDispatcherPlugins(): array
45
    {
46
        $plugins = [
47
            new AccessControlEventDispatcherPlugin(),
48
            new EventBehaviorEventDispatcherPlugin(),
49
            new HeadersSecurityEventDispatcherPlugin(),
50
            new LocaleEventDispatcherPlugin(),
51
            new MonitoringRequestTransactionEventDispatcherPlugin(),
52
            new RouterLocaleEventDispatcherPlugin(),
53
            new RouterListenerEventDispatcherPlugin(),
54
            new RouterSslRedirectEventDispatcherPlugin(),
55
            new CookieEventDispatcherPlugin(),
56
            new FragmentEventDispatcherPlugin(),
57
            new HstsHeaderEventDispatcher(),
58
            new CacheControlHeaderEventDispatcherPlugin(),
59
            new TwigEventDispatcherPlugin(),
60
            new SessionEventDispatcherPlugin(),
61
            new SaveSessionEventDispatcherPlugin(),
62
            new AutoloaderCacheEventDispatcherPlugin(),
63
            new RequestAttributesEventDispatcherPlugin(),
64
            new ResponseListenerEventDispatcherPlugin(),
65
            new ErrorPageEventDispatcherPlugin(),
66
            new RedirectUrlValidationEventDispatcherPlugin(),
67
            new EnvironmentInfoHeaderEventDispatcherPlugin(),
68
            new SecurityBlockerBackofficeUserEventDispatcherPlugin(),
69
            new SecurityBlockerMerchantPortalUserEventDispatcherPlugin(),
70
            new GatewayControllerEventDispatcherPlugin(),
71
        ];
72
73
        if (class_exists(ProfilerRequestEventDispatcherPlugin::class)) {
74
            $plugins[] = new ProfilerRequestEventDispatcherPlugin();
75
        }
76
77
        return $plugins;
78
    }
79
80
    /**
81
     * @return array<\Spryker\Shared\EventDispatcherExtension\Dependency\Plugin\EventDispatcherPluginInterface>
82
     */
83
    protected function getBackofficeEventDispatcherPlugins(): array
84
    {
85
        $plugins = [
86
            new AccessControlEventDispatcherPlugin(),
87
            new EventBehaviorEventDispatcherPlugin(),
88
            new HeadersSecurityEventDispatcherPlugin(),
89
            new LocaleEventDispatcherPlugin(),
90
            new MonitoringRequestTransactionEventDispatcherPlugin(),
91
            new RouterLocaleEventDispatcherPlugin(),
92
            new RouterListenerEventDispatcherPlugin(),
93
            new RouterSslRedirectEventDispatcherPlugin(),
94
            new CookieEventDispatcherPlugin(),
95
            new FragmentEventDispatcherPlugin(),
96
            new HstsHeaderEventDispatcher(),
97
            new CacheControlHeaderEventDispatcherPlugin(),
98
            new TwigEventDispatcherPlugin(),
99
            new SessionEventDispatcherPlugin(),
100
            new SaveSessionEventDispatcherPlugin(),
101
            new AutoloaderCacheEventDispatcherPlugin(),
102
            new RequestAttributesEventDispatcherPlugin(),
103
            new ResponseListenerEventDispatcherPlugin(),
104
            new ErrorPageEventDispatcherPlugin(),
105
            new RedirectUrlValidationEventDispatcherPlugin(),
106
            new SecurityBlockerBackofficeUserEventDispatcherPlugin(),
107
            new SecurityBlockerMerchantPortalUserEventDispatcherPlugin(),
108
            new EnvironmentInfoHeaderEventDispatcherPlugin(),
109
        ];
110
111
        if (class_exists(ProfilerRequestEventDispatcherPlugin::class)) {
112
            $plugins[] = new ProfilerRequestEventDispatcherPlugin();
113
        }
114
115
        return $plugins;
116
    }
117
118
    /**
119
     * @return array<\Spryker\Shared\EventDispatcherExtension\Dependency\Plugin\EventDispatcherPluginInterface>
120
     */
121
    protected function getMerchantPortalEventDispatcherPlugins(): array
122
    {
123
        return [
124
            new MerchantPortalHeadersSecurityEventDispatcherPlugin(),
125
        ];
126
    }
127
128
    /**
129
     * @return array<\Spryker\Shared\EventDispatcherExtension\Dependency\Plugin\EventDispatcherPluginInterface>
130
     */
131
    protected function getBackendGatewayEventDispatcherPlugins(): array
132
    {
133
        return [
134
            new GatewayMonitoringRequestTransactionEventDispatcherPlugin(),
135
            new GatewayControllerEventDispatcherPlugin(),
136
            new RouterListenerEventDispatcherPlugin(),
137
            new ResponseListenerEventDispatcherPlugin(),
138
            new AutoloaderCacheEventDispatcherPlugin(),
139
            new EventBehaviorEventDispatcherPlugin(),
140
        ];
141
    }
142
143
    /**
144
     * @return array<\Spryker\Shared\EventDispatcherExtension\Dependency\Plugin\EventDispatcherPluginInterface>
145
     */
146
    protected function getBackendApiEventDispatcherPlugins(): array
147
    {
148
        return [
149
            new MonitoringRequestTransactionEventDispatcherPlugin(),
150
            new RouterListenerEventDispatcherPlugin(),
151
            new ResponseListenerEventDispatcherPlugin(),
152
            new AutoloaderCacheEventDispatcherPlugin(),
153
        ];
154
    }
155
}
156