Passed
Push — 5.x ( 38faf3...e84de9 )
by Torben
07:14 queued 04:09
created

Event::getTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Extension "sf_event_mgt" for TYPO3 CMS.
5
 *
6
 * For the full copyright and license information, please read the
7
 * LICENSE.txt file that was distributed with this source code.
8
 */
9
10
namespace DERHANSEN\SfEventMgt\Domain\Model;
11
12
use DERHANSEN\SfEventMgt\Domain\Model\Registration\Field;
13
use DERHANSEN\SfEventMgt\Domain\Repository\RegistrationRepository;
14
use DERHANSEN\SfEventMgt\Utility\MiscUtility;
15
use DERHANSEN\SfEventMgt\Utility\ShowInPreviews;
16
use TYPO3\CMS\Core\Context\Context;
17
use TYPO3\CMS\Core\Resource\FileReference;
18
use TYPO3\CMS\Core\Utility\GeneralUtility;
19
use TYPO3\CMS\Extbase\Annotation as Extbase;
20
use TYPO3\CMS\Extbase\Object\ObjectManager;
21
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
22
23
/**
24
 * Event
25
 */
26
class Event extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
27
{
28
    /**
29
     * @var \DateTime
30
     */
31
    protected $tstamp;
32
33
    /**
34
     * @var bool
35
     */
36
    protected $hidden = false;
37
38
    /**
39
     * @var \DateTime
40
     */
41
    protected $starttime;
42
43
    /**
44
     * @var \DateTime
45
     */
46
    protected $endtime;
47
48
    /**
49
     * Title
50
     *
51
     * @var string
52
     */
53
    protected $title = '';
54
55
    /**
56
     * Teaser
57
     *
58
     * @var string
59
     */
60
    protected $teaser = '';
61
62
    /**
63
     * Description
64
     *
65
     * @var string
66
     */
67
    protected $description = '';
68
69
    /**
70
     * Program/Schedule
71
     *
72
     * @var string
73
     */
74
    protected $program = '';
75
76
    /**
77
     * Startdate and time
78
     *
79
     * @var \DateTime
80
     */
81
    protected $startdate;
82
83
    /**
84
     * Enddate and time
85
     *
86
     * @var \DateTime
87
     */
88
    protected $enddate;
89
90
    /**
91
     * Max participants
92
     *
93
     * @var int
94
     */
95
    protected $maxParticipants = 0;
96
97
    /**
98
     * Max registrations per user
99
     *
100
     * @var int
101
     */
102
    protected $maxRegistrationsPerUser = 1;
103
104
    /**
105
     * Price
106
     *
107
     * @var float
108
     */
109
    protected $price = 0.0;
110
111
    /**
112
     * Currency
113
     *
114
     * @var string
115
     */
116
    protected $currency = '';
117
118
    /**
119
     * Enable payment
120
     *
121
     * @var bool
122
     */
123
    protected $enablePayment = false;
124
125
    /**
126
     * Restrict payment methods
127
     *
128
     * @var bool
129
     */
130
    protected $restrictPaymentMethods = false;
131
132
    /**
133
     * Selected payment methods
134
     *
135
     * @var string
136
     */
137
    protected $selectedPaymentMethods = '';
138
139
    /**
140
     * Category
141
     *
142
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Category>
143
     * @Extbase\ORM\Lazy
144
     */
145
    protected $category;
146
147
    /**
148
     * Related
149
     *
150
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Event>
151
     * @Extbase\ORM\Lazy
152
     */
153
    protected $related;
154
155
    /**
156
     * Registration
157
     *
158
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Registration>
159
     * @Extbase\ORM\Cascade("remove")
160
     * @Extbase\ORM\Lazy
161
     */
162
    protected $registration;
163
164
    /**
165
     * Registration waitlist
166
     *
167
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Registration>
168
     * @Extbase\ORM\Lazy
169
     */
170
    protected $registrationWaitlist;
171
172
    /**
173
     * Registration fields
174
     *
175
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Registration\Field>
176
     * @Extbase\ORM\Lazy
177
     */
178
    protected $registrationFields;
179
180
    /**
181
     * Registration start date
182
     *
183
     * @var \DateTime
184
     */
185
    protected $registrationStartdate;
186
187
    /**
188
     * Registration deadline date
189
     *
190
     * @var \DateTime
191
     */
192
    protected $registrationDeadline;
193
194
    /**
195
     * The image
196
     *
197
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
198
     * @Extbase\ORM\Lazy
199
     */
200
    protected $image;
201
202
    /**
203
     * Additional files
204
     *
205
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
206
     * @Extbase\ORM\Lazy
207
     */
208
    protected $files;
209
210
    /**
211
     * The Location
212
     *
213
     * @var \DERHANSEN\SfEventMgt\Domain\Model\Location
214
     */
215
    protected $location;
216
217
    /**
218
     * Room
219
     *
220
     * @var string
221
     */
222
    protected $room;
223
224
    /**
225
     * Enable registration
226
     *
227
     * @var bool
228
     */
229
    protected $enableRegistration = false;
230
231
    /**
232
     * Enable waitlist
233
     *
234
     * @var bool
235
     */
236
    protected $enableWaitlist = false;
237
238
    /**
239
     * Enable waitlist
240
     *
241
     * @var bool
242
     */
243
    protected $enableWaitlistMoveup = false;
244
245
    /**
246
     * Link
247
     *
248
     * @var string
249
     */
250
    protected $link;
251
252
    /**
253
     * Top event
254
     *
255
     * @var bool
256
     */
257
    protected $topEvent = false;
258
259
    /**
260
     * The additionalImage
261
     *
262
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
263
     * @Extbase\ORM\Lazy
264
     */
265
    protected $additionalImage;
266
267
    /**
268
     * The organisator
269
     *
270
     * @var \DERHANSEN\SfEventMgt\Domain\Model\Organisator
271
     */
272
    protected $organisator;
273
274
    /**
275
     * Notify admin
276
     *
277
     * @var bool
278
     */
279
    protected $notifyAdmin = true;
280
281
    /**
282
     * Notify organisator
283
     *
284
     * @var bool
285
     */
286
    protected $notifyOrganisator = false;
287
288
    /**
289
     * Enable cancel of registration
290
     *
291
     * @var bool
292
     */
293
    protected $enableCancel = false;
294
295
    /**
296
     * Deadline for cancel
297
     *
298
     * @var \DateTime
299
     */
300
    protected $cancelDeadline;
301
302
    /**
303
     * Enable auto confirmation
304
     *
305
     * @var bool
306
     */
307
    protected $enableAutoconfirm = false;
308
309
    /**
310
     * Unique email check
311
     *
312
     * @var bool
313
     */
314
    protected $uniqueEmailCheck = false;
315
316
    /**
317
     * Price options
318
     *
319
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\PriceOption>
320
     * @Extbase\ORM\Cascade("remove")
321
     * @Extbase\ORM\Lazy
322
     */
323
    protected $priceOptions;
324
325
    /**
326
     * Speaker
327
     *
328
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Speaker>
329
     * @Extbase\ORM\Lazy
330
     */
331
    protected $speaker;
332
333
    /**
334
     * Constructor
335
     */
336
    public function __construct()
337
    {
338
        $this->category = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
339
        $this->related = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
340
        $this->registration = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
341
        $this->registrationWaitlist = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
342
        $this->registrationFields = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
343
        $this->image = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
344
        $this->files = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
345
        $this->additionalImage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
346
        $this->priceOptions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
347
        $this->speaker = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
348
    }
349
350
    /**
351
     * Get timestamp
352
     *
353
     * @return \DateTime
354
     */
355
    public function getTstamp()
356
    {
357
        return $this->tstamp;
358
    }
359
360
    /**
361
     * Set time stamp
362
     *
363
     * @param \DateTime $tstamp time stamp
364
     */
365
    public function setTstamp($tstamp)
366
    {
367
        $this->tstamp = $tstamp;
368
    }
369
370
    /**
371
     * Get hidden flag
372
     *
373
     * @return bool
374
     */
375
    public function getHidden()
376
    {
377
        return $this->hidden;
378
    }
379
380
    /**
381
     * Set hidden flag
382
     *
383
     * @param bool $hidden hidden flag
384
     */
385
    public function setHidden($hidden)
386
    {
387
        $this->hidden = $hidden;
388
    }
389
390
    /**
391
     * Get start time
392
     *
393
     * @return \DateTime
394
     */
395
    public function getStarttime()
396
    {
397
        return $this->starttime;
398
    }
399
400
    /**
401
     * Set start time
402
     *
403
     * @param \DateTime $starttime start time
404
     */
405
    public function setStarttime($starttime)
406
    {
407
        $this->starttime = $starttime;
408
    }
409
410
    /**
411
     * Get endtime
412
     *
413
     * @return \DateTime
414
     */
415
    public function getEndtime()
416
    {
417
        return $this->endtime;
418
    }
419
420
    /**
421
     * Set end time
422
     *
423
     * @param \DateTime $endtime end time
424
     */
425
    public function setEndtime($endtime)
426
    {
427
        $this->endtime = $endtime;
428
    }
429
430
    /**
431
     * Returns the title
432
     *
433
     * @return string $title
434
     */
435
    public function getTitle()
436
    {
437
        return $this->title;
438
    }
439
440
    /**
441
     * Sets the title
442
     *
443
     * @param string $title Title
444
     */
445
    public function setTitle($title)
446
    {
447
        $this->title = $title;
448
    }
449
450
    /**
451
     * Returns the teaser
452
     *
453
     * @return string
454
     */
455
    public function getTeaser()
456
    {
457
        return $this->teaser;
458
    }
459
460
    /**
461
     * Sets the teaser
462
     *
463
     * @param string $teaser Teaser
464
     */
465
    public function setTeaser($teaser)
466
    {
467
        $this->teaser = $teaser;
468
    }
469
470
    /**
471
     * Returns the description
472
     *
473
     * @return string $description
474
     */
475
    public function getDescription()
476
    {
477
        return $this->description;
478
    }
479
480
    /**
481
     * Sets the description
482
     *
483
     * @param string $description Description
484
     */
485
    public function setDescription($description)
486
    {
487
        $this->description = $description;
488
    }
489
490
    /**
491
     * Returns the program
492
     *
493
     * @return string $program
494
     */
495
    public function getProgram()
496
    {
497
        return $this->program;
498
    }
499
500
    /**
501
     * Sets the program
502
     *
503
     * @param string $program The program
504
     */
505
    public function setProgram($program)
506
    {
507
        $this->program = $program;
508
    }
509
510
    /**
511
     * Returns the startdate
512
     *
513
     * @return \DateTime $startdate
514
     */
515
    public function getStartdate()
516
    {
517
        return $this->startdate;
518
    }
519
520
    /**
521
     * Sets the startdate
522
     *
523
     * @param \DateTime $startdate Startdate
524
     */
525
    public function setStartdate(\DateTime $startdate)
526
    {
527
        $this->startdate = $startdate;
528
    }
529
530
    /**
531
     * Returns the enddate
532
     *
533
     * @return \DateTime $enddate
534
     */
535
    public function getEnddate()
536
    {
537
        return $this->enddate;
538
    }
539
540
    /**
541
     * Sets the enddate
542
     *
543
     * @param \DateTime $enddate Enddate
544
     */
545
    public function setEnddate(\DateTime $enddate)
546
    {
547
        $this->enddate = $enddate;
548
    }
549
550
    /**
551
     * Returns the participants
552
     *
553
     * @return int $participants
554
     */
555
    public function getMaxParticipants()
556
    {
557
        return $this->maxParticipants;
558
    }
559
560
    /**
561
     * Sets the participants
562
     *
563
     * @param int $participants Participants
564
     */
565
    public function setMaxParticipants($participants)
566
    {
567
        $this->maxParticipants = $participants;
568
    }
569
570
    /**
571
     * Returns the price
572
     *
573
     * @return float $price
574
     */
575
    public function getPrice()
576
    {
577
        return $this->price;
578
    }
579
580
    /**
581
     * Sets the price
582
     *
583
     * @param float $price Price
584
     */
585
    public function setPrice($price)
586
    {
587
        $this->price = $price;
588
    }
589
590
    /**
591
     * Returns the currency
592
     *
593
     * @return string $currency
594
     */
595
    public function getCurrency()
596
    {
597
        return $this->currency;
598
    }
599
600
    /**
601
     * Sets the currency
602
     *
603
     * @param string $currency Currency
604
     */
605
    public function setCurrency($currency)
606
    {
607
        $this->currency = $currency;
608
    }
609
610
    /**
611
     * Returns if payment is enabled
612
     *
613
     * @return bool
614
     */
615
    public function getEnablePayment()
616
    {
617
        return $this->enablePayment;
618
    }
619
620
    /**
621
     * Sets enablePayment
622
     *
623
     * @param bool $enablePayment
624
     */
625
    public function setEnablePayment($enablePayment)
626
    {
627
        $this->enablePayment = $enablePayment;
628
    }
629
630
    /**
631
     * Returns if payment methods should be restricted
632
     *
633
     * @return bool
634
     */
635
    public function getRestrictPaymentMethods()
636
    {
637
        return $this->restrictPaymentMethods;
638
    }
639
640
    /**
641
     * Sets if payment methods should be restricted
642
     *
643
     * @param bool $restrictPaymentMethods
644
     */
645
    public function setRestrictPaymentMethods($restrictPaymentMethods)
646
    {
647
        $this->restrictPaymentMethods = $restrictPaymentMethods;
648
    }
649
650
    /**
651
     * Returns selected payment methods
652
     *
653
     * @return string
654
     */
655
    public function getSelectedPaymentMethods()
656
    {
657
        return $this->selectedPaymentMethods;
658
    }
659
660
    /**
661
     * Sets selected payment methods
662
     *
663
     * @param string $selectedPaymentMethods
664
     */
665
    public function setSelectedPaymentMethods($selectedPaymentMethods)
666
    {
667
        $this->selectedPaymentMethods = $selectedPaymentMethods;
668
    }
669
670
    /**
671
     * Adds a Category
672
     *
673
     * @param \DERHANSEN\SfEventMgt\Domain\Model\Category $category Category
674
     */
675
    public function addCategory(\DERHANSEN\SfEventMgt\Domain\Model\Category $category)
676
    {
677
        $this->category->attach($category);
678
    }
679
680
    /**
681
     * Removes a Category
682
     *
683
     * @param \DERHANSEN\SfEventMgt\Domain\Model\Category $categoryToRemove The Category to be removed
684
     */
685
    public function removeCategory(\DERHANSEN\SfEventMgt\Domain\Model\Category $categoryToRemove)
686
    {
687
        $this->category->detach($categoryToRemove);
688
    }
689
690
    /**
691
     * Returns the category
692
     *
693
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
694
     */
695
    public function getCategory()
696
    {
697
        return $this->category;
698
    }
699
700
    /**
701
     * Returns the category
702
     *
703
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
704
     */
705
    public function getCategories()
706
    {
707
        return $this->category;
708
    }
709
710
    /**
711
     * Sets the category
712
     *
713
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $category Category
714
     */
715
    public function setCategory(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $category)
716
    {
717
        $this->category = $category;
718
    }
719
720
    /**
721
     * Returns related events
722
     *
723
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
724
     */
725
    public function getRelated()
726
    {
727
        return $this->related;
728
    }
729
730
    /**
731
     * Sets related events
732
     *
733
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $related
734
     */
735
    public function setRelated($related)
736
    {
737
        $this->related = $related;
738
    }
739
740
    /**
741
     * Adds a related event
742
     *
743
     * @param Event $event
744
     */
745
    public function addRelated(\DERHANSEN\SfEventMgt\Domain\Model\Event $event)
746
    {
747
        $this->related->attach($event);
748
    }
749
750
    /**
751
     * Removes a related event
752
     *
753
     * @param Event $event
754
     */
755
    public function removeRelated(\DERHANSEN\SfEventMgt\Domain\Model\Event $event)
756
    {
757
        $this->related->detach($event);
758
    }
759
760
    /**
761
     * Adds a Registration
762
     *
763
     * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration
764
     */
765
    public function addRegistration(\DERHANSEN\SfEventMgt\Domain\Model\Registration $registration)
766
    {
767
        $this->registration->attach($registration);
768
    }
769
770
    /**
771
     * Removes a Registration
772
     *
773
     * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registrationToRemove Registration
774
     */
775
    public function removeRegistration(\DERHANSEN\SfEventMgt\Domain\Model\Registration $registrationToRemove)
776
    {
777
        $this->registration->detach($registrationToRemove);
778
    }
779
780
    /**
781
     * Returns the Registration
782
     *
783
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration
784
     */
785
    public function getRegistration()
786
    {
787
        return $this->registration;
788
    }
789
790
    /**
791
     * Sets the Registration
792
     *
793
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration Registration
794
     */
795
    public function setRegistration(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration)
796
    {
797
        $this->registration = $registration;
798
    }
799
800
    /**
801
     * Adds an image
802
     *
803
     * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image Image
804
     */
805
    public function addImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image)
806
    {
807
        $this->image->attach($image);
808
    }
809
810
    /**
811
     * Removes an image
812
     *
813
     * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove Image
814
     */
815
    public function removeImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove)
816
    {
817
        $this->image->detach($imageToRemove);
818
    }
819
820
    /**
821
     * Returns all items of the field image
822
     *
823
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $image
824
     */
825
    public function getImage()
826
    {
827
        return $this->image;
828
    }
829
830
    /**
831
     * Special getter to return images when accesses as {event.images}
832
     *
833
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
834
     */
835
    public function getImages()
836
    {
837
        return $this->image;
838
    }
839
840
    /**
841
     * Returns all image items configured for list view
842
     *
843
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
844
     */
845
    public function getListViewImages()
846
    {
847
        return $this->getImagesByType(ShowInPreviews::LIST_VIEWS);
848
    }
849
850
    /**
851
     * Returns the first list view image as file reference object
852
     *
853
     * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference|null
854
     */
855
    public function getFirstListViewImage()
856
    {
857
        $images = $this->getImagesByType(ShowInPreviews::LIST_VIEWS);
858
        $image = $images->current();
859
860
        if (is_a($image, \TYPO3\CMS\Extbase\Domain\Model\FileReference::class)) {
861
            return $image;
862
        } else {
863
            return null;
864
        }
865
    }
866
867
    /**
868
     * Returns all image items configured for list view
869
     *
870
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
871
     */
872
    public function getDetailViewImages()
873
    {
874
        return $this->getImagesByType(ShowInPreviews::DETAIL_VIEWS);
875
    }
876
877
    /**
878
     * Returns the first detail view image as file reference object
879
     *
880
     * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference|null
881
     */
882
    public function getFirstDetailViewImage()
883
    {
884
        $images = $this->getImagesByType(ShowInPreviews::DETAIL_VIEWS);
885
        $image = $images->current();
886
887
        if (is_a($image, \TYPO3\CMS\Extbase\Domain\Model\FileReference::class)) {
888
            return $image;
889
        } else {
890
            return null;
891
        }
892
    }
893
894
    /**
895
     * Returns all image items by the given type
896
     *
897
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
898
     */
899
    protected function getImagesByType(int $type)
900
    {
901
        $result = new ObjectStorage();
902
903
        foreach ($this->image as $image) {
904
            /** @var FileReference $fileReference */
905
            $fileReference = $image->getOriginalResource();
0 ignored issues
show
Bug introduced by
The method getOriginalResource() does not exist on TYPO3\CMS\Extbase\Domain...t\DomainObjectInterface. It seems like you code against a sub-type of TYPO3\CMS\Extbase\Domain...t\DomainObjectInterface such as TYPO3\CMS\Extbase\Domain\Model\AbstractFileFolder. ( Ignorable by Annotation )

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

905
            /** @scrutinizer ignore-call */ 
906
            $fileReference = $image->getOriginalResource();
Loading history...
906
            if ($fileReference && $fileReference->hasProperty('show_in_views') &&
907
                in_array($fileReference->getProperty('show_in_views'), [$type, ShowInPreviews::ALL_VIEWS])
908
            ) {
909
                $result->attach($image);
910
            }
911
        }
912
913
        return $result;
914
    }
915
916
    /**
917
     * Sets the image
918
     *
919
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $image Image
920
     */
921
    public function setImage(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $image)
922
    {
923
        $this->image = $image;
924
    }
925
926
    /**
927
     * Adds a file
928
     *
929
     * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $file File
930
     */
931
    public function addFiles(\TYPO3\CMS\Extbase\Domain\Model\FileReference $file)
932
    {
933
        $this->files->attach($file);
934
    }
935
936
    /**
937
     * Removes a file
938
     *
939
     * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $fileToRemove File
940
     */
941
    public function removeFiles(\TYPO3\CMS\Extbase\Domain\Model\FileReference $fileToRemove)
942
    {
943
        $this->files->detach($fileToRemove);
944
    }
945
946
    /**
947
     * Returns the files
948
     *
949
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage $files
950
     */
951
    public function getFiles()
952
    {
953
        return $this->files;
954
    }
955
956
    /**
957
     * Sets the files
958
     *
959
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $files Files
960
     */
961
    public function setFiles(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $files)
962
    {
963
        $this->files = $files;
964
    }
965
966
    /**
967
     * Returns if the registration for this event is logically possible
968
     *
969
     * @return bool
970
     */
971
    public function getRegistrationPossible()
972
    {
973
        $maxParticipantsNotReached = true;
974
        if ($this->getMaxParticipants() > 0 && $this->getRegistrations()->count() >= $this->maxParticipants) {
975
            $maxParticipantsNotReached = false;
976
        }
977
        $deadlineNotReached = true;
978
        if ($this->getRegistrationDeadline() != null && $this->getRegistrationDeadline() <= new \DateTime()) {
979
            $deadlineNotReached = false;
980
        }
981
        $registrationStartReached = true;
982
        if ($this->getRegistrationStartdate() != null && $this->getRegistrationStartdate() > new \DateTime()) {
983
            $registrationStartReached = false;
984
        }
985
986
        return ($this->getStartdate() > new \DateTime()) &&
987
        ($maxParticipantsNotReached || !$maxParticipantsNotReached && $this->enableWaitlist) &&
988
        $this->getEnableRegistration() && $deadlineNotReached && $registrationStartReached;
989
    }
990
991
    /**
992
     * Returns the amount of free places
993
     *
994
     * @return int
995
     */
996
    public function getFreePlaces()
997
    {
998
        return $this->maxParticipants - $this->getRegistrations()->count();
999
    }
1000
1001
    /**
1002
     * Sets the location
1003
     *
1004
     * @param \DERHANSEN\SfEventMgt\Domain\Model\Location $location Location
1005
     */
1006
    public function setLocation($location)
1007
    {
1008
        $this->location = $location;
1009
    }
1010
1011
    /**
1012
     * Returns the location
1013
     *
1014
     * @return \DERHANSEN\SfEventMgt\Domain\Model\Location
1015
     */
1016
    public function getLocation()
1017
    {
1018
        return $this->location;
1019
    }
1020
1021
    /**
1022
     * Returns the room
1023
     *
1024
     * @return string
1025
     */
1026
    public function getRoom()
1027
    {
1028
        return $this->room;
1029
    }
1030
1031
    /**
1032
     * Sets the room
1033
     *
1034
     * @param string $room
1035
     */
1036
    public function setRoom($room)
1037
    {
1038
        $this->room = $room;
1039
    }
1040
1041
    /**
1042
     * Sets enableRegistration
1043
     *
1044
     * @param bool $enableRegistration EnableRegistration
1045
     */
1046
    public function setEnableRegistration($enableRegistration)
1047
    {
1048
        $this->enableRegistration = $enableRegistration;
1049
    }
1050
1051
    /**
1052
     * Returns if registration is enabled
1053
     *
1054
     * @return bool
1055
     */
1056
    public function getEnableRegistration()
1057
    {
1058
        return $this->enableRegistration;
1059
    }
1060
1061
    /**
1062
     * Returns enableWaitlist
1063
     *
1064
     * @return bool
1065
     */
1066
    public function getEnableWaitlist()
1067
    {
1068
        return $this->enableWaitlist;
1069
    }
1070
1071
    /**
1072
     * Sets enableWaitlist
1073
     *
1074
     * @param bool $enableWaitlist
1075
     */
1076
    public function setEnableWaitlist($enableWaitlist)
1077
    {
1078
        $this->enableWaitlist = $enableWaitlist;
1079
    }
1080
1081
    /**
1082
     * @return bool
1083
     */
1084
    public function getEnableWaitlistMoveup(): bool
1085
    {
1086
        return $this->enableWaitlistMoveup;
1087
    }
1088
1089
    /**
1090
     * @param bool $enableWaitlistMoveup
1091
     */
1092
    public function setEnableWaitlistMoveup($enableWaitlistMoveup): void
1093
    {
1094
        $this->enableWaitlistMoveup = $enableWaitlistMoveup;
1095
    }
1096
1097
    /**
1098
     * Sets the registration startdate
1099
     *
1100
     * @param \DateTime $registrationStartdate RegistrationStartdate
1101
     */
1102
    public function setRegistrationStartdate(\DateTime $registrationStartdate)
1103
    {
1104
        $this->registrationStartdate = $registrationStartdate;
1105
    }
1106
1107
    /**
1108
     * Returns the registration startdate
1109
     *
1110
     * @return \DateTime
1111
     */
1112
    public function getRegistrationStartdate()
1113
    {
1114
        return $this->registrationStartdate;
1115
    }
1116
1117
    /**
1118
     * Sets the registration deadline
1119
     *
1120
     * @param \DateTime $registrationDeadline RegistrationDeadline
1121
     */
1122
    public function setRegistrationDeadline(\DateTime $registrationDeadline)
1123
    {
1124
        $this->registrationDeadline = $registrationDeadline;
1125
    }
1126
1127
    /**
1128
     * Returns the registration deadline
1129
     *
1130
     * @return \DateTime
1131
     */
1132
    public function getRegistrationDeadline()
1133
    {
1134
        return $this->registrationDeadline;
1135
    }
1136
1137
    /**
1138
     * Sets the link
1139
     *
1140
     * @param string $link Link
1141
     */
1142
    public function setLink($link)
1143
    {
1144
        $this->link = $link;
1145
    }
1146
1147
    /**
1148
     * Returns the link
1149
     *
1150
     * @return string
1151
     */
1152
    public function getLink()
1153
    {
1154
        return $this->link;
1155
    }
1156
1157
    /**
1158
     * Sets topEvent
1159
     *
1160
     * @param bool $topEvent TopEvent
1161
     */
1162
    public function setTopEvent($topEvent)
1163
    {
1164
        $this->topEvent = $topEvent;
1165
    }
1166
1167
    /**
1168
     * Returns if topEvent is checked
1169
     *
1170
     * @return bool
1171
     */
1172
    public function getTopEvent()
1173
    {
1174
        return $this->topEvent;
1175
    }
1176
1177
    /**
1178
     * Returns max regisrations per user
1179
     *
1180
     * @return int
1181
     */
1182
    public function getMaxRegistrationsPerUser()
1183
    {
1184
        return $this->maxRegistrationsPerUser;
1185
    }
1186
1187
    /**
1188
     * Sets max registrations per user
1189
     *
1190
     * @param int $maxRegistrationsPerUser MaxRegistrationsPerUser
1191
     */
1192
    public function setMaxRegistrationsPerUser($maxRegistrationsPerUser)
1193
    {
1194
        $this->maxRegistrationsPerUser = $maxRegistrationsPerUser;
1195
    }
1196
1197
    /**
1198
     * Adds an additionalImage
1199
     *
1200
     * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $additionalImage The Image
1201
     */
1202
    public function addAdditionalImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $additionalImage)
1203
    {
1204
        $this->additionalImage->attach($additionalImage);
1205
    }
1206
1207
    /**
1208
     * Removes an additionalImage
1209
     *
1210
     * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $additionalImageToRemove The Image
1211
     */
1212
    public function removeAdditionalImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $additionalImageToRemove)
1213
    {
1214
        $this->additionalImage->detach($additionalImageToRemove);
1215
    }
1216
1217
    /**
1218
     * Returns the additionalImage
1219
     *
1220
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage $additionalImage
1221
     */
1222
    public function getAdditionalImage()
1223
    {
1224
        return $this->additionalImage;
1225
    }
1226
1227
    /**
1228
     * Sets the additionalImage
1229
     *
1230
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $additionalImage The Image
1231
     */
1232
    public function setAdditionalImage(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $additionalImage)
1233
    {
1234
        $this->additionalImage = $additionalImage;
1235
    }
1236
1237
    /**
1238
     * Returns the organisator
1239
     *
1240
     * @return Organisator
1241
     */
1242
    public function getOrganisator()
1243
    {
1244
        return $this->organisator;
1245
    }
1246
1247
    /**
1248
     * Sets the organisator
1249
     *
1250
     * @param Organisator $organisator The organisator
1251
     */
1252
    public function setOrganisator($organisator)
1253
    {
1254
        $this->organisator = $organisator;
1255
    }
1256
1257
    /**
1258
     * Returns notifyAdmin
1259
     *
1260
     * @return bool
1261
     */
1262
    public function getNotifyAdmin()
1263
    {
1264
        return $this->notifyAdmin;
1265
    }
1266
1267
    /**
1268
     * Sets notifyAdmin
1269
     *
1270
     * @param bool $notifyAdmin NotifyAdmin
1271
     */
1272
    public function setNotifyAdmin($notifyAdmin)
1273
    {
1274
        $this->notifyAdmin = $notifyAdmin;
1275
    }
1276
1277
    /**
1278
     * Returns if notifyAdmin is set
1279
     *
1280
     * @return bool
1281
     */
1282
    public function getNotifyOrganisator()
1283
    {
1284
        return $this->notifyOrganisator;
1285
    }
1286
1287
    /**
1288
     * Sets notifyOrganisator
1289
     *
1290
     * @param bool $notifyOrganisator NotifyOrganisator
1291
     */
1292
    public function setNotifyOrganisator($notifyOrganisator)
1293
    {
1294
        $this->notifyOrganisator = $notifyOrganisator;
1295
    }
1296
1297
    /**
1298
     * Sets enableCancel
1299
     *
1300
     * @param bool $enableCancel EnableCancel
1301
     */
1302
    public function setEnableCancel($enableCancel)
1303
    {
1304
        $this->enableCancel = $enableCancel;
1305
    }
1306
1307
    /**
1308
     * Returns if registration can be canceled
1309
     *
1310
     * @return bool
1311
     */
1312
    public function getEnableCancel()
1313
    {
1314
        return $this->enableCancel;
1315
    }
1316
1317
    /**
1318
     * Sets the cancel deadline
1319
     *
1320
     * @param \DateTime $cancelDeadline CancelDeadline
1321
     */
1322
    public function setCancelDeadline(\DateTime $cancelDeadline)
1323
    {
1324
        $this->cancelDeadline = $cancelDeadline;
1325
    }
1326
1327
    /**
1328
     * Returns the cancel deadline
1329
     *
1330
     * @return \DateTime
1331
     */
1332
    public function getCancelDeadline()
1333
    {
1334
        return $this->cancelDeadline;
1335
    }
1336
1337
    /**
1338
     * Returns if autoconfirmation is enabled
1339
     *
1340
     * @return bool
1341
     */
1342
    public function getEnableAutoconfirm()
1343
    {
1344
        return $this->enableAutoconfirm;
1345
    }
1346
1347
    /**
1348
     * Sets enable autoconfirm
1349
     *
1350
     * @param bool $enableAutoconfirm
1351
     */
1352
    public function setEnableAutoconfirm($enableAutoconfirm)
1353
    {
1354
        $this->enableAutoconfirm = $enableAutoconfirm;
1355
    }
1356
1357
    /**
1358
     * Returns uniqueEmailCheck
1359
     *
1360
     * @return bool
1361
     */
1362
    public function getUniqueEmailCheck()
1363
    {
1364
        return $this->uniqueEmailCheck;
1365
    }
1366
1367
    /**
1368
     * Sets UniqueEmailCheck
1369
     *
1370
     * @param bool $uniqueEmailCheck
1371
     */
1372
    public function setUniqueEmailCheck($uniqueEmailCheck)
1373
    {
1374
        $this->uniqueEmailCheck = $uniqueEmailCheck;
1375
    }
1376
1377
    /**
1378
     * Returns price options
1379
     *
1380
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\PriceOption>
1381
     */
1382
    public function getPriceOptions()
1383
    {
1384
        return $this->priceOptions;
1385
    }
1386
1387
    /**
1388
     * Sets price options
1389
     *
1390
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $priceOptions
1391
     */
1392
    public function setPriceOptions($priceOptions)
1393
    {
1394
        $this->priceOptions = $priceOptions;
1395
    }
1396
1397
    /**
1398
     * Adds a price option
1399
     *
1400
     * @param \DERHANSEN\SfEventMgt\Domain\Model\PriceOption $priceOption Price option
1401
     */
1402
    public function addPriceOptions(\DERHANSEN\SfEventMgt\Domain\Model\PriceOption $priceOption)
1403
    {
1404
        $this->priceOptions->attach($priceOption);
1405
    }
1406
1407
    /**
1408
     * Removes a Registration
1409
     *
1410
     * @param \DERHANSEN\SfEventMgt\Domain\Model\PriceOption $priceOption Price option
1411
     */
1412
    public function removePriceOptions(\DERHANSEN\SfEventMgt\Domain\Model\PriceOption $priceOption)
1413
    {
1414
        $this->priceOptions->detach($priceOption);
1415
    }
1416
1417
    /**
1418
     * Returns all active price options sorted by date ASC
1419
     *
1420
     * @return array
1421
     */
1422
    public function getActivePriceOptions()
1423
    {
1424
        $activePriceOptions = [];
1425
        if ($this->getPriceOptions()) {
1426
            $compareDate = new \DateTime('today midnight');
1427
            foreach ($this->getPriceOptions() as $priceOption) {
1428
                if ($priceOption->getValidUntil() >= $compareDate) {
0 ignored issues
show
Bug introduced by
The method getValidUntil() does not exist on TYPO3\CMS\Extbase\Domain...t\DomainObjectInterface. It seems like you code against a sub-type of TYPO3\CMS\Extbase\Domain...t\DomainObjectInterface such as DERHANSEN\SfEventMgt\Domain\Model\PriceOption. ( Ignorable by Annotation )

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

1428
                if ($priceOption->/** @scrutinizer ignore-call */ getValidUntil() >= $compareDate) {
Loading history...
1429
                    $activePriceOptions[$priceOption->getValidUntil()->getTimestamp()] = $priceOption;
1430
                }
1431
            }
1432
        }
1433
        ksort($activePriceOptions);
1434
1435
        return $activePriceOptions;
1436
    }
1437
1438
    /**
1439
     * Returns the current price of the event respecting possible price options
1440
     *
1441
     * @return float
1442
     */
1443
    public function getCurrentPrice()
1444
    {
1445
        $activePriceOptions = $this->getActivePriceOptions();
1446
        if (count($activePriceOptions) >= 1) {
1447
            // Sort active price options and return first element
1448
            return reset($activePriceOptions)->getPrice();
1449
        }
1450
        // Just return the price field
1451
        return $this->price;
1452
    }
1453
1454
    /**
1455
     * Returns registrationWaitlist
1456
     *
1457
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
1458
     */
1459
    public function getRegistrationWaitlist()
1460
    {
1461
        return $this->registrationWaitlist;
1462
    }
1463
1464
    /**
1465
     * Sets registrationWaitlist
1466
     *
1467
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration Registration
1468
     */
1469
    public function setRegistrationWaitlist(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration)
1470
    {
1471
        $this->registrationWaitlist = $registration;
1472
    }
1473
1474
    /**
1475
     * Adds a Registration to the waitlist
1476
     *
1477
     * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration
1478
     */
1479
    public function addRegistrationWaitlist(\DERHANSEN\SfEventMgt\Domain\Model\Registration $registration)
1480
    {
1481
        $this->registrationWaitlist->attach($registration);
1482
    }
1483
1484
    /**
1485
     * Removes a Registration from the waitlist
1486
     *
1487
     * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registrationToRemove Registration
1488
     */
1489
    public function removeRegistrationWaitlist(\DERHANSEN\SfEventMgt\Domain\Model\Registration $registrationToRemove)
1490
    {
1491
        $this->registrationWaitlist->detach($registrationToRemove);
1492
    }
1493
1494
    /**
1495
     * Returns, if cancellation for registrations of the event is possible
1496
     *
1497
     * @return bool
1498
     */
1499
    public function getCancellationPossible()
1500
    {
1501
        $today = new \DateTime('today');
1502
1503
        return ($this->getEnableCancel() && $this->getCancelDeadline() > $today) ||
1504
            ($this->getEnableCancel() && $this->getCancelDeadline() === null && $this->getStartdate() > $today);
1505
    }
1506
1507
    /**
1508
     * Returns speaker
1509
     *
1510
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
1511
     */
1512
    public function getSpeaker()
1513
    {
1514
        return $this->speaker;
1515
    }
1516
1517
    /**
1518
     * Sets speaker
1519
     *
1520
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $speaker
1521
     */
1522
    public function setSpeaker($speaker)
1523
    {
1524
        $this->speaker = $speaker;
1525
    }
1526
1527
    /**
1528
     * Adds a speaker
1529
     *
1530
     * @param \DERHANSEN\SfEventMgt\Domain\Model\Speaker $speaker
1531
     */
1532
    public function addSpeaker(\DERHANSEN\SfEventMgt\Domain\Model\Speaker $speaker)
1533
    {
1534
        $this->speaker->attach($speaker);
1535
    }
1536
1537
    /**
1538
     * Removes a speaker
1539
     *
1540
     * @param \DERHANSEN\SfEventMgt\Domain\Model\Speaker $speaker
1541
     */
1542
    public function removeSpeaker(\DERHANSEN\SfEventMgt\Domain\Model\Speaker $speaker)
1543
    {
1544
        $this->speaker->detach($speaker);
1545
    }
1546
1547
    /**
1548
     * Returns registrationFields
1549
     *
1550
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
1551
     */
1552
    public function getRegistrationFields()
1553
    {
1554
        return $this->registrationFields;
1555
    }
1556
1557
    /**
1558
     * Sets registrationWaitlist
1559
     *
1560
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registrationFields
1561
     */
1562
    public function setRegistrationFields(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $registrationFields)
1563
    {
1564
        $this->registrationFields = $registrationFields;
1565
    }
1566
1567
    /**
1568
     * Adds a registrationField
1569
     *
1570
     * @param Field $registrationField
1571
     */
1572
    public function addRegistrationFields(Field $registrationField)
1573
    {
1574
        $this->registrationFields->attach($registrationField);
1575
    }
1576
1577
    /**
1578
     * Removed a registrationField
1579
     *
1580
     * @param Field $registrationField
1581
     */
1582
    public function removeRegistrationFields(Field $registrationField)
1583
    {
1584
        $this->registrationFields->detach($registrationField);
1585
    }
1586
1587
    /**
1588
     * Returns an array with registration field uids
1589
     *
1590
     * @return array
1591
     */
1592
    public function getRegistrationFieldsUids()
1593
    {
1594
        $result = [];
1595
        foreach ($this->registrationFields as $registrationField) {
1596
            $result[] = $registrationField->getUid();
1597
        }
1598
1599
        return $result;
1600
    }
1601
1602
    /**
1603
     * Returns an array with registration field uids and titles
1604
     * [uid => title]
1605
     *
1606
     * @return array
1607
     */
1608
    public function getRegistrationFieldUidsWithTitle()
1609
    {
1610
        $result = [];
1611
        foreach ($this->registrationFields as $registrationField) {
1612
            $result[$registrationField->getUid()] = $registrationField->getTitle();
0 ignored issues
show
Bug introduced by
The method getTitle() does not exist on TYPO3\CMS\Extbase\Domain...t\DomainObjectInterface. It seems like you code against a sub-type of TYPO3\CMS\Extbase\Domain...t\DomainObjectInterface such as TYPO3\CMS\Extbase\Domain\Model\FrontendUser or TYPO3\CMS\Extensionmanager\Domain\Model\Extension or TYPO3\CMS\Extbase\Domain\Model\BackendUserGroup or DERHANSEN\SfEventMgt\Domain\Model\Event or TYPO3\CMS\Extbase\Domain\Model\FileMount or DERHANSEN\SfEventMgt\Dom...odel\Registration\Field or TYPO3\CMS\Extensionmanager\Domain\Model\Repository or DERHANSEN\SfEventMgt\Domain\Model\Location or TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup or TYPO3\CMS\Extbase\Domain\Model\Category or DERHANSEN\SfEventMgt\Domain\Model\Registration. ( Ignorable by Annotation )

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

1612
            /** @scrutinizer ignore-call */ 
1613
            $result[$registrationField->getUid()] = $registrationField->getTitle();
Loading history...
1613
        }
1614
1615
        return $result;
1616
    }
1617
1618
    /**
1619
     * Special getter to return the amount of registrations that are saved to default language
1620
     * Required since TYPO3 9.5 (#82363)
1621
     *
1622
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
1623
     */
1624
    public function getRegistrations()
1625
    {
1626
        $languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language');
1627
        if ($languageAspect->getId() > 0) {
1628
            return $this->getRegistrationsDefaultLanguage(false);
1629
        }
1630
1631
        return $this->registration;
1632
    }
1633
1634
    /**
1635
     * Special getter to return the amount of waitlist registrations that are saved to default language
1636
     * Required since TYPO3 9.5 (#82363)
1637
     *
1638
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
1639
     */
1640
    public function getRegistrationsWaitlist()
1641
    {
1642
        $languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language');
1643
        if ($languageAspect->getId() > 0) {
1644
            return $this->getRegistrationsDefaultLanguage(true);
1645
        }
1646
1647
        return $this->registrationWaitlist;
1648
    }
1649
1650
    /**
1651
     * Returns an objectStorage object holding all registrations in the default language.
1652
     * Ensures expected behavior of getRegistration() and getRegistrationWaitlist() since TYPO3 issue #82363
1653
     *
1654
     * @param bool $waitlist
1655
     * @return ObjectStorage
1656
     */
1657
    protected function getRegistrationsDefaultLanguage(bool $waitlist = false)
1658
    {
1659
        $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
1660
        $result = $objectManager->get(ObjectStorage::class);
1661
        $registrationRepository = $objectManager->get(RegistrationRepository::class);
1662
        $registrations = $registrationRepository->findByEventAndWaitlist($this, $waitlist);
1663
        foreach ($registrations as $registration) {
1664
            $result->attach($registration);
1665
        }
1666
1667
        return $result;
1668
    }
1669
1670
    /**
1671
     * Returns if the event ends on the same day
1672
     *
1673
     * @return bool
1674
     */
1675
    public function getEndsSameDay(): bool
1676
    {
1677
        if ($this->enddate !== null) {
1678
            return $this->startdate->format('d.m.Y') === $this->enddate->format('d.m.Y');
1679
        }
1680
1681
        return true;
1682
    }
1683
1684
    /**
1685
     * Returns the challenge for the challenge/response spam check
1686
     *
1687
     * @return string
1688
     */
1689
    public function getSpamCheckChallenge(): string
1690
    {
1691
        return MiscUtility::getSpamCheckChallenge($this->getUid());
0 ignored issues
show
Bug introduced by
It seems like $this->getUid() can also be of type null; however, parameter $eventUid of DERHANSEN\SfEventMgt\Uti...getSpamCheckChallenge() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

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

1691
        return MiscUtility::getSpamCheckChallenge(/** @scrutinizer ignore-type */ $this->getUid());
Loading history...
1692
    }
1693
1694
    /**
1695
     * Returns a string to be used as overlay value for the <core:icon> ViewHelper in the Backend Modules
1696
     *
1697
     * @return string
1698
     */
1699
    public function getBackendIconOverlay(): string
1700
    {
1701
        $overlay = '';
1702
        if ($this->getHidden()) {
1703
            $overlay = 'overlay-hidden';
1704
        }
1705
        if (!$this->getHidden() && ($this->getStarttime() || $this->getEndtime())) {
1706
            $overlay = 'overlay-endtime';
1707
        }
1708
1709
        return $overlay;
1710
    }
1711
}
1712