Completed
Pull Request — master (#314)
by Luc
04:56
created

Offer::isDescriptionChanged()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 2
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\Description;
10
use CultuurNet\UDB3\Label;
11
use CultuurNet\UDB3\LabelAwareAggregateRoot;
12
use CultuurNet\UDB3\LabelCollection;
13
use CultuurNet\UDB3\Media\Image;
14
use CultuurNet\UDB3\Media\ImageCollection;
15
use CultuurNet\UDB3\Offer\Commands\Image\AbstractUpdateImage;
16
use CultuurNet\UDB3\Language;
17
use CultuurNet\UDB3\Offer\Events\AbstractBookingInfoUpdated;
18
use CultuurNet\UDB3\Offer\Events\AbstractContactPointUpdated;
19
use CultuurNet\UDB3\Offer\Events\AbstractDescriptionTranslated;
20
use CultuurNet\UDB3\Offer\Events\AbstractDescriptionUpdated;
21
use CultuurNet\UDB3\Offer\Events\AbstractLabelAdded;
22
use CultuurNet\UDB3\Offer\Events\AbstractLabelRemoved;
23
use CultuurNet\UDB3\Offer\Events\AbstractOfferDeleted;
24
use CultuurNet\UDB3\Offer\Events\AbstractOrganizerDeleted;
25
use CultuurNet\UDB3\Offer\Events\AbstractOrganizerUpdated;
26
use CultuurNet\UDB3\Offer\Events\AbstractPriceInfoUpdated;
27
use CultuurNet\UDB3\Offer\Events\AbstractTypicalAgeRangeDeleted;
28
use CultuurNet\UDB3\Offer\Events\AbstractTypicalAgeRangeUpdated;
29
use CultuurNet\UDB3\Offer\Events\Image\AbstractImageAdded;
30
use CultuurNet\UDB3\Offer\Events\Image\AbstractImageRemoved;
31
use CultuurNet\UDB3\Offer\Events\Image\AbstractImagesEvent;
32
use CultuurNet\UDB3\Offer\Events\Image\AbstractImagesImportedFromUDB2;
33
use CultuurNet\UDB3\Offer\Events\Image\AbstractImagesUpdatedFromUDB2;
34
use CultuurNet\UDB3\Offer\Events\Image\AbstractImageUpdated;
35
use CultuurNet\UDB3\Offer\Events\Image\AbstractMainImageSelected;
36
use CultuurNet\UDB3\Offer\Events\AbstractTitleTranslated;
37
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractApproved;
38
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractFlaggedAsDuplicate;
39
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractFlaggedAsInappropriate;
40
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractPublished;
41
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractRejected;
42
use CultuurNet\UDB3\PriceInfo\PriceInfo;
43
use Exception;
44
use ValueObjects\Identity\UUID;
45
use ValueObjects\StringLiteral\StringLiteral;
46
47
abstract class Offer extends EventSourcedAggregateRoot implements LabelAwareAggregateRoot
48
{
49
    const DUPLICATE_REASON = 'duplicate';
50
    const INAPPROPRIATE_REASON = 'inappropriate';
51
52
    /**
53
     * @var LabelCollection
54
     */
55
    protected $labels;
56
57
    /**
58
     * @var ImageCollection
59
     */
60
    protected $images;
61
62
    /**
63
     * @var string
64
     *
65
     * Organizer ids can come from UDB2 which does not strictly use UUIDs.
66
     */
67
    protected $organizerId;
68
69
    /**
70
     * @var WorkflowStatus
71
     */
72
    protected $workflowStatus;
73
74
    /**
75
     * @var StringLiteral|null
76
     */
77
    protected $rejectedReason;
78
79
    /**
80
     * @var PriceInfo
81
     */
82
    protected $priceInfo;
83
84
    /**
85
     * @var Description[]
86
     */
87
    protected $descriptions;
88
89
    /**
90
     * @var Language
91
     */
92
    protected $mainLanguage;
93
94
    /**
95
     * Offer constructor.
96
     */
97
    public function __construct()
98
    {
99
        // For now the main language is hard coded on nl.
100
        // In the future it should be set on create.
101
        $this->mainLanguage = new Language('nl');
102
103
        $this->descriptions = [];
104
        $this->labels = new LabelCollection();
105
        $this->images = new ImageCollection();
106
    }
107
108
    /**
109
     * Get the id of the main image if one is selected for this offer.
110
     *
111
     * @return UUID|null
112
     */
113
    protected function getMainImageId()
114
    {
115
        $mainImage = $this->images->getMain();
116
        return isset($mainImage) ? $mainImage->getMediaObjectId() : null;
117
    }
118
119
    /**
120
     * @inheritdoc
121
     */
122
    public function addLabel(Label $label)
123
    {
124
        if (!$this->labels->contains($label)) {
125
            $this->apply(
126
                $this->createLabelAddedEvent($label)
127
            );
128
        }
129
    }
130
131
    /**
132
     * @inheritdoc
133
     */
134
    public function removeLabel(Label $label)
135
    {
136
        if ($this->labels->contains($label)) {
137
            $this->apply(
138
                $this->createLabelRemovedEvent($label)
139
            );
140
        }
141
    }
142
143
    /**
144
     * @param Language $language
145
     * @param StringLiteral $title
146
     */
147
    public function translateTitle(Language $language, StringLiteral $title)
148
    {
149
        $this->apply(
150
            $this->createTitleTranslatedEvent($language, $title)
151
        );
152
    }
153
154
    /**
155
     * @param Description $description
156
     * @param Language $language
157
     */
158
    public function updateDescription(Description $description, Language $language)
159
    {
160
        if ($this->isDescriptionChanged($description, $language)) {
161
            if ($language->getCode() !== $this->mainLanguage->getCode()) {
162
                $event = $this->createDescriptionTranslatedEvent($language, $description);
163
            } else {
164
                $event = $this->createDescriptionUpdatedEvent((string) $description);
165
            }
166
167
            $this->apply($event);
168
        }
169
    }
170
171
    /**
172
     * @param string $typicalAgeRange
173
     */
174
    public function updateTypicalAgeRange($typicalAgeRange)
175
    {
176
        $this->apply(
177
            $this->createTypicalAgeRangeUpdatedEvent($typicalAgeRange)
178
        );
179
    }
180
181
    public function deleteTypicalAgeRange()
182
    {
183
        $this->apply(
184
            $this->createTypicalAgeRangeDeletedEvent()
185
        );
186
    }
187
188
    /**
189
     * @param string $organizerId
190
     */
191
    public function updateOrganizer($organizerId)
192
    {
193
        if ($this->organizerId !== $organizerId) {
194
            $this->apply(
195
                $this->createOrganizerUpdatedEvent($organizerId)
196
            );
197
        }
198
    }
199
200
    /**
201
     * Delete the given organizer.
202
     *
203
     * @param string $organizerId
204
     */
205
    public function deleteOrganizer($organizerId)
206
    {
207
        if ($this->organizerId === $organizerId) {
208
            $this->apply(
209
                $this->createOrganizerDeletedEvent($organizerId)
210
            );
211
        }
212
    }
213
214
    /**
215
     * Updated the contact info.
216
     * @param ContactPoint $contactPoint
217
     */
218
    public function updateContactPoint(ContactPoint $contactPoint)
219
    {
220
        $this->apply(
221
            $this->createContactPointUpdatedEvent($contactPoint)
222
        );
223
    }
224
225
    /**
226
     * Updated the booking info.
227
     *
228
     * @param BookingInfo $bookingInfo
229
     */
230
    public function updateBookingInfo(BookingInfo $bookingInfo)
231
    {
232
        $this->apply(
233
            $this->createBookingInfoUpdatedEvent($bookingInfo)
234
        );
235
    }
236
237
    /**
238
     * @param PriceInfo $priceInfo
239
     */
240
    public function updatePriceInfo(PriceInfo $priceInfo)
241
    {
242
        if (is_null($this->priceInfo) || $priceInfo->serialize() !== $this->priceInfo->serialize()) {
243
            $this->apply(
244
                $this->createPriceInfoUpdatedEvent($priceInfo)
245
            );
246
        }
247
    }
248
249
    /**
250
     * @param AbstractPriceInfoUpdated $priceInfoUpdated
251
     */
252
    protected function applyPriceInfoUpdated(AbstractPriceInfoUpdated $priceInfoUpdated)
253
    {
254
        $this->priceInfo = $priceInfoUpdated->getPriceInfo();
255
    }
256
257
    /**
258
     * @param AbstractLabelAdded $labelAdded
259
     */
260
    protected function applyLabelAdded(AbstractLabelAdded $labelAdded)
261
    {
262
        $this->labels = $this->labels->with($labelAdded->getLabel());
263
    }
264
265
    /**
266
     * @param AbstractLabelRemoved $labelRemoved
267
     */
268
    protected function applyLabelRemoved(AbstractLabelRemoved $labelRemoved)
269
    {
270
        $this->labels = $this->labels->without($labelRemoved->getLabel());
271
    }
272
273
    protected function applyDescriptionUpdated(AbstractDescriptionUpdated $descriptionUpdated)
274
    {
275
        $mainLanguageCode = $this->mainLanguage->getCode();
276
        $this->descriptions[$mainLanguageCode] = new Description($descriptionUpdated->getDescription());
277
    }
278
279
    protected function applyDescriptionTranslated(AbstractDescriptionTranslated $descriptionTranslated)
280
    {
281
        $languageCode = $descriptionTranslated->getLanguage()->getCode();
282
        $this->descriptions[$languageCode] = $descriptionTranslated->getDescription();
283
    }
284
285
    /**
286
     * Add a new image.
287
     *
288
     * @param Image $image
289
     */
290
    public function addImage(Image $image)
291
    {
292
        if (!$this->images->contains($image)) {
293
            $this->apply(
294
                $this->createImageAddedEvent($image)
295
            );
296
        }
297
    }
298
299
    /**
300
     * @param AbstractUpdateImage $updateImageCommand
301
     */
302
    public function updateImage(AbstractUpdateImage $updateImageCommand)
303
    {
304
        if ($this->images->findImageByUUID($updateImageCommand->getMediaObjectId())) {
305
            $this->apply(
306
                $this->createImageUpdatedEvent($updateImageCommand)
307
            );
308
        }
309
    }
310
311
    /**
312
     * Remove an image.
313
     *
314
     * @param Image $image
315
     */
316
    public function removeImage(Image $image)
317
    {
318
        if ($this->images->contains($image)) {
319
            $this->apply(
320
                $this->createImageRemovedEvent($image)
321
            );
322
        }
323
    }
324
325
    /**
326
     * Make an existing image of the item the main image.
327
     *
328
     * @param Image $image
329
     */
330
    public function selectMainImage(Image $image)
331
    {
332
        if (!$this->images->contains($image)) {
333
            throw new \InvalidArgumentException('You can not select a random image to be main, it has to be added to the item.');
334
        }
335
336
        $oldMainImage = $this->images->getMain();
337
338
        if (!isset($oldMainImage) || $oldMainImage->getMediaObjectId() !== $image->getMediaObjectId()) {
339
            $this->apply(
340
                $this->createMainImageSelectedEvent($image)
341
            );
342
        }
343
    }
344
345
    /**
346
     * Delete the offer.
347
     */
348
    public function delete()
349
    {
350
        $this->apply(
351
            $this->createOfferDeletedEvent()
352
        );
353
    }
354
355
    /**
356
     * @param CultureFeed_Cdb_Item_Base $cdbItem
357
     */
358
    protected function importWorkflowStatus(CultureFeed_Cdb_Item_Base $cdbItem)
359
    {
360
        try {
361
            $workflowStatus = WorkflowStatus::fromNative($cdbItem->getWfStatus());
362
        } catch (\InvalidArgumentException $exception) {
363
            $workflowStatus = WorkflowStatus::READY_FOR_VALIDATION();
364
        }
365
        $this->workflowStatus = $workflowStatus;
366
    }
367
368
    /**
369
     * Publish the offer when it has workflowstatus draft.
370
     * @param \DateTimeInterface $publicationDate
371
     */
372
    public function publish(\DateTimeInterface $publicationDate)
373
    {
374
        $this->guardPublish() ?: $this->apply(
375
            $this->createPublishedEvent($publicationDate)
376
        );
377
    }
378
379
    /**
380
     * @return bool
381
     * @throws Exception
382
     */
383 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...
384
    {
385
        if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) {
386
            return true; // nothing left to do if the offer has already been published
387
        }
388
389
        if ($this->workflowStatus !== WorkflowStatus::DRAFT()) {
390
            throw new Exception('You can not publish an offer that is not draft');
391
        }
392
393
        return false;
394
    }
395
396
    /**
397
     * Approve the offer when it's waiting for validation.
398
     */
399
    public function approve()
400
    {
401
        $this->guardApprove() ?: $this->apply($this->createApprovedEvent());
402
    }
403
404
    /**
405
     * @return bool
406
     * @throws Exception
407
     */
408 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...
409
    {
410
        if ($this->workflowStatus === WorkflowStatus::APPROVED()) {
411
            return true; // nothing left to do if the offer has already been approved
412
        }
413
414
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
415
            throw new Exception('You can not approve an offer that is not ready for validation');
416
        }
417
418
        return false;
419
    }
420
421
    /**
422
     * Reject an offer that is waiting for validation with a given reason.
423
     * @param StringLiteral $reason
424
     */
425
    public function reject(StringLiteral $reason)
426
    {
427
        $this->guardRejection($reason) ?: $this->apply($this->createRejectedEvent($reason));
428
    }
429
430
    public function flagAsDuplicate()
431
    {
432
        $reason = new StringLiteral(self::DUPLICATE_REASON);
433
        $this->guardRejection($reason) ?: $this->apply($this->createFlaggedAsDuplicate());
434
    }
435
436
    public function flagAsInappropriate()
437
    {
438
        $reason = new StringLiteral(self::INAPPROPRIATE_REASON);
439
        $this->guardRejection($reason) ?: $this->apply($this->createFlaggedAsInappropriate());
440
    }
441
442
    /**
443
     * @param StringLiteral $reason
444
     * @return bool
445
     *  false when the offer can still be rejected, true when the offer is already rejected for the same reason
446
     * @throws Exception
447
     */
448
    private function guardRejection(StringLiteral $reason)
449
    {
450
        if ($this->workflowStatus === WorkflowStatus::REJECTED()) {
451
            if ($this->rejectedReason && $reason->sameValueAs($this->rejectedReason)) {
452
                return true; // nothing left to do if the offer has already been rejected for the same reason
453
            } else {
454
                throw new Exception('The offer has already been rejected for another reason: ' . $this->rejectedReason);
455
            }
456
        }
457
458
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
459
            throw new Exception('You can not reject an offer that is not ready for validation');
460
        }
461
462
        return false;
463
    }
464
465
    /**
466
     * @param Description $description
467
     * @param Language $language
468
     * @return bool
469
     */
470
    private function isDescriptionChanged(Description $description, Language $language)
471
    {
472
        $languageCode = $language->getCode();
473
474
        return !isset($this->descriptions[$languageCode]) ||
475
            !$description->sameValueAs($this->descriptions[$languageCode]);
476
    }
477
478
    /**
479
     * Overwrites or resets the main image and all media objects
480
     * by importing a new collection of images from UDB2.
481
     *
482
     * @param ImageCollection $images
483
     */
484
    public function importImagesFromUDB2(ImageCollection $images)
485
    {
486
        $this->apply($this->createImagesImportedFromUDB2($images));
487
    }
488
489
    /**
490
     * Overwrites or resets the main image and all media objects
491
     * by updating with a new collection of images from UDB2.
492
     *
493
     * @param ImageCollection $images
494
     */
495
    public function updateImagesFromUDB2(ImageCollection $images)
496
    {
497
        $this->apply($this->createImagesUpdatedFromUDB2($images));
498
    }
499
500
    /**
501
     * @param AbstractPublished $published
502
     */
503
    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...
504
    {
505
        $this->workflowStatus = WorkflowStatus::READY_FOR_VALIDATION();
506
    }
507
508
    /**
509
     * @param AbstractApproved $approved
510
     */
511
    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...
512
    {
513
        $this->workflowStatus = WorkflowStatus::APPROVED();
514
    }
515
516
    /**
517
     * @param AbstractRejected $rejected
518
     */
519
    protected function applyRejected(AbstractRejected $rejected)
520
    {
521
        $this->rejectedReason = $rejected->getReason();
522
        $this->workflowStatus = WorkflowStatus::REJECTED();
523
    }
524
525
    /**
526
     * @param AbstractFlaggedAsDuplicate $flaggedAsDuplicate
527
     */
528
    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...
529
    {
530
        $this->rejectedReason = new StringLiteral(self::DUPLICATE_REASON);
531
        $this->workflowStatus = WorkflowStatus::REJECTED();
532
    }
533
534
    /**
535
     * @param AbstractFlaggedAsInappropriate $flaggedAsInappropriate
536
     */
537
    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...
538
    {
539
        $this->rejectedReason = new StringLiteral(self::INAPPROPRIATE_REASON);
540
        $this->workflowStatus = WorkflowStatus::REJECTED();
541
    }
542
543
    protected function applyImageAdded(AbstractImageAdded $imageAdded)
544
    {
545
        $this->images = $this->images->with($imageAdded->getImage());
546
    }
547
548
    protected function applyImageRemoved(AbstractImageRemoved $imageRemoved)
549
    {
550
        $this->images = $this->images->without($imageRemoved->getImage());
551
    }
552
553
    protected function applyMainImageSelected(AbstractMainImageSelected $mainImageSelected)
554
    {
555
        $this->images = $this->images->withMain($mainImageSelected->getImage());
556
    }
557
558
    protected function applyOrganizerUpdated(AbstractOrganizerUpdated $organizerUpdated)
559
    {
560
        $this->organizerId = $organizerUpdated->getOrganizerId();
561
    }
562
563
    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...
564
    {
565
        $this->organizerId = null;
566
    }
567
568
    /**
569
     * @param AbstractImagesImportedFromUDB2 $imagesImportedFromUDB2
570
     */
571
    protected function applyImagesImportedFromUDB2(AbstractImagesImportedFromUDB2 $imagesImportedFromUDB2)
572
    {
573
        $this->applyUdb2ImagesEvent($imagesImportedFromUDB2);
574
    }
575
576
    /**
577
     * @param AbstractImagesUpdatedFromUDB2 $imagesUpdatedFromUDB2
578
     */
579
    protected function applyImagesUpdatedFromUDB2(AbstractImagesUpdatedFromUDB2 $imagesUpdatedFromUDB2)
580
    {
581
        $this->applyUdb2ImagesEvent($imagesUpdatedFromUDB2);
582
    }
583
584
    /**
585
     * This indirect apply method can be called internally to deal with images coming from UDB2.
586
     * Imports from UDB2 only contain the native Dutch content.
587
     * @see https://github.com/cultuurnet/udb3-udb2-bridge/blob/db0a7ab2444f55bb3faae3d59b82b39aaeba253b/test/Media/ImageCollectionFactoryTest.php#L79-L103
588
     * Because of this we have to make sure translated images are left in place.
589
     *
590
     * @param AbstractImagesEvent $imagesEvent
591
     */
592
    protected function applyUdb2ImagesEvent(AbstractImagesEvent $imagesEvent)
593
    {
594
        $newMainImage = $imagesEvent->getImages()->getMain();
595
        $dutchImagesList = $imagesEvent->getImages()->toArray();
596
        $translatedImagesList = array_filter(
597
            $this->images->toArray(),
598
            function (Image $image) {
599
                return $image->getLanguage()->getCode() !== 'nl';
600
            }
601
        );
602
603
        $imagesList = array_merge($dutchImagesList, $translatedImagesList);
604
        $images = ImageCollection::fromArray($imagesList);
605
606
        $this->images = isset($newMainImage) ? $images->withMain($newMainImage) : $images;
607
    }
608
609
    /**
610
     * @param Label $label
611
     * @return AbstractLabelAdded
612
     */
613
    abstract protected function createLabelAddedEvent(Label $label);
614
615
    /**
616
     * @param Label $label
617
     * @return AbstractLabelRemoved
618
     */
619
    abstract protected function createLabelRemovedEvent(Label $label);
620
621
    /**
622
     * @param Language $language
623
     * @param StringLiteral $title
624
     * @return AbstractTitleTranslated
625
     */
626
    abstract protected function createTitleTranslatedEvent(Language $language, StringLiteral $title);
627
628
    /**
629
     * @param Language $language
630
     * @param StringLiteral $description
631
     * @return AbstractDescriptionTranslated
632
     */
633
    abstract protected function createDescriptionTranslatedEvent(Language $language, StringLiteral $description);
634
635
    /**
636
     * @param Image $image
637
     * @return AbstractImageAdded
638
     */
639
    abstract protected function createImageAddedEvent(Image $image);
640
641
    /**
642
     * @param Image $image
643
     * @return AbstractImageRemoved
644
     */
645
    abstract protected function createImageRemovedEvent(Image $image);
646
647
    /**
648
     * @param AbstractUpdateImage $updateImageCommand
649
     * @return AbstractImageUpdated
650
     */
651
    abstract protected function createImageUpdatedEvent(
652
        AbstractUpdateImage $updateImageCommand
653
    );
654
655
    /**
656
     * @param Image $image
657
     * @return AbstractMainImageSelected
658
     */
659
    abstract protected function createMainImageSelectedEvent(Image $image);
660
661
    /**
662
     * @return AbstractOfferDeleted
663
     */
664
    abstract protected function createOfferDeletedEvent();
665
666
    /**
667
     * @param string $description
668
     * @return AbstractDescriptionUpdated
669
     */
670
    abstract protected function createDescriptionUpdatedEvent($description);
671
672
    /**
673
     * @param string $typicalAgeRange
674
     * @return AbstractTypicalAgeRangeUpdated
675
     */
676
    abstract protected function createTypicalAgeRangeUpdatedEvent($typicalAgeRange);
677
678
    /**
679
     * @return AbstractTypicalAgeRangeDeleted
680
     */
681
    abstract protected function createTypicalAgeRangeDeletedEvent();
682
683
    /**
684
     * @param string $organizerId
685
     * @return AbstractOrganizerUpdated
686
     */
687
    abstract protected function createOrganizerUpdatedEvent($organizerId);
688
689
    /**
690
     * @param string $organizerId
691
     * @return AbstractOrganizerDeleted
692
     */
693
    abstract protected function createOrganizerDeletedEvent($organizerId);
694
695
    /**
696
     * @param ContactPoint $contactPoint
697
     * @return AbstractContactPointUpdated
698
     */
699
    abstract protected function createContactPointUpdatedEvent(ContactPoint $contactPoint);
700
701
    /**
702
     * @param BookingInfo $bookingInfo
703
     * @return AbstractBookingInfoUpdated
704
     */
705
    abstract protected function createBookingInfoUpdatedEvent(BookingInfo $bookingInfo);
706
707
    /**
708
     * @param PriceInfo $priceInfo
709
     * @return AbstractPriceInfoUpdated
710
     */
711
    abstract protected function createPriceInfoUpdatedEvent(PriceInfo $priceInfo);
712
713
    /**
714
     * @param \DateTimeInterface $publicationDate
715
     * @return AbstractPublished
716
     */
717
    abstract protected function createPublishedEvent(\DateTimeInterface $publicationDate);
718
719
    /**
720
     * @return AbstractApproved
721
     */
722
    abstract protected function createApprovedEvent();
723
724
    /**
725
     * @param StringLiteral $reason
726
     * @return AbstractRejected
727
     */
728
    abstract protected function createRejectedEvent(StringLiteral $reason);
729
730
    /**
731
     * @return AbstractFlaggedAsDuplicate
732
     */
733
    abstract protected function createFlaggedAsDuplicate();
734
735
    /**
736
     * @return AbstractFlaggedAsInappropriate
737
     */
738
    abstract protected function createFlaggedAsInappropriate();
739
740
    /**
741
     * @param ImageCollection $images
742
     * @return AbstractImagesImportedFromUDB2
743
     */
744
    abstract protected function createImagesImportedFromUDB2(ImageCollection $images);
745
746
    /**
747
     * @param ImageCollection $images
748
     * @return AbstractImagesUpdatedFromUDB2
749
     */
750
    abstract protected function createImagesUpdatedFromUDB2(ImageCollection $images);
751
}
752