StreamFactory::createJsonObjectWriteStream()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Stream;
9
10
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Stream\Akeneo\AttributeAkeneoApiReadStream;
11
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Stream\Akeneo\CategoryAkeneoApiReadStream;
12
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Stream\Akeneo\ProductAkeneoApiReadStream;
13
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Stream\Akeneo\ProductModelAkeneoApiReadStream;
14
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Stream\Akeneo\SuperAttributeAkeneoApiReadStream;
15
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Stream\DataImport\DataImportProductConcreteWriteStream;
16
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Stream\DataImport\DataImportWriteStream;
17
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Stream\Db\PropelCriteriaReadStream;
18
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Stream\Json\JsonObjectWriteStream;
19
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Stream\Json\JsonSuperAttributeWriteStream;
20
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Plugin\DataImporterPluginInterface;
21
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Service\AkeneoPimMiddlewareConnectorToAkeneoPimServiceInterface;
22
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Persistence\AkeneoPimMiddlewareConnectorQueryContainerInterface;
23
use SprykerMiddleware\Shared\Process\Stream\ReadStreamInterface;
0 ignored issues
show
Bug introduced by
The type SprykerMiddleware\Shared...eam\ReadStreamInterface 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...
24
use SprykerMiddleware\Shared\Process\Stream\WriteStreamInterface;
0 ignored issues
show
Bug introduced by
The type SprykerMiddleware\Shared...am\WriteStreamInterface 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...
25
26
class StreamFactory implements StreamFactoryInterface
27
{
28
    /**
29
     * @var \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Service\AkeneoPimMiddlewareConnectorToAkeneoPimServiceInterface
30
     */
31
    protected $akeneoPimService;
32
33
    /**
34
     * @var \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Persistence\AkeneoPimMiddlewareConnectorQueryContainerInterface
35
     */
36
    protected $queryContainer;
37
38
    /**
39
     * @var \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Plugin\DataImporterPluginInterface
40
     */
41
    protected $categoryImporterPlugin;
42
43
    /**
44
     * @var \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Plugin\DataImporterPluginInterface
45
     */
46
    protected $attributeImporterPlugin;
47
48
    /**
49
     * @var \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Plugin\DataImporterPluginInterface
50
     */
51
    protected $productAbstractImporterPlugin;
52
53
    /**
54
     * @var \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Plugin\DataImporterPluginInterface
55
     */
56
    protected $productConcreteImporterPlugin;
57
58
    /**
59
     * @var \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Plugin\DataImporterPluginInterface
60
     */
61
    protected $productPriceImporterPlugin;
62
63
    /**
64
     * @var \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Plugin\DataImporterPluginInterface
65
     */
66
    protected $productAbstractStoresImporterPlugin;
67
68
    /**
69
     * @param \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Service\AkeneoPimMiddlewareConnectorToAkeneoPimServiceInterface $akeneoPimService
70
     * @param \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Persistence\AkeneoPimMiddlewareConnectorQueryContainerInterface $queryContainer
71
     * @param \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Plugin\DataImporterPluginInterface $categoryImporterPlugin
72
     * @param \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Plugin\DataImporterPluginInterface $attributeImporterPlugin
73
     * @param \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Plugin\DataImporterPluginInterface $productAbstractImporterPlugin
74
     * @param \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Plugin\DataImporterPluginInterface $productConcreteImporterPlugin
75
     * @param \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Plugin\DataImporterPluginInterface $productPriceImporterPlugin
76
     * @param \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Plugin\DataImporterPluginInterface $productAbstractStoresImporterPlugin
77
     */
78
    public function __construct(
79
        AkeneoPimMiddlewareConnectorToAkeneoPimServiceInterface $akeneoPimService,
80
        AkeneoPimMiddlewareConnectorQueryContainerInterface $queryContainer,
81
        DataImporterPluginInterface $categoryImporterPlugin,
82
        DataImporterPluginInterface $attributeImporterPlugin,
83
        DataImporterPluginInterface $productAbstractImporterPlugin,
84
        DataImporterPluginInterface $productConcreteImporterPlugin,
85
        DataImporterPluginInterface $productPriceImporterPlugin,
86
        DataImporterPluginInterface $productAbstractStoresImporterPlugin
87
    ) {
88
        $this->akeneoPimService = $akeneoPimService;
89
        $this->queryContainer = $queryContainer;
90
        $this->categoryImporterPlugin = $categoryImporterPlugin;
91
        $this->attributeImporterPlugin = $attributeImporterPlugin;
92
        $this->productConcreteImporterPlugin = $productConcreteImporterPlugin;
93
        $this->productAbstractImporterPlugin = $productAbstractImporterPlugin;
94
        $this->productPriceImporterPlugin = $productPriceImporterPlugin;
95
        $this->productAbstractStoresImporterPlugin = $productAbstractStoresImporterPlugin;
96
    }
97
98
    /**
99
     * @return \SprykerMiddleware\Shared\Process\Stream\ReadStreamInterface
100
     */
101
    public function createAttributeAkeneoApiReadStream(): ReadStreamInterface
102
    {
103
        return new AttributeAkeneoApiReadStream($this->akeneoPimService);
104
    }
105
106
    /**
107
     * @return \SprykerMiddleware\Shared\Process\Stream\ReadStreamInterface
108
     */
109
    public function createSuperAttributesAkeneoApiReadStream(): ReadStreamInterface
110
    {
111
        return new SuperAttributeAkeneoApiReadStream($this->akeneoPimService);
112
    }
113
114
    /**
115
     * @return \SprykerMiddleware\Shared\Process\Stream\ReadStreamInterface
116
     */
117
    public function createCategoryAkeneoApiReadStream(): ReadStreamInterface
118
    {
119
        return new CategoryAkeneoApiReadStream($this->akeneoPimService);
120
    }
121
122
    /**
123
     * @return \SprykerMiddleware\Shared\Process\Stream\ReadStreamInterface
124
     */
125
    public function createProductAkeneoApiReadStream(): ReadStreamInterface
126
    {
127
        return new ProductAkeneoApiReadStream($this->akeneoPimService);
128
    }
129
130
    /**
131
     * @return \SprykerMiddleware\Shared\Process\Stream\ReadStreamInterface
132
     */
133
    public function createProductModelAkeneoApiReadStream(): ReadStreamInterface
134
    {
135
        return new ProductModelAkeneoApiReadStream($this->akeneoPimService);
136
    }
137
138
    /**
139
     * @return \SprykerMiddleware\Shared\Process\Stream\ReadStreamInterface
140
     */
141
    public function createTaxSetReadStream(): ReadStreamInterface
142
    {
143
        return new PropelCriteriaReadStream($this->queryContainer->querySelectSpyTaxSet());
144
    }
145
146
    /**
147
     * @return \SprykerMiddleware\Shared\Process\Stream\ReadStreamInterface
148
     */
149
    public function createLocaleReadStream(): ReadStreamInterface
150
    {
151
        return new PropelCriteriaReadStream($this->queryContainer->querySelectLocale());
152
    }
153
154
    /**
155
     * @param string $path
156
     *
157
     * @return \SprykerMiddleware\Shared\Process\Stream\WriteStreamInterface
158
     */
159
    public function createJsonObjectWriteStream(string $path): WriteStreamInterface
160
    {
161
        return new JsonObjectWriteStream($path);
162
    }
163
164
    /**
165
     * @param string $path
166
     *
167
     * @return \SprykerMiddleware\Shared\Process\Stream\WriteStreamInterface
168
     */
169
    public function createJsonSuperAttributeWriteStream(string $path): WriteStreamInterface
170
    {
171
        return new JsonSuperAttributeWriteStream($path);
172
    }
173
174
    /**
175
     * @return \SprykerMiddleware\Shared\Process\Stream\WriteStreamInterface
176
     */
177
    public function createCategoryWriteStream(): WriteStreamInterface
178
    {
179
        return new DataImportWriteStream($this->categoryImporterPlugin);
180
    }
181
182
    /**
183
     * @return \SprykerMiddleware\Shared\Process\Stream\WriteStreamInterface
184
     */
185
    public function createProductAbstractWriteStream(): WriteStreamInterface
186
    {
187
        return new DataImportWriteStream($this->productAbstractImporterPlugin);
188
    }
189
190
    /**
191
     * @return \SprykerMiddleware\Shared\Process\Stream\WriteStreamInterface
192
     */
193
    public function createProductConcreteWriteStream(): WriteStreamInterface
194
    {
195
        return new DataImportProductConcreteWriteStream($this->productConcreteImporterPlugin, $this->productAbstractImporterPlugin, $this->productPriceImporterPlugin, $this->productAbstractStoresImporterPlugin);
196
    }
197
198
    /**
199
     * @return \SprykerMiddleware\Shared\Process\Stream\WriteStreamInterface
200
     */
201
    public function createAttributeWriteStream(): WriteStreamInterface
202
    {
203
        return new DataImportWriteStream($this->attributeImporterPlugin);
204
    }
205
}
206