Passed
Pull Request — master (#6)
by
unknown
09:38 queued 05:48
created

MinuboDependencyProvider::getSalesOrderQuery()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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
class MinuboDependencyProvider extends AbstractBundleDependencyProvider
23
{
24
    public const SERVICE_UTIL_ENCODING = 'SERVICE_UTIL_ENCODING';
25
    public const SERVICE_FILE_SYSTEM = 'SERVICE_FILE_SYSTEM';
26
27
    public const FACADE_OMS = 'FACADE_OMS';
28
29
    public const PROPEL_QUERY_CUSTOMER = 'PROPEL_QUERY_CUSTOMER';
30
    public const PROPEL_QUERY_SALES_ORDER = 'PROPEL_QUERY_SALES_ORDER';
31
32
    public const MINUBO_EXPORT_PLUGINS_STACK = 'MINUBO_EXPORT_PLUGINS_STACK';
33
34
    public const MINUBO_CUSTOMER_DATA_FILTER_PLUGINS_STACK = 'MINUBO_CUSTOMER_DATA_FILTER_PLUGINS_STACK';
35
    public const MINUBO_ORDER_DATA_FILTER_PLUGINS_STACK = 'MINUBO_ORDER_DATA_FILTER_PLUGINS_STACK';
36
37
    public const MINUBO_CUSTOMER_DATA_EXPANDER_PLUGINS_STACK = 'MINUBO_CUSTOMER_DATA_EXPANDER_PLUGINS_STACK';
38
    public const MINUBO_ORDER_DATA_EXPANDER_PLUGINS_STACK = 'MINUBO_ORDER_DATA_EXPANDER_PLUGINS_STACK';
39
40
    /**
41
     * @param \Spryker\Zed\Kernel\Container $container
42
     *
43
     * @return \Spryker\Zed\Kernel\Container
44
     */
45
    public function provideBusinessLayerDependencies(Container $container): Container
46
    {
47
        $container = $this->addEncodingService($container);
48
        $container = $this->addFileSystemService($container);
49
        $container = $this->addOmsFacade($container);
50
        $container = $this->addExportPlugins($container);
51
        $container = $this->addCustomerDataFilterPlugins($container);
52
        $container = $this->addOrderDataFilterPlugins($container);
53
        $container = $this->addCustomerDataExpanderPlugins($container);
54
        $container = $this->addOrderDataExpanderPlugins($container);
55
56
        return $container;
57
    }
58
59
    /**
60
     * @param \Spryker\Zed\Kernel\Container $container
61
     *
62
     * @return \Spryker\Zed\Kernel\Container
63
     */
64
    public function providePersistenceLayerDependencies(Container $container): Container
65
    {
66
        $container = $this->addCustomerQuery($container);
67
        $container = $this->addSalesOrderQuery($container);
68
69
        return $container;
70
    }
71
72
    /**
73
     * @param \Spryker\Zed\Kernel\Container $container
74
     *
75
     * @return \Spryker\Zed\Kernel\Container
76
     */
77
    protected function addEncodingService(Container $container): Container
78
    {
79
        $container->set(static::SERVICE_UTIL_ENCODING, function (Container $container) {
80
            return new MinuboToUtilEncodingServiceBridge($container->getLocator()->utilEncoding()->service());
81
        });
82
83
        return $container;
84
    }
85
86
    /**
87
     * @param \Spryker\Zed\Kernel\Container $container
88
     *
89
     * @return \Spryker\Zed\Kernel\Container
90
     */
91
    protected function addFileSystemService(Container $container): Container
92
    {
93
        $container->set(static::SERVICE_FILE_SYSTEM, function (Container $container) {
94
            return new MinuboToFileSystemServiceBridge($container->getLocator()->fileSystem()->service());
95
        });
96
97
        return $container;
98
    }
99
100
    /**
101
     * @param \Spryker\Zed\Kernel\Container $container
102
     *
103
     * @return \Spryker\Zed\Kernel\Container
104
     */
105
    protected function addOmsFacade(Container $container): Container
106
    {
107
        $container->set(static::FACADE_OMS, function (Container $container) {
108
            return new MinuboToOmsFacadeBridge($container->getLocator()->oms()->facade());
109
        });
110
111
        return $container;
112
    }
113
114
    /**
115
     * @return \Orm\Zed\Customer\Persistence\SpyCustomerQuery
116
     */
117
    protected function getCustomerQuery(): SpyCustomerQuery
118
    {
119
        return SpyCustomerQuery::create();
120
    }
121
122
    /**
123
     * @param \Spryker\Zed\Kernel\Container $container
124
     *
125
     * @return \Spryker\Zed\Kernel\Container
126
     */
127
    public function addCustomerQuery(Container $container): Container
128
    {
129
        $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

129
        $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...
130
            return $this->getCustomerQuery();
131
        });
132
133
        return $container;
134
    }
135
136
    /**
137
     * @return \Orm\Zed\Sales\Persistence\SpySalesOrderQuery;
138
     */
139
    protected function getSalesOrderQuery(): SpySalesOrderQuery
140
    {
141
        return SpySalesOrderQuery::create();
142
    }
143
144
    /**
145
     * @param \Spryker\Zed\Kernel\Container $container
146
     *
147
     * @return \Spryker\Zed\Kernel\Container
148
     */
149
    public function addSalesOrderQuery(Container $container): Container
150
    {
151
        $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

151
        $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...
152
            return $this->getSalesOrderQuery();
153
        });
154
155
        return $container;
156
    }
157
158
    /**
159
     * @param \Spryker\Zed\Kernel\Container $container
160
     *
161
     * @return \Spryker\Zed\Kernel\Container
162
     */
163
    public function addExportPlugins(Container $container): Container
164
    {
165
        $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

165
        $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...
166
            return $this->getMinuboExportPluginStack();
167
        });
168
169
        return $container;
170
    }
171
172
    /**
173
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboExportPluginInterface>
174
     */
175
    protected function getMinuboExportPluginStack(): array
176
    {
177
        return [
178
            new MinuboCustomerExportPlugin(),
179
            new MinuboOrderExportPlugin(),
180
        ];
181
    }
182
183
    /**
184
     * @param \Spryker\Zed\Kernel\Container $container
185
     *
186
     * @return \Spryker\Zed\Kernel\Container
187
     */
188
    protected function addCustomerDataFilterPlugins($container): Container
189
    {
190
        $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

190
        $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...
191
            return $this->getCustomerDataFilterPluginStack();
192
        });
193
194
        return $container;
195
    }
196
197
    /**
198
     * @param \Spryker\Zed\Kernel\Container $container
199
     *
200
     * @return \Spryker\Zed\Kernel\Container
201
     */
202
    protected function addOrderDataFilterPlugins($container): Container
203
    {
204
        $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

204
        $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...
205
            return $this->getOrderDataFilterPluginStack();
206
        });
207
208
        return $container;
209
    }
210
211
    /**
212
     * @param \Spryker\Zed\Kernel\Container $container
213
     *
214
     * @return \Spryker\Zed\Kernel\Container
215
     */
216
    protected function addCustomerDataExpanderPlugins($container): Container
217
    {
218
        $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

218
        $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...
219
            return $this->getCustomerDataExpanderPluginStack();
220
        });
221
222
        return $container;
223
    }
224
225
    /**
226
     * @param \Spryker\Zed\Kernel\Container $container
227
     *
228
     * @return \Spryker\Zed\Kernel\Container
229
     */
230
    protected function addOrderDataExpanderPlugins($container): Container
231
    {
232
        $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

232
        $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...
233
            return $this->getOrderDataExpanderPluginStack();
234
        });
235
236
        return $container;
237
    }
238
239
    /**
240
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataFilterInterface>
241
     */
242
    protected function getCustomerDataFilterPluginStack(): array
243
    {
244
        return [
245
            new CustomerSecureFieldFilterPlugin(),
246
        ];
247
    }
248
249
    /**
250
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataFilterInterface>
251
     */
252
    protected function getOrderDataFilterPluginStack(): array
253
    {
254
        return [];
255
    }
256
257
    /**
258
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataExpanderInterface>
259
     */
260
    protected function getCustomerDataExpanderPluginStack(): array
261
    {
262
        return [];
263
    }
264
265
    /**
266
     * @return array<\SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataExpanderInterface>
267
     */
268
    protected function getOrderDataExpanderPluginStack(): array
269
    {
270
        return [
271
            new StateFlagExpanderPlugin(),
272
        ];
273
    }
274
}
275