Passed
Push — master ( 6f0e26...8723b8 )
by Dmitry
50:53
created

createCatalogSearchCountQueryExpanderPluginVariants()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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
declare(strict_types = 1);
9
10
namespace Pyz\Client\Catalog;
11
12
use Spryker\Client\Catalog\CatalogDependencyProvider as SprykerCatalogDependencyProvider;
13
use Spryker\Client\Catalog\Plugin\ConfigTransferBuilder\AscendingNameSortConfigTransferBuilderPlugin;
14
use Spryker\Client\Catalog\Plugin\ConfigTransferBuilder\CategoryFacetConfigTransferBuilderPlugin;
15
use Spryker\Client\Catalog\Plugin\ConfigTransferBuilder\DescendingNameSortConfigTransferBuilderPlugin;
16
use Spryker\Client\Catalog\Plugin\Elasticsearch\Query\ProductCatalogSearchQueryPlugin;
17
use Spryker\Client\Catalog\Plugin\Elasticsearch\QueryExpander\PaginatedProductConcreteCatalogSearchQueryExpanderPlugin;
18
use Spryker\Client\Catalog\Plugin\Elasticsearch\ResultFormatter\ProductConcreteCatalogSearchResultFormatterPlugin;
19
use Spryker\Client\Catalog\Plugin\Elasticsearch\ResultFormatter\RawCatalogSearchResultFormatterPlugin;
20
use Spryker\Client\CatalogPriceProductConnector\Plugin\Catalog\QueryExpander\ProductPriceSearchHttpQueryExpanderPlugin;
21
use Spryker\Client\CatalogPriceProductConnector\Plugin\Catalog\ResultFormatter\CurrencyAwareCatalogSearchHttpResultFormatterPlugin;
22
use Spryker\Client\CatalogPriceProductConnector\Plugin\ConfigTransferBuilder\AscendingPriceSortConfigTransferBuilderPlugin;
23
use Spryker\Client\CatalogPriceProductConnector\Plugin\ConfigTransferBuilder\DescendingPriceSortConfigTransferBuilderPlugin;
24
use Spryker\Client\CatalogPriceProductConnector\Plugin\ConfigTransferBuilder\PriceFacetConfigTransferBuilderPlugin;
25
use Spryker\Client\CatalogPriceProductConnector\Plugin\CurrencyAwareCatalogSearchResultFormatterPlugin;
26
use Spryker\Client\CatalogPriceProductConnector\Plugin\CurrencyAwareSuggestionByTypeResultFormatter;
27
use Spryker\Client\CatalogPriceProductConnector\Plugin\ProductPriceQueryExpanderPlugin;
28
use Spryker\Client\CategoryStorage\Plugin\Catalog\ResultFormatter\CategorySuggestionsSearchHttpResultFormatterPlugin;
29
use Spryker\Client\CategoryStorage\Plugin\Catalog\ResultFormatter\CategoryTreeFilterSearchHttpResultFormatterPlugin;
30
use Spryker\Client\CategoryStorage\Plugin\Elasticsearch\ResultFormatter\CategoryTreeFilterPageSearchResultFormatterPlugin;
31
use Spryker\Client\CmsPageSearch\Plugin\Search\SearchHttp\ResultFormatter\CmsPageSuggestionsSearchHttpResultFormatterPlugin;
32
use Spryker\Client\ProductLabelStorage\Plugin\Catalog\ProductLabelSearchHttpFacetConfigTransferBuilderPlugin;
33
use Spryker\Client\ProductLabelStorage\Plugin\ProductLabelFacetConfigTransferBuilderPlugin;
34
use Spryker\Client\ProductListSearch\Plugin\Search\ProductListQueryExpanderPlugin;
35
use Spryker\Client\ProductReview\Plugin\RatingFacetConfigTransferBuilderPlugin;
36
use Spryker\Client\ProductReview\Plugin\RatingSortConfigTransferBuilderPlugin;
37
use Spryker\Client\Search\Dependency\Plugin\QueryInterface;
38
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\CompletionQueryExpanderPlugin;
39
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\FacetQueryExpanderPlugin;
40
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\IsActiveInDateRangeQueryExpanderPlugin;
41
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\IsActiveQueryExpanderPlugin;
42
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\LocalizedQueryExpanderPlugin;
43
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\PaginatedQueryExpanderPlugin;
44
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SortedCategoryQueryExpanderPlugin;
45
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SortedQueryExpanderPlugin;
46
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SpellingSuggestionQueryExpanderPlugin;
47
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\StoreQueryExpanderPlugin;
48
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SuggestionByTypeQueryExpanderPlugin;
49
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\CompletionResultFormatterPlugin;
50
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\FacetResultFormatterPlugin;
51
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\PaginatedResultFormatterPlugin;
52
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\SortedResultFormatterPlugin;
53
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\SpellingSuggestionResultFormatterPlugin;
54
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\SuggestionByTypeResultFormatterPlugin;
55
use Spryker\Client\SearchHttp\Plugin\Catalog\Query\ProductConcreteSearchHttpQueryPlugin;
56
use Spryker\Client\SearchHttp\Plugin\Catalog\Query\SearchHttpQueryPlugin;
57
use Spryker\Client\SearchHttp\Plugin\Catalog\Query\SuggestionSearchHttpQueryPlugin;
58
use Spryker\Client\SearchHttp\Plugin\Catalog\QueryExpander\BasicSearchHttpQueryExpanderPlugin;
59
use Spryker\Client\SearchHttp\Plugin\Catalog\QueryExpander\FacetSearchHttpQueryExpanderPlugin;
60
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\CompletionSearchHttpResultFormatterPlugin;
61
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\FacetSearchHttpResultFormatterPlugin;
62
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\PaginationSearchHttpResultFormatterPlugin;
63
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\ProductSearchHttpResultFormatterPlugin;
64
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\ProductSuggestionSearchHttpResultFormatterPlugin;
65
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\SortSearchHttpResultFormatterPlugin;
66
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\SpellingSuggestionSearchHttpResultFormatterPlugin;
67
use Spryker\Client\SearchHttp\Plugin\Search\ProductConcreteCatalogSearchHttpResultFormatterPlugin;
68
use Spryker\Client\SearchHttp\Plugin\Search\SearchHttpSearchResultCountPlugin;
69
use Spryker\Shared\SearchHttp\SearchHttpConfig;
70
71
class CatalogDependencyProvider extends SprykerCatalogDependencyProvider
72
{
73
    /**
74
     * @return array<\Spryker\Client\Catalog\Dependency\Plugin\FacetConfigTransferBuilderPluginInterface>
75
     */
76
    protected function getFacetConfigTransferBuilderPlugins(): array
77
    {
78
        return [
79
            new CategoryFacetConfigTransferBuilderPlugin(),
80
            new PriceFacetConfigTransferBuilderPlugin(),
81
            new RatingFacetConfigTransferBuilderPlugin(),
82
            new ProductLabelFacetConfigTransferBuilderPlugin(),
83
        ];
84
    }
85
86
    /**
87
     * @return array<\Spryker\Client\Catalog\Dependency\Plugin\SortConfigTransferBuilderPluginInterface>
88
     */
89
    protected function getSortConfigTransferBuilderPlugins(): array
90
    {
91
        return [
92
            new RatingSortConfigTransferBuilderPlugin(),
93
            new AscendingNameSortConfigTransferBuilderPlugin(),
94
            new DescendingNameSortConfigTransferBuilderPlugin(),
95
            new AscendingPriceSortConfigTransferBuilderPlugin(),
96
            new DescendingPriceSortConfigTransferBuilderPlugin(),
97
        ];
98
    }
99
100
    /**
101
     * @phpstan-return \Spryker\Client\SearchExtension\Dependency\Plugin\QueryInterface
102
     *
103
     * @return \Spryker\Client\Search\Dependency\Plugin\QueryInterface
104
     */
105
    protected function createCatalogSearchQueryPlugin(): QueryInterface
106
    {
107
        return new ProductCatalogSearchQueryPlugin();
108
    }
109
110
    /**
111
     * @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface>|array<\Spryker\Client\Search\Dependency\Plugin\QueryExpanderPluginInterface>
112
     */
113
    protected function createCatalogSearchQueryExpanderPlugins(): array
114
    {
115
        return [
116
            new StoreQueryExpanderPlugin(),
117
            new LocalizedQueryExpanderPlugin(),
118
            new ProductPriceQueryExpanderPlugin(),
119
            new SortedQueryExpanderPlugin(),
120
            new SortedCategoryQueryExpanderPlugin(CategoryFacetConfigTransferBuilderPlugin::PARAMETER_NAME),
121
            new PaginatedQueryExpanderPlugin(),
122
            new SpellingSuggestionQueryExpanderPlugin(),
123
            new IsActiveQueryExpanderPlugin(),
124
            new IsActiveInDateRangeQueryExpanderPlugin(),
125
126
            /*
127
             * FacetQueryExpanderPlugin needs to be after other query expanders which filters down the results.
128
             */
129
            new FacetQueryExpanderPlugin(),
130
        ];
131
    }
132
133
    /**
134
     * @return array<\Spryker\Client\Search\Dependency\Plugin\ResultFormatterPluginInterface|\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>
135
     */
136
    protected function createCatalogSearchResultFormatterPlugins(): array
137
    {
138
        return [
139
            new FacetResultFormatterPlugin(),
140
            new SortedResultFormatterPlugin(),
141
            new PaginatedResultFormatterPlugin(),
142
            new CurrencyAwareCatalogSearchResultFormatterPlugin(
143
                new RawCatalogSearchResultFormatterPlugin(),
144
            ),
145
            new SpellingSuggestionResultFormatterPlugin(),
146
            new CategoryTreeFilterPageSearchResultFormatterPlugin(),
147
        ];
148
    }
149
150
    /**
151
     * @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface>|array<\Spryker\Client\Search\Dependency\Plugin\QueryExpanderPluginInterface>
152
     */
153
    protected function createSuggestionQueryExpanderPlugins(): array
154
    {
155
        return [
156
            new StoreQueryExpanderPlugin(),
157
            new LocalizedQueryExpanderPlugin(),
158
            new CompletionQueryExpanderPlugin(),
159
            new SuggestionByTypeQueryExpanderPlugin(),
160
            new IsActiveQueryExpanderPlugin(),
161
            new IsActiveInDateRangeQueryExpanderPlugin(),
162
        ];
163
    }
164
165
    /**
166
     * @phpstan-return array<\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>
167
     *
168
     * @return array<\Spryker\Client\Search\Dependency\Plugin\ResultFormatterPluginInterface|\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>
169
     */
170
    protected function createSuggestionResultFormatterPlugins(): array
171
    {
172
        return [
173
            new CompletionResultFormatterPlugin(),
174
            new CurrencyAwareSuggestionByTypeResultFormatter(
175
                new SuggestionByTypeResultFormatterPlugin(),
0 ignored issues
show
Bug introduced by
new Spryker\Client\Searc...ResultFormatterPlugin() of type Spryker\Client\SearchEla...peResultFormatterPlugin is incompatible with the type Spryker\Client\Search\De...ormatterPluginInterface expected by parameter $rawCatalogSearchResultFormatterPlugin of Spryker\Client\CatalogPr...ormatter::__construct(). ( Ignorable by Annotation )

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

175
                /** @scrutinizer ignore-type */ new SuggestionByTypeResultFormatterPlugin(),
Loading history...
176
            ),
177
        ];
178
    }
179
180
    /**
181
     * @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface>|array<\Spryker\Client\Search\Dependency\Plugin\QueryExpanderPluginInterface>
182
     */
183
    protected function createCatalogSearchCountQueryExpanderPlugins(): array
184
    {
185
        return [
186
            new StoreQueryExpanderPlugin(),
187
            new LocalizedQueryExpanderPlugin(),
188
            new ProductPriceQueryExpanderPlugin(),
189
            new IsActiveQueryExpanderPlugin(),
190
            new IsActiveInDateRangeQueryExpanderPlugin(),
191
        ];
192
    }
193
194
    /**
195
     * @phpstan-return array<\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>
196
     *
197
     * @return array<\Spryker\Client\Search\Dependency\Plugin\ResultFormatterPluginInterface|\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>
198
     */
199
    protected function getProductConcreteCatalogSearchResultFormatterPlugins(): array
200
    {
201
        return [
202
            new ProductConcreteCatalogSearchResultFormatterPlugin(),
203
        ];
204
    }
205
206
    /**
207
     * @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface>|array<\Spryker\Client\Search\Dependency\Plugin\QueryExpanderPluginInterface>
208
     */
209
    protected function getProductConcreteCatalogSearchQueryExpanderPlugins(): array
210
    {
211
        return [
212
            new LocalizedQueryExpanderPlugin(),
213
            new PaginatedProductConcreteCatalogSearchQueryExpanderPlugin(),
214
            new ProductListQueryExpanderPlugin(),
215
        ];
216
    }
217
218
    /**
219
     * @return array<string, array<\Spryker\Client\Catalog\Dependency\Plugin\FacetConfigTransferBuilderPluginInterface>>
220
     */
221
    protected function getFacetConfigTransferBuilderPluginVariants(): array
222
    {
223
        return [
224
            SearchHttpConfig::TYPE_SEARCH_HTTP => [
225
                new CategoryFacetConfigTransferBuilderPlugin(),
226
                new PriceFacetConfigTransferBuilderPlugin(),
227
                new RatingFacetConfigTransferBuilderPlugin(),
228
                new ProductLabelSearchHttpFacetConfigTransferBuilderPlugin(),
229
            ],
230
        ];
231
    }
232
233
    /**
234
     * @phpstan-return array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryInterface>
235
     *
236
     * @return array<\Spryker\Client\Search\Dependency\Plugin\QueryInterface>
237
     */
238
    protected function createCatalogSearchQueryPluginVariants(): array
239
    {
240
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(new Spryker...earchHttpQueryPlugin()) returns the type array<integer,Spryker\Cl...\SearchHttpQueryPlugin> which is incompatible with the documented return type Spryker\Client\Search\De...Plugin\QueryInterface[].
Loading history...
241
            new SearchHttpQueryPlugin(),
242
        ];
243
    }
244
245
    /**
246
     * @phpstan-return array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryInterface>
247
     *
248
     * @return array<\Spryker\Client\Search\Dependency\Plugin\QueryInterface>
249
     */
250
    protected function createSuggestionQueryPluginVariants(): array
251
    {
252
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(new Spryker...earchHttpQueryPlugin()) returns the type array<integer,Spryker\Cl...nSearchHttpQueryPlugin> which is incompatible with the documented return type Spryker\Client\Search\De...Plugin\QueryInterface[].
Loading history...
253
            new SuggestionSearchHttpQueryPlugin(),
254
        ];
255
    }
256
257
    /**
258
     * @return array<string, array<\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>>
259
     */
260
    protected function createProductConcreteCatalogSearchResultFormatterPluginVariants(): array
261
    {
262
        return [
263
            SearchHttpConfig::TYPE_PRODUCT_CONCRETE_SEARCH_HTTP => [
264
                new ProductConcreteCatalogSearchHttpResultFormatterPlugin(),
265
            ],
266
        ];
267
    }
268
269
    /**
270
     * @return array<string, array<\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>>
271
     */
272
    protected function createSuggestionResultFormatterPluginVariants(): array
273
    {
274
        return [
275
            SearchHttpConfig::TYPE_SUGGESTION_SEARCH_HTTP => [
276
                new CompletionSearchHttpResultFormatterPlugin(),
277
                new CurrencyAwareCatalogSearchHttpResultFormatterPlugin(
278
                    new ProductSuggestionSearchHttpResultFormatterPlugin(),
279
                ),
280
                new CategorySuggestionsSearchHttpResultFormatterPlugin(),
281
                new CmsPageSuggestionsSearchHttpResultFormatterPlugin(),
282
            ],
283
        ];
284
    }
285
286
    /**
287
     * @phpstan-return array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryInterface>
288
     *
289
     * @return array<\Spryker\Client\Search\Dependency\Plugin\QueryInterface>
290
     */
291
    protected function createProductConcreteCatalogSearchQueryPluginVariants(): array
292
    {
293
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(new Spryker...earchHttpQueryPlugin()) returns the type array<integer,Spryker\Cl...eSearchHttpQueryPlugin> which is incompatible with the documented return type Spryker\Client\Search\De...Plugin\QueryInterface[].
Loading history...
294
            new ProductConcreteSearchHttpQueryPlugin(),
295
        ];
296
    }
297
298
    /**
299
     * @return array<string, array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface>>
300
     */
301
    protected function createCatalogSearchQueryExpanderPluginVariants(): array
302
    {
303
        return [
304
            SearchHttpConfig::TYPE_SEARCH_HTTP => [
305
                new BasicSearchHttpQueryExpanderPlugin(),
306
                new ProductPriceSearchHttpQueryExpanderPlugin(),
307
                new FacetSearchHttpQueryExpanderPlugin(),
308
            ],
309
        ];
310
    }
311
312
    /**
313
     * @return array<string, array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface>>
314
     */
315
    protected function createCatalogSearchCountQueryExpanderPluginVariants(): array
316
    {
317
        return [
318
            SearchHttpConfig::TYPE_SEARCH_HTTP => [
319
                new ProductPriceSearchHttpQueryExpanderPlugin(),
320
            ],
321
        ];
322
    }
323
324
    /**
325
     * @return array<string, array<\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>>
326
     */
327
    protected function createCatalogSearchResultFormatterPluginVariants(): array
328
    {
329
        return [
330
            SearchHttpConfig::TYPE_SEARCH_HTTP => [
331
                new PaginationSearchHttpResultFormatterPlugin(),
332
                new SortSearchHttpResultFormatterPlugin(),
333
                new CurrencyAwareCatalogSearchHttpResultFormatterPlugin(
334
                    new ProductSearchHttpResultFormatterPlugin(),
335
                ),
336
                new SpellingSuggestionSearchHttpResultFormatterPlugin(),
337
                new FacetSearchHttpResultFormatterPlugin(),
338
                new CategoryTreeFilterSearchHttpResultFormatterPlugin(),
339
            ],
340
        ];
341
    }
342
343
    /**
344
     * @api
345
     *
346
     * @return list<\Spryker\Client\SearchExtension\Dependency\Plugin\SearchResultCountPluginInterface>
0 ignored issues
show
Bug introduced by
The type Pyz\Client\Catalog\list 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...
347
     */
348
    protected function getSearchResultCountPlugins(): array
349
    {
350
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(new Spryker...rchResultCountPlugin()) returns the type array<integer,Spryker\Cl...earchResultCountPlugin> which is incompatible with the documented return type Pyz\Client\Catalog\list.
Loading history...
351
            new SearchHttpSearchResultCountPlugin(),
352
        ];
353
    }
354
}
355