Passed
Push — master ( 045cdf...e3a9aa )
by
unknown
39:09
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\CustomerCatalog\Plugin\Search\ProductListQueryExpanderPlugin as CustomerCatalogProductListQueryExpanderPlugin;
33
use Spryker\Client\MerchantProductOfferSearch\Plugin\Search\MerchantReferenceQueryExpanderPlugin;
34
use Spryker\Client\MerchantProductSearch\Plugin\Search\MerchantReferenceQueryExpanderPlugin as MerchantProductReferenceQueryExpanderPlugin;
35
use Spryker\Client\ProductLabelStorage\Plugin\Catalog\ProductLabelSearchHttpFacetConfigTransferBuilderPlugin;
36
use Spryker\Client\ProductLabelStorage\Plugin\ProductLabelFacetConfigTransferBuilderPlugin;
37
use Spryker\Client\ProductListSearch\Plugin\Search\ProductListQueryExpanderPlugin as ProductListSearchProductListQueryExpanderPlugin;
38
use Spryker\Client\ProductReview\Plugin\RatingFacetConfigTransferBuilderPlugin;
39
use Spryker\Client\ProductReview\Plugin\RatingSortConfigTransferBuilderPlugin;
40
use Spryker\Client\Search\Dependency\Plugin\QueryInterface;
41
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\CompletionQueryExpanderPlugin;
42
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\FacetQueryExpanderPlugin;
43
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\IsActiveInDateRangeQueryExpanderPlugin;
44
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\IsActiveQueryExpanderPlugin;
45
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\LocalizedQueryExpanderPlugin;
46
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\PaginatedQueryExpanderPlugin;
47
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SortedCategoryQueryExpanderPlugin;
48
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SortedQueryExpanderPlugin;
49
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SpellingSuggestionQueryExpanderPlugin;
50
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\StoreQueryExpanderPlugin;
51
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SuggestionByTypeQueryExpanderPlugin;
52
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\CompletionResultFormatterPlugin;
53
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\FacetResultFormatterPlugin;
54
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\PaginatedResultFormatterPlugin;
55
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\SortedResultFormatterPlugin;
56
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\SpellingSuggestionResultFormatterPlugin;
57
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\SuggestionByTypeResultFormatterPlugin;
58
use Spryker\Client\SearchHttp\Plugin\Catalog\Query\ProductConcreteSearchHttpQueryPlugin;
59
use Spryker\Client\SearchHttp\Plugin\Catalog\Query\SearchHttpQueryPlugin;
60
use Spryker\Client\SearchHttp\Plugin\Catalog\Query\SuggestionSearchHttpQueryPlugin;
61
use Spryker\Client\SearchHttp\Plugin\Catalog\QueryExpander\BasicSearchHttpQueryExpanderPlugin;
62
use Spryker\Client\SearchHttp\Plugin\Catalog\QueryExpander\FacetSearchHttpQueryExpanderPlugin;
63
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\CompletionSearchHttpResultFormatterPlugin;
64
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\FacetSearchHttpResultFormatterPlugin;
65
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\PaginationSearchHttpResultFormatterPlugin;
66
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\ProductSearchHttpResultFormatterPlugin;
67
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\ProductSuggestionSearchHttpResultFormatterPlugin;
68
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\SortSearchHttpResultFormatterPlugin;
69
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\SpellingSuggestionSearchHttpResultFormatterPlugin;
70
use Spryker\Client\SearchHttp\Plugin\Search\ProductConcreteCatalogSearchHttpResultFormatterPlugin;
71
use Spryker\Client\SearchHttp\Plugin\Search\SearchHttpSearchResultCountPlugin;
72
use Spryker\Shared\SearchHttp\SearchHttpConfig;
73
74
class CatalogDependencyProvider extends SprykerCatalogDependencyProvider
75
{
76
    /**
77
     * @return array<\Spryker\Client\Catalog\Dependency\Plugin\FacetConfigTransferBuilderPluginInterface>
78
     */
79
    protected function getFacetConfigTransferBuilderPlugins(): array
80
    {
81
        return [
82
            new CategoryFacetConfigTransferBuilderPlugin(),
83
            new RatingFacetConfigTransferBuilderPlugin(),
84
            new ProductLabelFacetConfigTransferBuilderPlugin(),
85
        ];
86
    }
87
88
    /**
89
     * @return array<\Spryker\Client\Catalog\Dependency\Plugin\SortConfigTransferBuilderPluginInterface>
90
     */
91
    protected function getSortConfigTransferBuilderPlugins(): array
92
    {
93
        return [
94
            new RatingSortConfigTransferBuilderPlugin(),
95
            new AscendingNameSortConfigTransferBuilderPlugin(),
96
            new DescendingNameSortConfigTransferBuilderPlugin(),
97
            new AscendingPriceSortConfigTransferBuilderPlugin(),
98
            new DescendingPriceSortConfigTransferBuilderPlugin(),
99
        ];
100
    }
101
102
    /**
103
     * @phpstan-return \Spryker\Client\SearchExtension\Dependency\Plugin\QueryInterface
104
     *
105
     * @return \Spryker\Client\Search\Dependency\Plugin\QueryInterface
106
     */
107
    protected function createCatalogSearchQueryPlugin(): QueryInterface
108
    {
109
        return new ProductCatalogSearchQueryPlugin();
110
    }
111
112
    /**
113
     * @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface>|array<\Spryker\Client\Search\Dependency\Plugin\QueryExpanderPluginInterface>
114
     */
115
    protected function createCatalogSearchQueryExpanderPlugins(): array
116
    {
117
        return [
118
            new StoreQueryExpanderPlugin(),
119
            new LocalizedQueryExpanderPlugin(),
120
            new ProductPriceQueryExpanderPlugin(),
121
            new SortedQueryExpanderPlugin(),
122
            new SortedCategoryQueryExpanderPlugin(CategoryFacetConfigTransferBuilderPlugin::PARAMETER_NAME),
123
            new PaginatedQueryExpanderPlugin(),
124
            new SpellingSuggestionQueryExpanderPlugin(),
125
            new IsActiveQueryExpanderPlugin(),
126
            new IsActiveInDateRangeQueryExpanderPlugin(),
127
            new CustomerCatalogProductListQueryExpanderPlugin(),
128
            new MerchantReferenceQueryExpanderPlugin(),
129
130
            /*
131
             * FacetQueryExpanderPlugin needs to be after other query expanders which filters down the results.
132
             */
133
            new FacetQueryExpanderPlugin(),
134
        ];
135
    }
136
137
    /**
138
     * @phpstan-return array<\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>
139
     *
140
     * @return array<\Spryker\Client\Search\Dependency\Plugin\ResultFormatterPluginInterface|\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>
141
     */
142
    protected function createCatalogSearchResultFormatterPlugins(): array
143
    {
144
        return [
145
            new FacetResultFormatterPlugin(),
146
            new SortedResultFormatterPlugin(),
147
            new PaginatedResultFormatterPlugin(),
148
            new CurrencyAwareCatalogSearchResultFormatterPlugin(
149
                new RawCatalogSearchResultFormatterPlugin(),
150
            ),
151
            new SpellingSuggestionResultFormatterPlugin(),
152
            new CategoryTreeFilterPageSearchResultFormatterPlugin(),
153
        ];
154
    }
155
156
    /**
157
     * @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface>|array<\Spryker\Client\Search\Dependency\Plugin\QueryExpanderPluginInterface>
158
     */
159
    protected function createSuggestionQueryExpanderPlugins(): array
160
    {
161
        return [
162
            new StoreQueryExpanderPlugin(),
163
            new LocalizedQueryExpanderPlugin(),
164
            new CompletionQueryExpanderPlugin(),
165
            new SuggestionByTypeQueryExpanderPlugin(),
166
            new IsActiveQueryExpanderPlugin(),
167
            new IsActiveInDateRangeQueryExpanderPlugin(),
168
            new CustomerCatalogProductListQueryExpanderPlugin(),
169
            new MerchantReferenceQueryExpanderPlugin(),
170
        ];
171
    }
172
173
    /**
174
     * @phpstan-return array<\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>
175
     *
176
     * @return array<\Spryker\Client\Search\Dependency\Plugin\ResultFormatterPluginInterface|\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>
177
     */
178
    protected function createSuggestionResultFormatterPlugins(): array
179
    {
180
        $suggestionByTypeResultFormatterPlugin = new SuggestionByTypeResultFormatterPlugin();
181
182
        return [
183
            new CompletionResultFormatterPlugin(),
184
            new CurrencyAwareSuggestionByTypeResultFormatter(
185
                $suggestionByTypeResultFormatterPlugin,
0 ignored issues
show
Bug introduced by
$suggestionByTypeResultFormatterPlugin 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

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