Passed
Pull Request — master (#1)
by Grebenikov
04:34
created

MinuboDependencyProvider::addOmsFacade()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 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
class MinuboDependencyProvider extends AbstractBundleDependencyProvider
23
{
24
    const SERVICE_UTIL_ENCODING = 'SERVICE_UTIL_ENCODING';
25
    const SERVICE_FILE_SYSTEM = 'SERVICE_FILE_SYSTEM';
26
27
    const FACADE_OMS = 'FACADE_OMS';
28
29
    const PROPEL_QUERY_CUSTOMER = 'PROPEL_QUERY_CUSTOMER';
30
    const PROPEL_QUERY_SALES_ORDER = 'PROPEL_QUERY_SALES_ORDER';
31
32
    const MINUBO_EXPORT_PLUGINS_STACK = 'MINUBO_EXPORT_PLUGINS_STACK';
33
34
    const MINUBO_CUSTOMER_DATA_FILTER_PLUGINS_STACK = 'MINUBO_CUSTOMER_DATA_FILTER_PLUGINS_STACK';
35
    const MINUBO_ORDER_DATA_FILTER_PLUGINS_STACK = 'MINUBO_ORDER_DATA_FILTER_PLUGINS_STACK';
36
37
    const MINUBO_CUSTOMER_DATA_EXPANDER_PLUGINS_STACK = 'MINUBO_CUSTOMER_DATA_EXPANDER_PLUGINS_STACK';
38
    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)
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)
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[static::SERVICE_UTIL_ENCODING] = function (Container $container) {
80
            return new MinuboToUtilEncodingServiceBridge($container->getLocator()->utilEncoding()->service());
81
        };
82
        return $container;
83
    }
84
85
    /**
86
     * @param \Spryker\Zed\Kernel\Container $container
87
     *
88
     * @return \Spryker\Zed\Kernel\Container
89
     */
90
    protected function addFileSystemService(Container $container): Container
91
    {
92
        $container[static::SERVICE_FILE_SYSTEM] = function (Container $container) {
93
            return new MinuboToFileSystemServiceBridge($container->getLocator()->fileSystem()->service());
94
        };
95
        return $container;
96
    }
97
98
    /**
99
     * @param \Spryker\Zed\Kernel\Container $container
100
     *
101
     * @return \Spryker\Zed\Kernel\Container
102
     */
103
    protected function addOmsFacade(Container $container): Container
104
    {
105
        $container[static::FACADE_OMS] = function (Container $container) {
106
            return new MinuboToOmsFacadeBridge($container->getLocator()->oms()->facade());
107
        };
108
        return $container;
109
    }
110
111
    /**
112
     * @param \Spryker\Zed\Kernel\Container $container
113
     *
114
     * @return \Spryker\Zed\Kernel\Container
115
     */
116
    public function addCustomerQuery(Container $container)
117
    {
118
        $container[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

118
        $container[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...
119
            return SpyCustomerQuery::create();
120
        };
121
122
        return $container;
123
    }
124
125
    /**
126
     * @param \Spryker\Zed\Kernel\Container $container
127
     *
128
     * @return \Spryker\Zed\Kernel\Container
129
     */
130
    public function addSalesOrderQuery(Container $container)
131
    {
132
        $container[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

132
        $container[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...
133
            return SpySalesOrderQuery::create();
134
        };
135
136
        return $container;
137
    }
138
139
    /**
140
     * @param \Spryker\Zed\Kernel\Container $container
141
     *
142
     * @return \Spryker\Zed\Kernel\Container
143
     */
144
    public function addExportPlugins(Container $container)
145
    {
146
        $container[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

146
        $container[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...
147
            return $this->getMinuboExportPluginStack();
148
        };
149
150
        return $container;
151
    }
152
153
    /**
154
     * @return \SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboExportPluginInterface[]
155
     */
156
    protected function getMinuboExportPluginStack()
157
    {
158
        return [
159
            new MinuboCustomerExportPlugin(),
160
            new MinuboOrderExportPlugin(),
161
        ];
162
    }
163
164
    /**
165
     * @param \Spryker\Zed\Kernel\Container $container
166
     *
167
     * @return \Spryker\Zed\Kernel\Container
168
     */
169
    protected function addCustomerDataFilterPlugins($container)
170
    {
171
        $container[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

171
        $container[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...
172
            return $this->getCustomerDataFilterPluginStack();
173
        };
174
175
        return $container;
176
    }
177
178
    /**
179
     * @param \Spryker\Zed\Kernel\Container $container
180
     *
181
     * @return \Spryker\Zed\Kernel\Container
182
     */
183
    protected function addOrderDataFilterPlugins($container)
184
    {
185
        $container[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

185
        $container[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...
186
            return $this->getOrderDataFilterPluginStack();
187
        };
188
189
        return $container;
190
    }
191
192
    /**
193
     * @param \Spryker\Zed\Kernel\Container $container
194
     *
195
     * @return \Spryker\Zed\Kernel\Container
196
     */
197
    protected function addCustomerDataExpanderPlugins($container)
198
    {
199
        $container[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

199
        $container[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...
200
            return $this->getCustomerDataExpanderPluginStack();
201
        };
202
203
        return $container;
204
    }
205
206
    /**
207
     * @param \Spryker\Zed\Kernel\Container $container
208
     *
209
     * @return \Spryker\Zed\Kernel\Container
210
     */
211
    protected function addOrderDataExpanderPlugins($container)
212
    {
213
        $container[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

213
        $container[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...
214
            return $this->getOrderDataExpanderPluginStack();
215
        };
216
217
        return $container;
218
    }
219
220
    /**
221
     * @return \SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataFilterInterface[]
222
     */
223
    protected function getCustomerDataFilterPluginStack()
224
    {
225
        return [
226
            new CustomerSecureFieldFilterPlugin(),
227
        ];
228
    }
229
230
    /**
231
     * @return \SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataFilterInterface[]
232
     */
233
    protected function getOrderDataFilterPluginStack()
234
    {
235
        return [];
236
    }
237
238
    /**
239
     * @return \SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataExpanderInterface[]
240
     */
241
    protected function getCustomerDataExpanderPluginStack()
242
    {
243
        return [];
244
    }
245
246
    /**
247
     * @return \SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataExpanderInterface[]
248
     */
249
    protected function getOrderDataExpanderPluginStack()
250
    {
251
        return [
252
            new StateFlagExpanderPlugin(),
253
        ];
254
    }
255
}
256