MinuboDependencyProvider   A
last analyzed

Complexity

Total Complexity 19

Size/Duplication

Total Lines 284
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 19
eloc 64
c 2
b 0
f 1
dl 0
loc 284
rs 10

19 Methods

Rating   Name   Duplication   Size   Complexity  
A getOrderDataFilterPluginStack() 0 3 1
A addEncodingService() 0 7 1
A addCustomerQuery() 0 7 1
A getCustomerDataExpanderPluginStack() 0 3 1
A getSalesOrderQuery() 0 3 1
A getMinuboExportPluginStack() 0 5 1
A addOrderDataExpanderPlugins() 0 7 1
A addExportPlugins() 0 7 1
A getOrderDataExpanderPluginStack() 0 4 1
A addFileSystemService() 0 7 1
A providePersistenceLayerDependencies() 0 6 1
A getCustomerQuery() 0 3 1
A addCustomerDataExpanderPlugins() 0 7 1
A addOrderDataFilterPlugins() 0 7 1
A provideBusinessLayerDependencies() 0 12 1
A addOmsFacade() 0 7 1
A getCustomerDataFilterPluginStack() 0 4 1
A addSalesOrderQuery() 0 7 1
A addCustomerDataFilterPlugins() 0 7 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Minubo;
9
10
use Orm\Zed\Customer\Persistence\SpyCustomerQuery;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Customer\Persistence\SpyCustomerQuery was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Orm\Zed\Sales\Persistence\SpySalesOrderQuery;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Sales\Persistence\SpySalesOrderQuery was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Spryker\Zed\Kernel\AbstractBundleDependencyProvider;
13
use Spryker\Zed\Kernel\Container;
14
use SprykerEco\Zed\Minubo\Communication\Plugin\Expander\StateFlagExpanderPlugin;
15
use SprykerEco\Zed\Minubo\Communication\Plugin\Filter\CustomerSecureFieldFilterPlugin;
16
use SprykerEco\Zed\Minubo\Communication\Plugin\MinuboCustomerExportPlugin;
17
use SprykerEco\Zed\Minubo\Communication\Plugin\MinuboOrderExportPlugin;
18
use SprykerEco\Zed\Minubo\Dependency\Facade\MinuboToOmsFacadeBridge;
19
use SprykerEco\Zed\Minubo\Dependency\Service\MinuboToFileSystemServiceBridge;
20
use SprykerEco\Zed\Minubo\Dependency\Service\MinuboToUtilEncodingServiceBridge;
21
22
/**
23
 * @method \SprykerEco\Zed\Minubo\MinuboConfig getConfig()
24
 */
25
class MinuboDependencyProvider extends AbstractBundleDependencyProvider
26
{
27
    /**
28
     * @var string
29
     */
30
    public const SERVICE_UTIL_ENCODING = 'SERVICE_UTIL_ENCODING';
31
32
    /**
33
     * @var string
34
     */
35
    public const SERVICE_FILE_SYSTEM = 'SERVICE_FILE_SYSTEM';
36
37
    /**
38
     * @var string
39
     */
40
    public const FACADE_OMS = 'FACADE_OMS';
41
42
    /**
43
     * @var string
44
     */
45
    public const PROPEL_QUERY_CUSTOMER = 'PROPEL_QUERY_CUSTOMER';
46
47
    /**
48
     * @var string
49
     */
50
    public const PROPEL_QUERY_SALES_ORDER = 'PROPEL_QUERY_SALES_ORDER';
51
52
    /**
53
     * @var string
54
     */
55
    public const MINUBO_EXPORT_PLUGINS_STACK = 'MINUBO_EXPORT_PLUGINS_STACK';
56
57
    /**
58
     * @var string
59
     */
60
    public const MINUBO_CUSTOMER_DATA_FILTER_PLUGINS_STACK = 'MINUBO_CUSTOMER_DATA_FILTER_PLUGINS_STACK';
61
62
    /**
63
     * @var string
64
     */
65
    public const MINUBO_ORDER_DATA_FILTER_PLUGINS_STACK = 'MINUBO_ORDER_DATA_FILTER_PLUGINS_STACK';
66
67
    /**
68
     * @var string
69
     */
70
    public const MINUBO_CUSTOMER_DATA_EXPANDER_PLUGINS_STACK = 'MINUBO_CUSTOMER_DATA_EXPANDER_PLUGINS_STACK';
71
72
    /**
73
     * @var string
74
     */
75
    public const MINUBO_ORDER_DATA_EXPANDER_PLUGINS_STACK = 'MINUBO_ORDER_DATA_EXPANDER_PLUGINS_STACK';
76
77
    /**
78
     * @param \Spryker\Zed\Kernel\Container $container
79
     *
80
     * @return \Spryker\Zed\Kernel\Container
81
     */
82
    public function provideBusinessLayerDependencies(Container $container): Container
83
    {
84
        $container = $this->addEncodingService($container);
85
        $container = $this->addFileSystemService($container);
86
        $container = $this->addOmsFacade($container);
87
        $container = $this->addExportPlugins($container);
88
        $container = $this->addCustomerDataFilterPlugins($container);
89
        $container = $this->addOrderDataFilterPlugins($container);
90
        $container = $this->addCustomerDataExpanderPlugins($container);
91
        $container = $this->addOrderDataExpanderPlugins($container);
92
93
        return $container;
94
    }
95
96
    /**
97
     * @param \Spryker\Zed\Kernel\Container $container
98
     *
99
     * @return \Spryker\Zed\Kernel\Container
100
     */
101
    public function providePersistenceLayerDependencies(Container $container): Container
102
    {
103
        $container = $this->addCustomerQuery($container);
104
        $container = $this->addSalesOrderQuery($container);
105
106
        return $container;
107
    }
108
109
    /**
110
     * @param \Spryker\Zed\Kernel\Container $container
111
     *
112
     * @return \Spryker\Zed\Kernel\Container
113
     */
114
    protected function addEncodingService(Container $container): Container
115
    {
116
        $container->set(static::SERVICE_UTIL_ENCODING, function (Container $container) {
117
            return new MinuboToUtilEncodingServiceBridge($container->getLocator()->utilEncoding()->service());
118
        });
119
120
        return $container;
121
    }
122
123
    /**
124
     * @param \Spryker\Zed\Kernel\Container $container
125
     *
126
     * @return \Spryker\Zed\Kernel\Container
127
     */
128
    protected function addFileSystemService(Container $container): Container
129
    {
130
        $container->set(static::SERVICE_FILE_SYSTEM, function (Container $container) {
131
            return new MinuboToFileSystemServiceBridge($container->getLocator()->fileSystem()->service());
132
        });
133
134
        return $container;
135
    }
136
137
    /**
138
     * @param \Spryker\Zed\Kernel\Container $container
139
     *
140
     * @return \Spryker\Zed\Kernel\Container
141
     */
142
    protected function addOmsFacade(Container $container): Container
143
    {
144
        $container->set(static::FACADE_OMS, function (Container $container) {
145
            return new MinuboToOmsFacadeBridge($container->getLocator()->oms()->facade());
146
        });
147
148
        return $container;
149
    }
150
151
    /**
152
     * @return \Orm\Zed\Customer\Persistence\SpyCustomerQuery
153
     */
154
    protected function getCustomerQuery(): SpyCustomerQuery
155
    {
156
        return SpyCustomerQuery::create();
157
    }
158
159
    /**
160
     * @param \Spryker\Zed\Kernel\Container $container
161
     *
162
     * @return \Spryker\Zed\Kernel\Container
163
     */
164
    public function addCustomerQuery(Container $container): Container
165
    {
166
        $container->set(static::PROPEL_QUERY_CUSTOMER, function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

166
        $container->set(static::PROPEL_QUERY_CUSTOMER, function (/** @scrutinizer ignore-unused */ Container $container) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
167
            return $this->getCustomerQuery();
168
        });
169
170
        return $container;
171
    }
172
173
    /**
174
     * @return \Orm\Zed\Sales\Persistence\SpySalesOrderQuery;
175
     */
176
    protected function getSalesOrderQuery(): SpySalesOrderQuery
177
    {
178
        return SpySalesOrderQuery::create();
179
    }
180
181
    /**
182
     * @param \Spryker\Zed\Kernel\Container $container
183
     *
184
     * @return \Spryker\Zed\Kernel\Container
185
     */
186
    public function addSalesOrderQuery(Container $container): Container
187
    {
188
        $container->set(static::PROPEL_QUERY_SALES_ORDER, function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

188
        $container->set(static::PROPEL_QUERY_SALES_ORDER, function (/** @scrutinizer ignore-unused */ Container $container) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
189
            return $this->getSalesOrderQuery();
190
        });
191
192
        return $container;
193
    }
194
195
    /**
196
     * @param \Spryker\Zed\Kernel\Container $container
197
     *
198
     * @return \Spryker\Zed\Kernel\Container
199
     */
200
    public function addExportPlugins(Container $container): Container
201
    {
202
        $container->set(static::MINUBO_EXPORT_PLUGINS_STACK, function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

202
        $container->set(static::MINUBO_EXPORT_PLUGINS_STACK, function (/** @scrutinizer ignore-unused */ Container $container) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
203
            return $this->getMinuboExportPluginStack();
204
        });
205
206
        return $container;
207
    }
208
209
    /**
210
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboExportPluginInterface>
211
     */
212
    protected function getMinuboExportPluginStack(): array
213
    {
214
        return [
215
            new MinuboCustomerExportPlugin(),
216
            new MinuboOrderExportPlugin(),
217
        ];
218
    }
219
220
    /**
221
     * @param \Spryker\Zed\Kernel\Container $container
222
     *
223
     * @return \Spryker\Zed\Kernel\Container
224
     */
225
    protected function addCustomerDataFilterPlugins($container): Container
226
    {
227
        $container->set(static::MINUBO_CUSTOMER_DATA_FILTER_PLUGINS_STACK, function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

227
        $container->set(static::MINUBO_CUSTOMER_DATA_FILTER_PLUGINS_STACK, function (/** @scrutinizer ignore-unused */ Container $container) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
228
            return $this->getCustomerDataFilterPluginStack();
229
        });
230
231
        return $container;
232
    }
233
234
    /**
235
     * @param \Spryker\Zed\Kernel\Container $container
236
     *
237
     * @return \Spryker\Zed\Kernel\Container
238
     */
239
    protected function addOrderDataFilterPlugins($container): Container
240
    {
241
        $container->set(static::MINUBO_ORDER_DATA_FILTER_PLUGINS_STACK, function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

241
        $container->set(static::MINUBO_ORDER_DATA_FILTER_PLUGINS_STACK, function (/** @scrutinizer ignore-unused */ Container $container) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
242
            return $this->getOrderDataFilterPluginStack();
243
        });
244
245
        return $container;
246
    }
247
248
    /**
249
     * @param \Spryker\Zed\Kernel\Container $container
250
     *
251
     * @return \Spryker\Zed\Kernel\Container
252
     */
253
    protected function addCustomerDataExpanderPlugins($container): Container
254
    {
255
        $container->set(static::MINUBO_CUSTOMER_DATA_EXPANDER_PLUGINS_STACK, function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

255
        $container->set(static::MINUBO_CUSTOMER_DATA_EXPANDER_PLUGINS_STACK, function (/** @scrutinizer ignore-unused */ Container $container) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
256
            return $this->getCustomerDataExpanderPluginStack();
257
        });
258
259
        return $container;
260
    }
261
262
    /**
263
     * @param \Spryker\Zed\Kernel\Container $container
264
     *
265
     * @return \Spryker\Zed\Kernel\Container
266
     */
267
    protected function addOrderDataExpanderPlugins($container): Container
268
    {
269
        $container->set(static::MINUBO_ORDER_DATA_EXPANDER_PLUGINS_STACK, function (Container $container) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

269
        $container->set(static::MINUBO_ORDER_DATA_EXPANDER_PLUGINS_STACK, function (/** @scrutinizer ignore-unused */ Container $container) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
270
            return $this->getOrderDataExpanderPluginStack();
271
        });
272
273
        return $container;
274
    }
275
276
    /**
277
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataFilterInterface>
278
     */
279
    protected function getCustomerDataFilterPluginStack(): array
280
    {
281
        return [
282
            new CustomerSecureFieldFilterPlugin(),
283
        ];
284
    }
285
286
    /**
287
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataFilterInterface>
288
     */
289
    protected function getOrderDataFilterPluginStack(): array
290
    {
291
        return [];
292
    }
293
294
    /**
295
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataExpanderInterface>
296
     */
297
    protected function getCustomerDataExpanderPluginStack(): array
298
    {
299
        return [];
300
    }
301
302
    /**
303
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataExpanderInterface>
304
     */
305
    protected function getOrderDataExpanderPluginStack(): array
306
    {
307
        return [
308
            new StateFlagExpanderPlugin(),
309
        ];
310
    }
311
}
312