Completed
Pull Request — master (#311)
by
unknown
04:46
created

Offer::applyImagesEvent()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
Offer::createLabelRemovedEvent() 0 1 ?
Offer::createTitleTranslatedEvent() 0 1 ?
1
<?php
2
3
namespace CultuurNet\UDB3\Offer;
4
5
use Broadway\EventSourcing\EventSourcedAggregateRoot;
6
use CultureFeed_Cdb_Item_Base;
7
use CultuurNet\UDB3\BookingInfo;
8
use CultuurNet\UDB3\ContactPoint;
9
use CultuurNet\UDB3\Label;
10
use CultuurNet\UDB3\LabelAwareAggregateRoot;
11
use CultuurNet\UDB3\LabelCollection;
12
use CultuurNet\UDB3\Media\Image;
13
use CultuurNet\UDB3\Media\ImageCollection;
14
use CultuurNet\UDB3\Offer\Commands\Image\AbstractUpdateImage;
15
use CultuurNet\UDB3\Language;
16
use CultuurNet\UDB3\Offer\Events\AbstractBookingInfoUpdated;
17
use CultuurNet\UDB3\Offer\Events\AbstractContactPointUpdated;
18
use CultuurNet\UDB3\Offer\Events\AbstractDescriptionTranslated;
19
use CultuurNet\UDB3\Offer\Events\AbstractDescriptionUpdated;
20
use CultuurNet\UDB3\Offer\Events\AbstractLabelAdded;
21
use CultuurNet\UDB3\Offer\Events\AbstractLabelRemoved;
22
use CultuurNet\UDB3\Offer\Events\AbstractOfferDeleted;
23
use CultuurNet\UDB3\Offer\Events\AbstractOrganizerDeleted;
24
use CultuurNet\UDB3\Offer\Events\AbstractOrganizerUpdated;
25
use CultuurNet\UDB3\Offer\Events\AbstractPriceInfoUpdated;
26
use CultuurNet\UDB3\Offer\Events\AbstractTypicalAgeRangeDeleted;
27
use CultuurNet\UDB3\Offer\Events\AbstractTypicalAgeRangeUpdated;
28
use CultuurNet\UDB3\Offer\Events\Image\AbstractImageAdded;
29
use CultuurNet\UDB3\Offer\Events\Image\AbstractImageRemoved;
30
use CultuurNet\UDB3\Offer\Events\Image\AbstractImagesEvent;
31
use CultuurNet\UDB3\Offer\Events\Image\AbstractImagesImportedFromUDB2;
32
use CultuurNet\UDB3\Offer\Events\Image\AbstractImagesUpdatedFromUDB2;
33
use CultuurNet\UDB3\Offer\Events\Image\AbstractImageUpdated;
34
use CultuurNet\UDB3\Offer\Events\Image\AbstractMainImageSelected;
35
use CultuurNet\UDB3\Offer\Events\AbstractTitleTranslated;
36
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractApproved;
37
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractFlaggedAsDuplicate;
38
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractFlaggedAsInappropriate;
39
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractPublished;
40
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractRejected;
41
use CultuurNet\UDB3\PriceInfo\PriceInfo;
42
use Exception;
43
use ValueObjects\Identity\UUID;
44
use ValueObjects\StringLiteral\StringLiteral;
45
46
abstract class Offer extends EventSourcedAggregateRoot implements LabelAwareAggregateRoot
47
{
48
    const DUPLICATE_REASON = 'duplicate';
49
    const INAPPROPRIATE_REASON = 'inappropriate';
50
51
    /**
52
     * @var LabelCollection
53
     */
54
    protected $labels;
55
56
    /**
57
     * @var ImageCollection
58
     */
59
    protected $images;
60
61
    /**
62
     * @var string
63
     *
64
     * Organizer ids can come from UDB2 which does not strictly use UUIDs.
65
     */
66
    protected $organizerId;
67
68
    /**
69
     * @var WorkflowStatus
70
     */
71
    protected $workflowStatus;
72
73
    /**
74
     * @var StringLiteral|null
75
     */
76
    protected $rejectedReason;
77
78
    /**
79
     * @var PriceInfo
80
     */
81
    protected $priceInfo;
82
83
    /**
84
     * Offer constructor.
85
     */
86
    public function __construct()
87
    {
88
        $this->labels = new LabelCollection();
89
        $this->images = new ImageCollection();
90
    }
91
92
    /**
93
     * Get the id of the main image if one is selected for this offer.
94
     *
95
     * @return UUID|null
96
     */
97
    protected function getMainImageId()
98
    {
99
        $mainImage = $this->images->getMain();
100
        return isset($mainImage) ? $mainImage->getMediaObjectId() : null;
101
    }
102
103
    /**
104
     * @inheritdoc
105
     */
106
    public function addLabel(Label $label)
107
    {
108
        if (!$this->labels->contains($label)) {
109
            $this->apply(
110
                $this->createLabelAddedEvent($label)
111
            );
112
        }
113
    }
114
115
    /**
116
     * @inheritdoc
117
     */
118
    public function removeLabel(Label $label)
119
    {
120
        if ($this->labels->contains($label)) {
121
            $this->apply(
122
                $this->createLabelRemovedEvent($label)
123
            );
124
        }
125
    }
126
127
    /**
128
     * @param Language $language
129
     * @param StringLiteral $title
130
     */
131
    public function translateTitle(Language $language, StringLiteral $title)
132
    {
133
        $this->apply(
134
            $this->createTitleTranslatedEvent($language, $title)
135
        );
136
    }
137
138
    /**
139
     * @param Language $language
140
     * @param StringLiteral $description
141
     */
142
    public function translateDescription(Language $language, StringLiteral $description)
143
    {
144
        $this->apply(
145
            $this->createDescriptionTranslatedEvent($language, $description)
146
        );
147
    }
148
149
150
    /**
151
     * @param string $description
152
     */
153
    public function updateDescription($description)
154
    {
155
        $this->apply(
156
            $this->createDescriptionUpdatedEvent($description)
157
        );
158
    }
159
160
    /**
161
     * @param string $typicalAgeRange
162
     */
163
    public function updateTypicalAgeRange($typicalAgeRange)
164
    {
165
        $this->apply(
166
            $this->createTypicalAgeRangeUpdatedEvent($typicalAgeRange)
167
        );
168
    }
169
170
    public function deleteTypicalAgeRange()
171
    {
172
        $this->apply(
173
            $this->createTypicalAgeRangeDeletedEvent()
174
        );
175
    }
176
177
    /**
178
     * @param string $organizerId
179
     */
180
    public function updateOrganizer($organizerId)
181
    {
182
        if ($this->organizerId !== $organizerId) {
183
            $this->apply(
184
                $this->createOrganizerUpdatedEvent($organizerId)
185
            );
186
        }
187
    }
188
189
    /**
190
     * Delete the given organizer.
191
     *
192
     * @param string $organizerId
193
     */
194
    public function deleteOrganizer($organizerId)
195
    {
196
        if ($this->organizerId === $organizerId) {
197
            $this->apply(
198
                $this->createOrganizerDeletedEvent($organizerId)
199
            );
200
        }
201
    }
202
203
    /**
204
     * Updated the contact info.
205
     * @param ContactPoint $contactPoint
206
     */
207
    public function updateContactPoint(ContactPoint $contactPoint)
208
    {
209
        $this->apply(
210
            $this->createContactPointUpdatedEvent($contactPoint)
211
        );
212
    }
213
214
    /**
215
     * Updated the booking info.
216
     *
217
     * @param BookingInfo $bookingInfo
218
     */
219
    public function updateBookingInfo(BookingInfo $bookingInfo)
220
    {
221
        $this->apply(
222
            $this->createBookingInfoUpdatedEvent($bookingInfo)
223
        );
224
    }
225
226
    /**
227
     * @param PriceInfo $priceInfo
228
     */
229
    public function updatePriceInfo(PriceInfo $priceInfo)
230
    {
231
        if (is_null($this->priceInfo) || $priceInfo->serialize() !== $this->priceInfo->serialize()) {
232
            $this->apply(
233
                $this->createPriceInfoUpdatedEvent($priceInfo)
234
            );
235
        }
236
    }
237
238
    /**
239
     * @param AbstractPriceInfoUpdated $priceInfoUpdated
240
     */
241
    protected function applyPriceInfoUpdated(AbstractPriceInfoUpdated $priceInfoUpdated)
242
    {
243
        $this->priceInfo = $priceInfoUpdated->getPriceInfo();
244
    }
245
246
    /**
247
     * @param AbstractLabelAdded $labelAdded
248
     */
249
    protected function applyLabelAdded(AbstractLabelAdded $labelAdded)
250
    {
251
        $this->labels = $this->labels->with($labelAdded->getLabel());
252
    }
253
254
    /**
255
     * @param AbstractLabelRemoved $labelRemoved
256
     */
257
    protected function applyLabelRemoved(AbstractLabelRemoved $labelRemoved)
258
    {
259
        $this->labels = $this->labels->without($labelRemoved->getLabel());
260
    }
261
262
    /**
263
     * Add a new image.
264
     *
265
     * @param Image $image
266
     */
267
    public function addImage(Image $image)
268
    {
269
        if (!$this->images->contains($image)) {
270
            $this->apply(
271
                $this->createImageAddedEvent($image)
272
            );
273
        }
274
    }
275
276
    /**
277
     * @param AbstractUpdateImage $updateImageCommand
278
     */
279
    public function updateImage(AbstractUpdateImage $updateImageCommand)
280
    {
281
        $this->apply(
282
            $this->createImageUpdatedEvent($updateImageCommand)
283
        );
284
    }
285
286
    /**
287
     * Remove an image.
288
     *
289
     * @param Image $image
290
     */
291
    public function removeImage(Image $image)
292
    {
293
        if ($this->images->contains($image)) {
294
            $this->apply(
295
                $this->createImageRemovedEvent($image)
296
            );
297
        }
298
    }
299
300
    /**
301
     * Make an existing image of the item the main image.
302
     *
303
     * @param Image $image
304
     */
305
    public function selectMainImage(Image $image)
306
    {
307
        if (!$this->images->contains($image)) {
308
            throw new \InvalidArgumentException('You can not select a random image to be main, it has to be added to the item.');
309
        }
310
311
        $oldMainImage = $this->images->getMain();
312
313
        if (!isset($oldMainImage) || $oldMainImage->getMediaObjectId() !== $image->getMediaObjectId()) {
314
            $this->apply(
315
                $this->createMainImageSelectedEvent($image)
316
            );
317
        }
318
    }
319
320
    /**
321
     * Delete the offer.
322
     */
323
    public function delete()
324
    {
325
        $this->apply(
326
            $this->createOfferDeletedEvent()
327
        );
328
    }
329
330
    /**
331
     * @param CultureFeed_Cdb_Item_Base $cdbItem
332
     */
333
    protected function importWorkflowStatus(CultureFeed_Cdb_Item_Base $cdbItem)
334
    {
335
        try {
336
            $workflowStatus = WorkflowStatus::fromNative($cdbItem->getWfStatus());
337
        } catch (\InvalidArgumentException $exception) {
338
            $workflowStatus = WorkflowStatus::READY_FOR_VALIDATION();
339
        }
340
        $this->workflowStatus = $workflowStatus;
341
    }
342
343
    /**
344
     * Publish the offer when it has workflowstatus draft.
345
     * @param \DateTimeInterface $publicationDate
346
     */
347
    public function publish(\DateTimeInterface $publicationDate)
348
    {
349
        $this->guardPublish() ?: $this->apply(
350
            $this->createPublishedEvent($publicationDate)
351
        );
352
    }
353
354
    /**
355
     * @return bool
356
     * @throws Exception
357
     */
358 View Code Duplication
    private function guardPublish()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
359
    {
360
        if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) {
361
            return true; // nothing left to do if the offer has already been published
362
        }
363
364
        if ($this->workflowStatus !== WorkflowStatus::DRAFT()) {
365
            throw new Exception('You can not publish an offer that is not draft');
366
        }
367
368
        return false;
369
    }
370
371
    /**
372
     * Approve the offer when it's waiting for validation.
373
     */
374
    public function approve()
375
    {
376
        $this->guardApprove() ?: $this->apply($this->createApprovedEvent());
377
    }
378
379
    /**
380
     * @return bool
381
     * @throws Exception
382
     */
383 View Code Duplication
    private function guardApprove()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
384
    {
385
        if ($this->workflowStatus === WorkflowStatus::APPROVED()) {
386
            return true; // nothing left to do if the offer has already been approved
387
        }
388
389
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
390
            throw new Exception('You can not approve an offer that is not ready for validation');
391
        }
392
393
        return false;
394
    }
395
396
    /**
397
     * Reject an offer that is waiting for validation with a given reason.
398
     * @param StringLiteral $reason
399
     */
400
    public function reject(StringLiteral $reason)
401
    {
402
        $this->guardRejection($reason) ?: $this->apply($this->createRejectedEvent($reason));
403
    }
404
405
    public function flagAsDuplicate()
406
    {
407
        $reason = new StringLiteral(self::DUPLICATE_REASON);
408
        $this->guardRejection($reason) ?: $this->apply($this->createFlaggedAsDuplicate());
409
    }
410
411
    public function flagAsInappropriate()
412
    {
413
        $reason = new StringLiteral(self::INAPPROPRIATE_REASON);
414
        $this->guardRejection($reason) ?: $this->apply($this->createFlaggedAsInappropriate());
415
    }
416
417
    /**
418
     * @param StringLiteral $reason
419
     * @return bool
420
     *  false when the offer can still be rejected, true when the offer is already rejected for the same reason
421
     * @throws Exception
422
     */
423
    private function guardRejection(StringLiteral $reason)
424
    {
425
        if ($this->workflowStatus === WorkflowStatus::REJECTED()) {
426
            if ($this->rejectedReason && $reason->sameValueAs($this->rejectedReason)) {
427
                return true; // nothing left to do if the offer has already been rejected for the same reason
428
            } else {
429
                throw new Exception('The offer has already been rejected for another reason: ' . $this->rejectedReason);
430
            }
431
        }
432
433
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
434
            throw new Exception('You can not reject an offer that is not ready for validation');
435
        }
436
437
        return false;
438
    }
439
440
    /**
441
     * Overwrites or resets the main image and all media objects
442
     * by importing a new collection of images from UDB2.
443
     *
444
     * @param ImageCollection $images
445
     */
446
    public function importImagesFromUDB2(ImageCollection $images)
447
    {
448
        $this->apply($this->createImagesImportedFromUDB2($images));
449
    }
450
451
    /**
452
     * Overwrites or resets the main image and all media objects
453
     * by updating with a new collection of images from UDB2.
454
     *
455
     * @param ImageCollection $images
456
     */
457
    public function updateImagesFromUDB2(ImageCollection $images)
458
    {
459
        $this->apply($this->createImagesUpdatedFromUDB2($images));
460
    }
461
462
    /**
463
     * @param AbstractPublished $published
464
     */
465
    protected function applyPublished(AbstractPublished $published)
0 ignored issues
show
Unused Code introduced by
The parameter $published is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
466
    {
467
        $this->workflowStatus = WorkflowStatus::READY_FOR_VALIDATION();
468
    }
469
470
    /**
471
     * @param AbstractApproved $approved
472
     */
473
    protected function applyApproved(AbstractApproved $approved)
0 ignored issues
show
Unused Code introduced by
The parameter $approved is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
474
    {
475
        $this->workflowStatus = WorkflowStatus::APPROVED();
476
    }
477
478
    /**
479
     * @param AbstractRejected $rejected
480
     */
481
    protected function applyRejected(AbstractRejected $rejected)
482
    {
483
        $this->rejectedReason = $rejected->getReason();
484
        $this->workflowStatus = WorkflowStatus::REJECTED();
485
    }
486
487
    /**
488
     * @param AbstractFlaggedAsDuplicate $flaggedAsDuplicate
489
     */
490
    protected function applyFlaggedAsDuplicate(AbstractFlaggedAsDuplicate $flaggedAsDuplicate)
0 ignored issues
show
Unused Code introduced by
The parameter $flaggedAsDuplicate is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
491
    {
492
        $this->rejectedReason = new StringLiteral(self::DUPLICATE_REASON);
493
        $this->workflowStatus = WorkflowStatus::REJECTED();
494
    }
495
496
    /**
497
     * @param AbstractFlaggedAsInappropriate $flaggedAsInappropriate
498
     */
499
    protected function applyFlaggedAsInappropriate(AbstractFlaggedAsInappropriate $flaggedAsInappropriate)
0 ignored issues
show
Unused Code introduced by
The parameter $flaggedAsInappropriate is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
500
    {
501
        $this->rejectedReason = new StringLiteral(self::INAPPROPRIATE_REASON);
502
        $this->workflowStatus = WorkflowStatus::REJECTED();
503
    }
504
505
    protected function applyImageAdded(AbstractImageAdded $imageAdded)
506
    {
507
        $this->images = $this->images->with($imageAdded->getImage());
508
    }
509
510
    protected function applyImageRemoved(AbstractImageRemoved $imageRemoved)
511
    {
512
        $this->images = $this->images->without($imageRemoved->getImage());
513
    }
514
515
    protected function applyMainImageSelected(AbstractMainImageSelected $mainImageSelected)
516
    {
517
        $this->images = $this->images->withMain($mainImageSelected->getImage());
518
    }
519
520
    protected function applyOrganizerUpdated(AbstractOrganizerUpdated $organizerUpdated)
521
    {
522
        $this->organizerId = $organizerUpdated->getOrganizerId();
523
    }
524
525
    protected function applyOrganizerDeleted(AbstractOrganizerDeleted $organizerDeleted)
0 ignored issues
show
Unused Code introduced by
The parameter $organizerDeleted is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
526
    {
527
        $this->organizerId = null;
528
    }
529
530
    /**
531
     * @param AbstractImagesImportedFromUDB2 $imagesImportedFromUDB2
532
     */
533
    protected function applyImagesImportedFromUDB2(AbstractImagesImportedFromUDB2 $imagesImportedFromUDB2)
534
    {
535
        $this->applyUdb2ImagesEvent($imagesImportedFromUDB2);
536
    }
537
538
    /**
539
     * @param AbstractImagesUpdatedFromUDB2 $imagesUpdatedFromUDB2
540
     */
541
    protected function applyImagesUpdatedFromUDB2(AbstractImagesUpdatedFromUDB2 $imagesUpdatedFromUDB2)
542
    {
543
        $this->applyUdb2ImagesEvent($imagesUpdatedFromUDB2);
544
    }
545
546
    /**
547
     * This indirect apply method can be called internally to deal with images coming from UDB2.
548
     * Imports from UDB2 only contain the native Dutch content.
549
     * @see https://github.com/cultuurnet/udb3-udb2-bridge/blob/db0a7ab2444f55bb3faae3d59b82b39aaeba253b/test/Media/ImageCollectionFactoryTest.php#L79-L103
550
     * Because of this we have to make sure translated images are left in place.
551
     *
552
     * @param AbstractImagesEvent $imagesEvent
553
     */
554
    protected function applyUdb2ImagesEvent(AbstractImagesEvent $imagesEvent)
555
    {
556
        $newMainImage = $imagesEvent->getImages()->getMain();
557
558
        $dutchImagesList = array_filter(
559
            $imagesEvent->getImages()->toArray(),
560
            function (Image $image) {
561
                return $image->getLanguage()->getCode() === 'nl';
562
            }
563
        );
564
        $translatedImagesList = array_filter(
565
            $this->images->toArray(),
566
            function (Image $image) {
567
                return $image->getLanguage()->getCode() !== 'nl';
568
            }
569
        );
570
571
        $imagesList = array_merge($dutchImagesList, $translatedImagesList);
572
        $images = ImageCollection::fromArray($imagesList);
573
574
        $this->images = isset($newMainImage) ? $images->withMain($newMainImage) : $images;
575
    }
576
577
    /**
578
     * @param Label $label
579
     * @return AbstractLabelAdded
580
     */
581
    abstract protected function createLabelAddedEvent(Label $label);
582
583
    /**
584
     * @param Label $label
585
     * @return AbstractLabelRemoved
586
     */
587
    abstract protected function createLabelRemovedEvent(Label $label);
588
589
    /**
590
     * @param Language $language
591
     * @param StringLiteral $title
592
     * @return AbstractTitleTranslated
593
     */
594
    abstract protected function createTitleTranslatedEvent(Language $language, StringLiteral $title);
595
596
    /**
597
     * @param Language $language
598
     * @param StringLiteral $description
599
     * @return AbstractDescriptionTranslated
600
     */
601
    abstract protected function createDescriptionTranslatedEvent(Language $language, StringLiteral $description);
602
603
    /**
604
     * @param Image $image
605
     * @return AbstractImageAdded
606
     */
607
    abstract protected function createImageAddedEvent(Image $image);
608
609
    /**
610
     * @param Image $image
611
     * @return AbstractImageRemoved
612
     */
613
    abstract protected function createImageRemovedEvent(Image $image);
614
615
    /**
616
     * @param AbstractUpdateImage $updateImageCommand
617
     * @return AbstractImageUpdated
618
     */
619
    abstract protected function createImageUpdatedEvent(
620
        AbstractUpdateImage $updateImageCommand
621
    );
622
623
    /**
624
     * @param Image $image
625
     * @return AbstractMainImageSelected
626
     */
627
    abstract protected function createMainImageSelectedEvent(Image $image);
628
629
    /**
630
     * @return AbstractOfferDeleted
631
     */
632
    abstract protected function createOfferDeletedEvent();
633
634
    /**
635
     * @param string $description
636
     * @return AbstractDescriptionUpdated
637
     */
638
    abstract protected function createDescriptionUpdatedEvent($description);
639
640
    /**
641
     * @param string $typicalAgeRange
642
     * @return AbstractTypicalAgeRangeUpdated
643
     */
644
    abstract protected function createTypicalAgeRangeUpdatedEvent($typicalAgeRange);
645
646
    /**
647
     * @return AbstractTypicalAgeRangeDeleted
648
     */
649
    abstract protected function createTypicalAgeRangeDeletedEvent();
650
651
    /**
652
     * @param string $organizerId
653
     * @return AbstractOrganizerUpdated
654
     */
655
    abstract protected function createOrganizerUpdatedEvent($organizerId);
656
657
    /**
658
     * @param string $organizerId
659
     * @return AbstractOrganizerDeleted
660
     */
661
    abstract protected function createOrganizerDeletedEvent($organizerId);
662
663
    /**
664
     * @param ContactPoint $contactPoint
665
     * @return AbstractContactPointUpdated
666
     */
667
    abstract protected function createContactPointUpdatedEvent(ContactPoint $contactPoint);
668
669
    /**
670
     * @param BookingInfo $bookingInfo
671
     * @return AbstractBookingInfoUpdated
672
     */
673
    abstract protected function createBookingInfoUpdatedEvent(BookingInfo $bookingInfo);
674
675
    /**
676
     * @param PriceInfo $priceInfo
677
     * @return AbstractPriceInfoUpdated
678
     */
679
    abstract protected function createPriceInfoUpdatedEvent(PriceInfo $priceInfo);
680
681
    /**
682
     * @param \DateTimeInterface $publicationDate
683
     * @return AbstractPublished
684
     */
685
    abstract protected function createPublishedEvent(\DateTimeInterface $publicationDate);
686
687
    /**
688
     * @return AbstractApproved
689
     */
690
    abstract protected function createApprovedEvent();
691
692
    /**
693
     * @param StringLiteral $reason
694
     * @return AbstractRejected
695
     */
696
    abstract protected function createRejectedEvent(StringLiteral $reason);
697
698
    /**
699
     * @return AbstractFlaggedAsDuplicate
700
     */
701
    abstract protected function createFlaggedAsDuplicate();
702
703
    /**
704
     * @return AbstractFlaggedAsInappropriate
705
     */
706
    abstract protected function createFlaggedAsInappropriate();
707
708
    /**
709
     * @param ImageCollection $images
710
     * @return AbstractImagesImportedFromUDB2
711
     */
712
    abstract protected function createImagesImportedFromUDB2(ImageCollection $images);
713
714
    /**
715
     * @param ImageCollection $images
716
     * @return AbstractImagesUpdatedFromUDB2
717
     */
718
    abstract protected function createImagesUpdatedFromUDB2(ImageCollection $images);
719
}
720