Failed Conditions
Push — master ( 36cd34...e25ade )
by
unknown
47:16 queued 16:37
created

ProductPageSearchEventSubscriber   C

Complexity

Total Complexity 53

Size/Duplication

Total Lines 601
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 108
c 0
b 0
f 0
dl 0
loc 601
rs 6.96
wmc 53

53 Methods

Rating   Name   Duplication   Size   Complexity  
A addProductPageProductConcreteCreateSearchListener() 0 3 1
A addProductCategoryEvents() 0 12 1
A addProductPageProductCategoryCreateSearchListener() 0 3 1
A addProductPagePriceUpdateSearchListener() 0 3 1
A addProductPageProductAbstractCreateListener() 0 3 1
A addProductPageProductPublishAbstractSearchListener() 0 3 1
A addProductPageCategoryUpdateSearchListener() 0 3 1
A addProductPagePriceProductDefaultCreateSearchListener() 0 3 1
A addProductPageImageSetCreateSearchListener() 0 3 1
A addProductPageProductConcreteLocalizedAttributesDeleteSearchListener() 0 3 1
A addProductPageCategoryNodeDeleteSearchListener() 0 3 1
A addProductPageImageSetProductImageUpdateSearchListener() 0 3 1
A addProductPageCategoryNodeCreateSearchListener() 0 3 1
A addProductPageProductImageDeleteSearchListener() 0 3 1
A addProductPagePriceCreateSearchListener() 0 3 1
A addProductPageCategoryPublishSearchListener() 0 3 1
A addProductPageLocalizedAttributesUpdateSearchListener() 0 3 1
A addProductPageProductCategoryUpdateSearchListener() 0 3 1
A addProductPageProductConcreteLocalizedAttributesCreateSearchListener() 0 3 1
A addProductPageProductUnpublishAbstractListener() 0 3 1
A addProductPageProductConcreteUpdateSearchListener() 0 3 1
A addProductPageCategoryNodeUpdateSearchListener() 0 3 1
A addProductPageUrlDeleteSearchListener() 0 3 1
A addProductPagePriceProductDefaultUpdateSearchListener() 0 3 1
A addProductPageProductPublishAbstractListener() 0 3 1
A addProductImageEvents() 0 10 1
A addProductPageImageSetProductImageCreateSearchListener() 0 3 1
A addPriceProductEvents() 0 10 1
A addProductPageCategoryDeleteSearchListener() 0 3 1
A addProductPageProductCategoryDeleteSearchListener() 0 3 1
A addProductPageProductConcreteDeleteSearchListener() 0 3 1
A addProductPageAvailabilityStockUpdateSearchListener() 0 3 1
A addProductPageLocalizedAttributesDeleteSearchListener() 0 3 1
A addProductPagePriceDeleteSearchListener() 0 3 1
A addProductPageImageSetDeleteSearchListener() 0 3 1
A addProductPagePriceProductDefaultDeleteSearchListener() 0 3 1
A addProductPagePriceTypeUpdateSearchListener() 0 3 1
A addProductPageUrlUpdateSearchListener() 0 3 1
A addProductPageImageSetUpdateSearchListener() 0 3 1
A addProductPageProductImageUpdateSearchListener() 0 3 1
A getSubscribedEvents() 0 32 1
A addProductPageProductAbstractStoreUpdateSearchListener() 0 3 1
A addProductPageLocalizedAttributesCreateSearchListener() 0 3 1
A addProductPageProductAbstractStoreCreateSearchListener() 0 3 1
A addProductPageCategoryCreateSearchListener() 0 3 1
A addProductPageProductAbstractStoreDeleteSearchListener() 0 3 1
A addProductSearchEvents() 0 6 1
A addProductPageProductConcreteLocalizedAttributesUpdateSearchListener() 0 3 1
A addProductPageProductAbstractUpdateListener() 0 3 1
A addProductPageProductAbstractFilterPublishListener() 0 3 1
A addProductPageImageSetProductImageDeleteSearchListener() 0 3 1
A addProductPageProductAbstractDeleteListener() 0 3 1
A addProductPagePriceTypeDeleteSearchListener() 0 3 1

How to fix   Complexity   

Complex Class

Complex classes like ProductPageSearchEventSubscriber often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use ProductPageSearchEventSubscriber, and based on these observations, apply Extract Interface, too.

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 Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Subscriber;
9
10
use Spryker\Shared\ProductPageSearch\ProductPageSearchConfig;
11
use Spryker\Zed\Category\Dependency\CategoryEvents;
12
use Spryker\Zed\Event\Dependency\EventCollectionInterface;
13
use Spryker\Zed\Event\Dependency\Plugin\EventSubscriberInterface;
14
use Spryker\Zed\Kernel\Communication\AbstractPlugin;
15
use Spryker\Zed\PriceProduct\Dependency\PriceProductEvents;
16
use Spryker\Zed\Product\Dependency\ProductEvents;
17
use Spryker\Zed\ProductCategory\Dependency\ProductCategoryEvents;
18
use Spryker\Zed\ProductImage\Dependency\ProductImageEvents;
19
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\PriceProductDefaultProductPagePublishListener;
20
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageAvailabilityStockSearchListener;
21
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageCategoryNodeSearchListener;
22
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageCategorySearchListener;
23
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageImageSetProductImageSearchListener;
24
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageImageSetSearchListener;
25
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageLocalizedAttributesSearchListener;
26
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPagePriceSearchListener;
27
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPagePriceTypeSearchListener;
28
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageProductAbstractListener;
29
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageProductAbstractPublishListener;
30
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageProductAbstractStoreSearchListener;
31
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageProductAbstractUnpublishListener;
32
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageProductCategorySearchListener;
33
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageProductConcreteLocalizedAttributesSearchListener;
34
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageProductConcreteSearchListener;
35
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageProductImageSearchListener;
36
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageUrlSearchListener;
37
use Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductSearchListener;
38
use Spryker\Zed\ProductSearch\Dependency\ProductSearchEvents;
39
use Spryker\Zed\Url\Dependency\UrlEvents;
40
41
/**
42
 * @method \Spryker\Zed\ProductPageSearch\Communication\ProductPageSearchCommunicationFactory getFactory()
43
 * @method \Spryker\Zed\ProductPageSearch\Business\ProductPageSearchFacadeInterface getFacade()
44
 * @method \Spryker\Zed\ProductPageSearch\ProductPageSearchConfig getConfig()
45
 * @method \Spryker\Zed\ProductPageSearch\Persistence\ProductPageSearchQueryContainerInterface getQueryContainer()
46
 */
47
class ProductPageSearchEventSubscriber extends AbstractPlugin implements EventSubscriberInterface
48
{
49
    /**
50
     * @uses \Spryker\Zed\Availability\Dependency\AvailabilityEvents::ENTITY_SPY_AVAILABILITY_UPDATE
51
     *
52
     * @var string
53
     */
54
    protected const ENTITY_SPY_AVAILABILITY_UPDATE = 'Entity.spy_availability.update';
55
56
    /**
57
     * @uses \Spryker\Zed\Category\Dependency\CategoryEvents::ENTITY_CATEGORY_PUBLISH
58
     *
59
     * @var string
60
     */
61
    protected const ENTITY_CATEGORY_PUBLISH = 'Entity.spy_category.publish';
62
63
    /**
64
     * @api
65
     *
66
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
67
     *
68
     * @return \Spryker\Zed\Event\Dependency\EventCollectionInterface
69
     */
70
    public function getSubscribedEvents(EventCollectionInterface $eventCollection)
71
    {
72
        $this->addProductPageProductPublishAbstractListener($eventCollection);
73
        $this->addProductPageProductPublishAbstractSearchListener($eventCollection);
74
        $this->addProductPageProductUnpublishAbstractListener($eventCollection);
75
        $this->addProductPageProductAbstractCreateListener($eventCollection);
76
        $this->addProductPageProductAbstractUpdateListener($eventCollection);
77
        $this->addProductPageProductAbstractDeleteListener($eventCollection);
78
        $this->addProductPageLocalizedAttributesCreateSearchListener($eventCollection);
79
        $this->addProductPageLocalizedAttributesUpdateSearchListener($eventCollection);
80
        $this->addProductPageLocalizedAttributesDeleteSearchListener($eventCollection);
81
        $this->addProductPageProductConcreteCreateSearchListener($eventCollection);
82
        $this->addProductPageProductConcreteUpdateSearchListener($eventCollection);
83
        $this->addProductPageProductConcreteDeleteSearchListener($eventCollection);
84
        $this->addProductPageProductConcreteLocalizedAttributesCreateSearchListener($eventCollection);
85
        $this->addProductPageProductConcreteLocalizedAttributesUpdateSearchListener($eventCollection);
86
        $this->addProductPageProductConcreteLocalizedAttributesDeleteSearchListener($eventCollection);
87
        $this->addProductPageProductAbstractFilterPublishListener($eventCollection);
88
        $this->addProductPageUrlUpdateSearchListener($eventCollection);
89
        $this->addProductPageUrlDeleteSearchListener($eventCollection);
90
        $this->addProductPageProductAbstractStoreCreateSearchListener($eventCollection);
91
        $this->addProductPageProductAbstractStoreUpdateSearchListener($eventCollection);
92
        $this->addProductPageProductAbstractStoreDeleteSearchListener($eventCollection);
93
94
        $this->addPriceProductEvents($eventCollection);
95
        $this->addProductImageEvents($eventCollection);
96
        $this->addProductCategoryEvents($eventCollection);
97
        $this->addProductSearchEvents($eventCollection);
98
99
        $this->addProductPageAvailabilityStockUpdateSearchListener($eventCollection);
100
101
        return $eventCollection;
102
    }
103
104
    /**
105
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
106
     *
107
     * @return void
108
     */
109
    protected function addPriceProductEvents(EventCollectionInterface $eventCollection)
110
    {
111
        $this->addProductPagePriceCreateSearchListener($eventCollection);
112
        $this->addProductPagePriceUpdateSearchListener($eventCollection);
113
        $this->addProductPagePriceDeleteSearchListener($eventCollection);
114
        $this->addProductPagePriceTypeUpdateSearchListener($eventCollection);
115
        $this->addProductPagePriceTypeDeleteSearchListener($eventCollection);
116
        $this->addProductPagePriceProductDefaultCreateSearchListener($eventCollection);
117
        $this->addProductPagePriceProductDefaultUpdateSearchListener($eventCollection);
118
        $this->addProductPagePriceProductDefaultDeleteSearchListener($eventCollection);
119
    }
120
121
    /**
122
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
123
     *
124
     * @return void
125
     */
126
    protected function addProductImageEvents(EventCollectionInterface $eventCollection)
127
    {
128
        $this->addProductPageImageSetCreateSearchListener($eventCollection);
129
        $this->addProductPageImageSetUpdateSearchListener($eventCollection);
130
        $this->addProductPageImageSetDeleteSearchListener($eventCollection);
131
        $this->addProductPageImageSetProductImageCreateSearchListener($eventCollection);
132
        $this->addProductPageImageSetProductImageUpdateSearchListener($eventCollection);
133
        $this->addProductPageImageSetProductImageDeleteSearchListener($eventCollection);
134
        $this->addProductPageProductImageUpdateSearchListener($eventCollection);
135
        $this->addProductPageProductImageDeleteSearchListener($eventCollection);
136
    }
137
138
    /**
139
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
140
     *
141
     * @return void
142
     */
143
    protected function addProductCategoryEvents(EventCollectionInterface $eventCollection)
144
    {
145
        $this->addProductPageProductCategoryCreateSearchListener($eventCollection);
146
        $this->addProductPageProductCategoryUpdateSearchListener($eventCollection);
147
        $this->addProductPageProductCategoryDeleteSearchListener($eventCollection);
148
        $this->addProductPageCategoryCreateSearchListener($eventCollection);
149
        $this->addProductPageCategoryUpdateSearchListener($eventCollection);
150
        $this->addProductPageCategoryDeleteSearchListener($eventCollection);
151
        $this->addProductPageCategoryPublishSearchListener($eventCollection);
152
        $this->addProductPageCategoryNodeCreateSearchListener($eventCollection);
153
        $this->addProductPageCategoryNodeUpdateSearchListener($eventCollection);
154
        $this->addProductPageCategoryNodeDeleteSearchListener($eventCollection);
155
    }
156
157
    /**
158
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
159
     *
160
     * @return void
161
     */
162
    protected function addProductPageProductCategoryCreateSearchListener(EventCollectionInterface $eventCollection)
163
    {
164
        $eventCollection->addListenerQueued(ProductCategoryEvents::ENTITY_SPY_PRODUCT_CATEGORY_CREATE, new ProductPageProductCategorySearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
165
    }
166
167
    /**
168
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
169
     *
170
     * @return void
171
     */
172
    protected function addProductPageProductCategoryUpdateSearchListener(EventCollectionInterface $eventCollection)
173
    {
174
        $eventCollection->addListenerQueued(ProductCategoryEvents::ENTITY_SPY_PRODUCT_CATEGORY_UPDATE, new ProductPageProductCategorySearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
175
    }
176
177
    /**
178
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
179
     *
180
     * @return void
181
     */
182
    protected function addProductPageProductCategoryDeleteSearchListener(EventCollectionInterface $eventCollection)
183
    {
184
        $eventCollection->addListenerQueued(ProductCategoryEvents::ENTITY_SPY_PRODUCT_CATEGORY_DELETE, new ProductPageProductCategorySearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
185
    }
186
187
    /**
188
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
189
     *
190
     * @return void
191
     */
192
    protected function addProductPageCategoryCreateSearchListener(EventCollectionInterface $eventCollection)
193
    {
194
        $eventCollection->addListenerQueued(CategoryEvents::ENTITY_SPY_CATEGORY_CREATE, new ProductPageCategorySearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
195
    }
196
197
    /**
198
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
199
     *
200
     * @return void
201
     */
202
    protected function addProductPageCategoryPublishSearchListener(EventCollectionInterface $eventCollection)
203
    {
204
        $eventCollection->addListenerQueued(static::ENTITY_CATEGORY_PUBLISH, new ProductPageCategorySearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
205
    }
206
207
    /**
208
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
209
     *
210
     * @return void
211
     */
212
    protected function addProductPageCategoryUpdateSearchListener(EventCollectionInterface $eventCollection)
213
    {
214
        $eventCollection->addListenerQueued(CategoryEvents::ENTITY_SPY_CATEGORY_UPDATE, new ProductPageCategorySearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
215
    }
216
217
    /**
218
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
219
     *
220
     * @return void
221
     */
222
    protected function addProductPageCategoryDeleteSearchListener(EventCollectionInterface $eventCollection)
223
    {
224
        $eventCollection->addListenerQueued(CategoryEvents::ENTITY_SPY_CATEGORY_DELETE, new ProductPageCategorySearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
225
    }
226
227
    /**
228
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
229
     *
230
     * @return void
231
     */
232
    protected function addProductPageCategoryNodeCreateSearchListener(EventCollectionInterface $eventCollection)
233
    {
234
        $eventCollection->addListenerQueued(CategoryEvents::ENTITY_SPY_CATEGORY_NODE_CREATE, new ProductPageCategoryNodeSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
235
    }
236
237
    /**
238
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
239
     *
240
     * @return void
241
     */
242
    protected function addProductPageCategoryNodeUpdateSearchListener(EventCollectionInterface $eventCollection)
243
    {
244
        $eventCollection->addListenerQueued(CategoryEvents::ENTITY_SPY_CATEGORY_NODE_UPDATE, new ProductPageCategoryNodeSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
245
    }
246
247
    /**
248
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
249
     *
250
     * @return void
251
     */
252
    protected function addProductPageCategoryNodeDeleteSearchListener(EventCollectionInterface $eventCollection)
253
    {
254
        $eventCollection->addListenerQueued(CategoryEvents::ENTITY_SPY_CATEGORY_NODE_DELETE, new ProductPageCategoryNodeSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
255
    }
256
257
    /**
258
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
259
     *
260
     * @return void
261
     */
262
    protected function addProductPageImageSetCreateSearchListener(EventCollectionInterface $eventCollection)
263
    {
264
        $eventCollection->addListenerQueued(ProductImageEvents::ENTITY_SPY_PRODUCT_IMAGE_SET_CREATE, new ProductPageImageSetSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
265
    }
266
267
    /**
268
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
269
     *
270
     * @return void
271
     */
272
    protected function addProductPageImageSetUpdateSearchListener(EventCollectionInterface $eventCollection)
273
    {
274
        $eventCollection->addListenerQueued(ProductImageEvents::ENTITY_SPY_PRODUCT_IMAGE_SET_UPDATE, new ProductPageImageSetSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
275
    }
276
277
    /**
278
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
279
     *
280
     * @return void
281
     */
282
    protected function addProductPageImageSetDeleteSearchListener(EventCollectionInterface $eventCollection)
283
    {
284
        $eventCollection->addListenerQueued(ProductImageEvents::ENTITY_SPY_PRODUCT_IMAGE_SET_DELETE, new ProductPageImageSetSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
285
    }
286
287
    /**
288
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
289
     *
290
     * @return void
291
     */
292
    protected function addProductPageImageSetProductImageCreateSearchListener(EventCollectionInterface $eventCollection)
293
    {
294
        $eventCollection->addListenerQueued(ProductPageSearchConfig::ENTITY_SPY_PRODUCT_IMAGE_SET_TO_PRODUCT_IMAGE_CREATE, new ProductPageImageSetProductImageSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
295
    }
296
297
    /**
298
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
299
     *
300
     * @return void
301
     */
302
    protected function addProductPageImageSetProductImageUpdateSearchListener(EventCollectionInterface $eventCollection)
303
    {
304
        $eventCollection->addListenerQueued(ProductImageEvents::ENTITY_SPY_PRODUCT_IMAGE_SET_TO_PRODUCT_IMAGE_UPDATE, new ProductPageImageSetProductImageSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
305
    }
306
307
    /**
308
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
309
     *
310
     * @return void
311
     */
312
    protected function addProductPageImageSetProductImageDeleteSearchListener(EventCollectionInterface $eventCollection)
313
    {
314
        $eventCollection->addListenerQueued(ProductImageEvents::ENTITY_SPY_PRODUCT_IMAGE_SET_TO_PRODUCT_IMAGE_DELETE, new ProductPageImageSetProductImageSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
315
    }
316
317
    /**
318
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
319
     *
320
     * @return void
321
     */
322
    protected function addProductPageProductImageUpdateSearchListener(EventCollectionInterface $eventCollection)
323
    {
324
        $eventCollection->addListenerQueued(ProductImageEvents::ENTITY_SPY_PRODUCT_IMAGE_UPDATE, new ProductPageProductImageSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
325
    }
326
327
    /**
328
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
329
     *
330
     * @return void
331
     */
332
    protected function addProductPageProductImageDeleteSearchListener(EventCollectionInterface $eventCollection)
333
    {
334
        $eventCollection->addListenerQueued(ProductImageEvents::ENTITY_SPY_PRODUCT_IMAGE_DELETE, new ProductPageProductImageSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
335
    }
336
337
    /**
338
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
339
     *
340
     * @return void
341
     */
342
    protected function addProductPagePriceCreateSearchListener(EventCollectionInterface $eventCollection)
343
    {
344
        $eventCollection->addListenerQueued(PriceProductEvents::ENTITY_SPY_PRICE_PRODUCT_CREATE, new ProductPagePriceSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
345
    }
346
347
    /**
348
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
349
     *
350
     * @return void
351
     */
352
    protected function addProductPagePriceUpdateSearchListener(EventCollectionInterface $eventCollection)
353
    {
354
        $eventCollection->addListenerQueued(PriceProductEvents::ENTITY_SPY_PRICE_PRODUCT_UPDATE, new ProductPagePriceSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
355
    }
356
357
    /**
358
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
359
     *
360
     * @return void
361
     */
362
    protected function addProductPagePriceDeleteSearchListener(EventCollectionInterface $eventCollection)
363
    {
364
        $eventCollection->addListenerQueued(PriceProductEvents::ENTITY_SPY_PRICE_PRODUCT_DELETE, new ProductPagePriceSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
365
    }
366
367
    /**
368
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
369
     *
370
     * @return void
371
     */
372
    protected function addProductPagePriceTypeUpdateSearchListener(EventCollectionInterface $eventCollection)
373
    {
374
        $eventCollection->addListenerQueued(PriceProductEvents::ENTITY_SPY_PRICE_TYPE_UPDATE, new ProductPagePriceTypeSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
375
    }
376
377
    /**
378
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
379
     *
380
     * @return void
381
     */
382
    protected function addProductPagePriceTypeDeleteSearchListener(EventCollectionInterface $eventCollection)
383
    {
384
        $eventCollection->addListenerQueued(PriceProductEvents::ENTITY_SPY_PRICE_TYPE_DELETE, new ProductPagePriceTypeSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
385
    }
386
387
    /**
388
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
389
     *
390
     * @return void
391
     */
392
    protected function addProductPagePriceProductDefaultCreateSearchListener(EventCollectionInterface $eventCollection)
393
    {
394
        $eventCollection->addListenerQueued(PriceProductEvents::ENTITY_SPY_PRICE_PRODUCT_DEFAULT_CREATE, new PriceProductDefaultProductPagePublishListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
395
    }
396
397
    /**
398
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
399
     *
400
     * @return void
401
     */
402
    protected function addProductPagePriceProductDefaultUpdateSearchListener(EventCollectionInterface $eventCollection)
403
    {
404
        $eventCollection->addListenerQueued(PriceProductEvents::ENTITY_SPY_PRICE_PRODUCT_DEFAULT_UPDATE, new PriceProductDefaultProductPagePublishListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
405
    }
406
407
    /**
408
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
409
     *
410
     * @return void
411
     */
412
    protected function addProductPagePriceProductDefaultDeleteSearchListener(EventCollectionInterface $eventCollection)
413
    {
414
        $eventCollection->addListenerQueued(PriceProductEvents::ENTITY_SPY_PRICE_PRODUCT_DEFAULT_DELETE, new PriceProductDefaultProductPagePublishListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
415
    }
416
417
    /**
418
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
419
     *
420
     * @return void
421
     */
422
    protected function addProductPageProductPublishAbstractListener(EventCollectionInterface $eventCollection)
423
    {
424
        $eventCollection->addListenerQueued(ProductEvents::PRODUCT_ABSTRACT_PUBLISH, new ProductPageProductAbstractPublishListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
425
    }
426
427
    /**
428
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
429
     *
430
     * @return void
431
     */
432
    protected function addProductPageProductPublishAbstractSearchListener(EventCollectionInterface $eventCollection)
433
    {
434
        $eventCollection->addListenerQueued(ProductEvents::PRODUCT_ABSTRACT_SEARCH_PUBLISH, new ProductPageProductAbstractPublishListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
435
    }
436
437
    /**
438
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
439
     *
440
     * @return void
441
     */
442
    protected function addProductPageProductUnpublishAbstractListener(EventCollectionInterface $eventCollection)
443
    {
444
        $eventCollection->addListenerQueued(ProductEvents::PRODUCT_ABSTRACT_UNPUBLISH, new ProductPageProductAbstractUnpublishListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
445
    }
446
447
    /**
448
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
449
     *
450
     * @return void
451
     */
452
    protected function addProductPageProductAbstractCreateListener(EventCollectionInterface $eventCollection)
453
    {
454
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_ABSTRACT_CREATE, new ProductPageProductAbstractPublishListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
455
    }
456
457
    /**
458
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
459
     *
460
     * @return void
461
     */
462
    protected function addProductPageProductAbstractUpdateListener(EventCollectionInterface $eventCollection)
463
    {
464
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_ABSTRACT_UPDATE, new ProductPageProductAbstractPublishListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
465
    }
466
467
    /**
468
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
469
     *
470
     * @return void
471
     */
472
    protected function addProductPageProductAbstractDeleteListener(EventCollectionInterface $eventCollection)
473
    {
474
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_ABSTRACT_DELETE, new ProductPageProductAbstractUnpublishListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
475
    }
476
477
    /**
478
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
479
     *
480
     * @return void
481
     */
482
    protected function addProductPageLocalizedAttributesCreateSearchListener(EventCollectionInterface $eventCollection)
483
    {
484
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_ABSTRACT_LOCALIZED_ATTRIBUTES_CREATE, new ProductPageLocalizedAttributesSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
485
    }
486
487
    /**
488
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
489
     *
490
     * @return void
491
     */
492
    protected function addProductPageLocalizedAttributesUpdateSearchListener(EventCollectionInterface $eventCollection)
493
    {
494
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_ABSTRACT_LOCALIZED_ATTRIBUTES_UPDATE, new ProductPageLocalizedAttributesSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
495
    }
496
497
    /**
498
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
499
     *
500
     * @return void
501
     */
502
    protected function addProductPageLocalizedAttributesDeleteSearchListener(EventCollectionInterface $eventCollection)
503
    {
504
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_ABSTRACT_LOCALIZED_ATTRIBUTES_DELETE, new ProductPageLocalizedAttributesSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
505
    }
506
507
    /**
508
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
509
     *
510
     * @return void
511
     */
512
    protected function addProductPageProductConcreteCreateSearchListener(EventCollectionInterface $eventCollection)
513
    {
514
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_CREATE, new ProductPageProductConcreteSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
515
    }
516
517
    /**
518
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
519
     *
520
     * @return void
521
     */
522
    protected function addProductPageProductConcreteUpdateSearchListener(EventCollectionInterface $eventCollection)
523
    {
524
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_UPDATE, new ProductPageProductConcreteSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
525
    }
526
527
    /**
528
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
529
     *
530
     * @return void
531
     */
532
    protected function addProductPageProductConcreteDeleteSearchListener(EventCollectionInterface $eventCollection)
533
    {
534
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_DELETE, new ProductPageProductConcreteSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
535
    }
536
537
    /**
538
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
539
     *
540
     * @return void
541
     */
542
    protected function addProductPageProductConcreteLocalizedAttributesCreateSearchListener(EventCollectionInterface $eventCollection)
543
    {
544
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_LOCALIZED_ATTRIBUTES_CREATE, new ProductPageProductConcreteLocalizedAttributesSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
545
    }
546
547
    /**
548
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
549
     *
550
     * @return void
551
     */
552
    protected function addProductPageProductConcreteLocalizedAttributesUpdateSearchListener(EventCollectionInterface $eventCollection)
553
    {
554
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_LOCALIZED_ATTRIBUTES_UPDATE, new ProductPageProductConcreteLocalizedAttributesSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
555
    }
556
557
    /**
558
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
559
     *
560
     * @return void
561
     */
562
    protected function addProductPageProductConcreteLocalizedAttributesDeleteSearchListener(EventCollectionInterface $eventCollection)
563
    {
564
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_LOCALIZED_ATTRIBUTES_DELETE, new ProductPageProductConcreteLocalizedAttributesSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
565
    }
566
567
    /**
568
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
569
     *
570
     * @return void
571
     */
572
    protected function addProductPageProductAbstractFilterPublishListener(EventCollectionInterface $eventCollection)
573
    {
574
        $eventCollection->addListenerQueued(ProductSearchEvents::SYNCHRONIZATION_FILTER_PUBLISH, new ProductPageProductAbstractListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
0 ignored issues
show
Deprecated Code introduced by
The class Spryker\Zed\ProductPageS...ProductAbstractListener has been deprecated: Use {@link \Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageProductAbstractPublishListener} and {@link Spryker\Zed\ProductPageSearch\Communication\Plugin\Event\Listener\ProductPageProductAbstractUnpublishListener} instead. ( Ignorable by Annotation )

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

574
        $eventCollection->addListenerQueued(ProductSearchEvents::SYNCHRONIZATION_FILTER_PUBLISH, /** @scrutinizer ignore-deprecated */ new ProductPageProductAbstractListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
Loading history...
575
    }
576
577
    /**
578
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
579
     *
580
     * @return void
581
     */
582
    protected function addProductPageUrlUpdateSearchListener(EventCollectionInterface $eventCollection)
583
    {
584
        $eventCollection->addListenerQueued(UrlEvents::ENTITY_SPY_URL_UPDATE, new ProductPageUrlSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
585
    }
586
587
    /**
588
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
589
     *
590
     * @return void
591
     */
592
    protected function addProductPageUrlDeleteSearchListener(EventCollectionInterface $eventCollection)
593
    {
594
        $eventCollection->addListenerQueued(UrlEvents::ENTITY_SPY_URL_DELETE, new ProductPageUrlSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
595
    }
596
597
    /**
598
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
599
     *
600
     * @return void
601
     */
602
    protected function addProductPageProductAbstractStoreCreateSearchListener(EventCollectionInterface $eventCollection)
603
    {
604
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_ABSTRACT_STORE_CREATE, new ProductPageProductAbstractStoreSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
605
    }
606
607
    /**
608
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
609
     *
610
     * @return void
611
     */
612
    protected function addProductPageProductAbstractStoreUpdateSearchListener(EventCollectionInterface $eventCollection)
613
    {
614
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_ABSTRACT_STORE_UPDATE, new ProductPageProductAbstractStoreSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
615
    }
616
617
    /**
618
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
619
     *
620
     * @return void
621
     */
622
    protected function addProductPageProductAbstractStoreDeleteSearchListener(EventCollectionInterface $eventCollection)
623
    {
624
        $eventCollection->addListenerQueued(ProductEvents::ENTITY_SPY_PRODUCT_ABSTRACT_STORE_DELETE, new ProductPageProductAbstractStoreSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
625
    }
626
627
    /**
628
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
629
     *
630
     * @return void
631
     */
632
    protected function addProductSearchEvents(EventCollectionInterface $eventCollection): void
633
    {
634
        $eventCollection
635
            ->addListenerQueued(ProductSearchEvents::ENTITY_SPY_PRODUCT_SEARCH_CREATE, new ProductSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName())
636
            ->addListenerQueued(ProductSearchEvents::ENTITY_SPY_PRODUCT_SEARCH_UPDATE, new ProductSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName())
637
            ->addListenerQueued(ProductSearchEvents::ENTITY_SPY_PRODUCT_SEARCH_DELETE, new ProductSearchListener(), 0, null, $this->getConfig()->getProductPageEventQueueName());
638
    }
639
640
    /**
641
     * @param \Spryker\Zed\Event\Dependency\EventCollectionInterface $eventCollection
642
     *
643
     * @return void
644
     */
645
    protected function addProductPageAvailabilityStockUpdateSearchListener(EventCollectionInterface $eventCollection)
646
    {
647
        $eventCollection->addListenerQueued(static::ENTITY_SPY_AVAILABILITY_UPDATE, new ProductPageAvailabilityStockSearchListener());
648
    }
649
}
650