Passed
Push — master ( 0fb2d8...8a1d53 )
by
unknown
46:34
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\ProductLabelStorage\Plugin\Catalog\ProductLabelSearchHttpFacetConfigTransferBuilderPlugin;
34
use Spryker\Client\ProductLabelStorage\Plugin\ProductLabelFacetConfigTransferBuilderPlugin;
35
use Spryker\Client\ProductListSearch\Plugin\Search\ProductListQueryExpanderPlugin as ProductListSearchProductListQueryExpanderPlugin;
36
use Spryker\Client\ProductReview\Plugin\RatingFacetConfigTransferBuilderPlugin;
37
use Spryker\Client\ProductReview\Plugin\RatingSortConfigTransferBuilderPlugin;
38
use Spryker\Client\Search\Dependency\Plugin\QueryInterface;
39
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\CompletionQueryExpanderPlugin;
40
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\FacetQueryExpanderPlugin;
41
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\IsActiveInDateRangeQueryExpanderPlugin;
42
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\IsActiveQueryExpanderPlugin;
43
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\LocalizedQueryExpanderPlugin;
44
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\PaginatedQueryExpanderPlugin;
45
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SortedCategoryQueryExpanderPlugin;
46
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SortedQueryExpanderPlugin;
47
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SpellingSuggestionQueryExpanderPlugin;
48
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\StoreQueryExpanderPlugin;
49
use Spryker\Client\SearchElasticsearch\Plugin\QueryExpander\SuggestionByTypeQueryExpanderPlugin;
50
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\CompletionResultFormatterPlugin;
51
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\FacetResultFormatterPlugin;
52
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\PaginatedResultFormatterPlugin;
53
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\SortedResultFormatterPlugin;
54
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\SpellingSuggestionResultFormatterPlugin;
55
use Spryker\Client\SearchElasticsearch\Plugin\ResultFormatter\SuggestionByTypeResultFormatterPlugin;
56
use Spryker\Client\SearchHttp\Plugin\Catalog\Query\ProductConcreteSearchHttpQueryPlugin;
57
use Spryker\Client\SearchHttp\Plugin\Catalog\Query\SearchHttpQueryPlugin;
58
use Spryker\Client\SearchHttp\Plugin\Catalog\Query\SuggestionSearchHttpQueryPlugin;
59
use Spryker\Client\SearchHttp\Plugin\Catalog\QueryExpander\BasicSearchHttpQueryExpanderPlugin;
60
use Spryker\Client\SearchHttp\Plugin\Catalog\QueryExpander\FacetSearchHttpQueryExpanderPlugin;
61
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\CompletionSearchHttpResultFormatterPlugin;
62
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\FacetSearchHttpResultFormatterPlugin;
63
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\PaginationSearchHttpResultFormatterPlugin;
64
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\ProductSearchHttpResultFormatterPlugin;
65
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\ProductSuggestionSearchHttpResultFormatterPlugin;
66
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\SortSearchHttpResultFormatterPlugin;
67
use Spryker\Client\SearchHttp\Plugin\Catalog\ResultFormatter\SpellingSuggestionSearchHttpResultFormatterPlugin;
68
use Spryker\Client\SearchHttp\Plugin\Search\ProductConcreteCatalogSearchHttpResultFormatterPlugin;
69
use Spryker\Client\SearchHttp\Plugin\Search\SearchHttpSearchResultCountPlugin;
70
use Spryker\Shared\SearchHttp\SearchHttpConfig;
71
72
class CatalogDependencyProvider extends SprykerCatalogDependencyProvider
73
{
74
    /**
75
     * @return array<\Spryker\Client\Catalog\Dependency\Plugin\FacetConfigTransferBuilderPluginInterface>
76
     */
77
    protected function getFacetConfigTransferBuilderPlugins(): array
78
    {
79
        return [
80
            new CategoryFacetConfigTransferBuilderPlugin(),
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
            new CustomerCatalogProductListQueryExpanderPlugin(),
126
127
            /*
128
             * FacetQueryExpanderPlugin needs to be after other query expanders which filters down the results.
129
             */
130
            new FacetQueryExpanderPlugin(),
131
        ];
132
    }
133
134
    /**
135
     * @phpstan-return array<\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>
136
     *
137
     * @return array<\Spryker\Client\Search\Dependency\Plugin\ResultFormatterPluginInterface|\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>
138
     */
139
    protected function createCatalogSearchResultFormatterPlugins(): array
140
    {
141
        return [
142
            new FacetResultFormatterPlugin(),
143
            new SortedResultFormatterPlugin(),
144
            new PaginatedResultFormatterPlugin(),
145
            new CurrencyAwareCatalogSearchResultFormatterPlugin(
146
                new RawCatalogSearchResultFormatterPlugin(),
147
            ),
148
            new SpellingSuggestionResultFormatterPlugin(),
149
            new CategoryTreeFilterPageSearchResultFormatterPlugin(),
150
        ];
151
    }
152
153
    /**
154
     * @return array<\Spryker\Client\SearchExtension\Dependency\Plugin\QueryExpanderPluginInterface>|array<\Spryker\Client\Search\Dependency\Plugin\QueryExpanderPluginInterface>
155
     */
156
    protected function createSuggestionQueryExpanderPlugins(): array
157
    {
158
        return [
159
            new StoreQueryExpanderPlugin(),
160
            new LocalizedQueryExpanderPlugin(),
161
            new CompletionQueryExpanderPlugin(),
162
            new SuggestionByTypeQueryExpanderPlugin(),
163
            new IsActiveQueryExpanderPlugin(),
164
            new IsActiveInDateRangeQueryExpanderPlugin(),
165
            new CustomerCatalogProductListQueryExpanderPlugin(),
166
        ];
167
    }
168
169
    /**
170
     * @phpstan-return array<\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>
171
     *
172
     * @return array<\Spryker\Client\Search\Dependency\Plugin\ResultFormatterPluginInterface|\Spryker\Client\SearchExtension\Dependency\Plugin\ResultFormatterPluginInterface>
173
     */
174
    protected function createSuggestionResultFormatterPlugins(): array
175
    {
176
        return [
177
            new CompletionResultFormatterPlugin(),
178
            new CurrencyAwareSuggestionByTypeResultFormatter(
179
                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

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