Completed
Push — master ( 17edcb...7372de )
by Torben
06:23
created

Registration   F

Complexity

Total Complexity 65

Size/Duplication

Total Lines 856
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 98.63%

Importance

Changes 0
Metric Value
wmc 65
lcom 1
cbo 2
dl 0
loc 856
ccs 144
cts 146
cp 0.9863
rs 2.944
c 0
b 0
f 0

65 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFirstname() 0 4 1
A setFirstname() 0 4 1
A getLastname() 0 4 1
A setLastname() 0 4 1
A getTitle() 0 4 1
A setTitle() 0 4 1
A getCompany() 0 4 1
A setCompany() 0 4 1
A getAddress() 0 4 1
A setAddress() 0 4 1
A getZip() 0 4 1
A setZip() 0 4 1
A getCity() 0 4 1
A setCity() 0 4 1
A getCountry() 0 4 1
A setCountry() 0 4 1
A getPhone() 0 4 1
A setPhone() 0 4 1
A getEmail() 0 4 1
A setEmail() 0 4 1
A isIgnoreNotifications() 0 4 1
A getIgnoreNotifications() 0 4 1
A setIgnoreNotifications() 0 4 1
A getGender() 0 4 1
A setGender() 0 4 1
A setDateOfBirth() 0 4 1
A getDateOfBirth() 0 4 1
A getAccepttc() 0 4 1
A setAccepttc() 0 4 1
A getConfirmed() 0 4 1
A setConfirmed() 0 4 1
A isConfirmed() 0 4 1
A getPaid() 0 4 1
A setPaid() 0 4 1
A isPaid() 0 4 1
A setEvent() 0 4 1
A getEvent() 0 4 1
A setMainRegistration() 0 4 1
A getMainRegistration() 0 4 1
A setNotes() 0 4 1
A getNotes() 0 4 1
A setConfirmationUntil() 0 4 1
A getConfirmationUntil() 0 4 1
A getRegistrationDate() 0 4 1
A setRegistrationDate() 0 4 1
A setHidden() 0 4 1
A getHidden() 0 4 1
A getAmountOfRegistrations() 0 4 1
A setAmountOfRegistrations() 0 4 1
A getLanguage() 0 4 1
A setLanguage() 0 4 1
A getRecaptcha() 0 4 1
A setRecaptcha() 0 4 1
A getFeUser() 0 4 1
A setFeUser() 0 4 1
A getPaymentmethod() 0 4 1
A setPaymentmethod() 0 4 1
A getPaymentReference() 0 4 1
A setPaymentReference() 0 4 1
A getWaitlist() 0 4 1
A setWaitlist() 0 4 1
A getFieldValues() 0 4 1
A setFieldValues() 0 4 1
A getFullname() 0 4 1

How to fix   Complexity   

Complex Class

Complex classes like Registration often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

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

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

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 TYPO3\CMS\Extbase\Annotation as Extbase;
13
14
/**
15
 * Registration
16
 *
17
 * @author Torben Hansen <[email protected]>
18
 */
19
class Registration extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
20
{
21
    /**
22
     * Firstname
23
     *
24
     * @var string
25
     */
26
    protected $firstname = '';
27
28
    /**
29
     * Lastname
30
     *
31
     * @var string
32
     */
33
    protected $lastname = '';
34
35
    /**
36
     * Title
37
     *
38
     * @var string
39
     */
40
    protected $title = '';
41
42
    /**
43
     * Company
44
     *
45
     * @var string
46
     */
47
    protected $company = '';
48
49
    /**
50
     * Address
51
     *
52
     * @var string
53
     */
54
    protected $address = '';
55
56
    /**
57
     * Zip
58
     *
59
     * @var string
60
     */
61
    protected $zip = '';
62
63
    /**
64
     * City
65
     *
66
     * @var string
67
     */
68
    protected $city = '';
69
70
    /**
71
     * Country
72
     *
73
     * @var string
74
     */
75
    protected $country = '';
76
77
    /**
78
     * Phone
79
     *
80
     * @var string
81
     */
82
    protected $phone = '';
83
84
    /**
85
     * E-Mail
86
     *
87
     * @var string
88
     */
89
    protected $email = '';
90
91
    /**
92
     * Ignore notifications
93
     *
94
     * @var bool
95
     */
96
    protected $ignoreNotifications = false;
97
98
    /**
99
     * Gender
100
     *
101
     * @var string
102
     */
103
    protected $gender = '';
104
105
    /**
106
     * Date of birth
107
     *
108
     * @var \DateTime
109
     */
110
    protected $dateOfBirth;
111
112
    /**
113
     * Accept terms and conditions
114
     *
115
     * @var bool
116
     */
117
    protected $accepttc = false;
118
119
    /**
120
     * Confirmed
121
     *
122
     * @var bool
123
     */
124
    protected $confirmed = false;
125
126
    /**
127
     * Paid
128
     *
129
     * @var bool
130
     */
131
    protected $paid = false;
132
133
    /**
134
     * Notes
135
     *
136
     * @var string
137
     */
138
    protected $notes = '';
139
140
    /**
141
     * Event
142
     *
143
     * @var \DERHANSEN\SfEventMgt\Domain\Model\Event
144
     */
145
    protected $event;
146
147
    /**
148
     * Main registration (if available)
149
     *
150
     * @var \DERHANSEN\SfEventMgt\Domain\Model\Registration
151
     */
152
    protected $mainRegistration;
153
154
    /**
155
     * DateTime until the registration must be confirmed
156
     *
157
     * @var \DateTime
158
     */
159
    protected $confirmationUntil;
160
161
    /**
162
     * The registration date
163
     *
164
     * @var \DateTime
165
     */
166
    protected $registrationDate;
167
168
    /**
169
     * Indicates if record is hidden
170
     *
171
     * @var bool
172
     */
173
    protected $hidden = false;
174
175
    /**
176
     * Amount of registrations (if multiple registrations created by one user)
177
     *
178
     * @var int
179
     */
180
    protected $amountOfRegistrations = 1;
181
182
    /**
183
     * The language (e.g. de)
184
     *
185
     * @var string
186
     */
187
    protected $language = '';
188
189
    /**
190
     * reCaptcha
191
     *
192
     * @var string
193
     */
194
    protected $recaptcha = '';
195
196
    /**
197
     * FrontendUser if available
198
     *
199
     * @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
200
     */
201
    protected $feUser;
202
203
    /**
204
     * Payment method
205
     *
206
     * @var string
207
     */
208
    protected $paymentmethod = '';
209
210
    /**
211
     * Payment reference (e.g. from Payment provider)
212
     *
213
     * @var string
214
     */
215
    protected $paymentReference = '';
216
217
    /**
218
     * Flags if this is a registration on the waitlist
219
     *
220
     * @var bool
221
     */
222
    protected $waitlist = false;
223
224
    /**
225
     * Registration fields
226
     *
227
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Registration\FieldValue>
228 2
     * @Extbase\ORM\Cascade("remove")
229
     * @Extbase\ORM\Lazy
230 2
     */
231
    protected $fieldValues;
232
233
    /**
234
     * Registration constructor.
235
     */
236
    public function __construct()
237
    {
238
        $this->fieldValues = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
239
    }
240 22
241
    /**
242 22
     * Returns the firstname
243 22
     *
244
     * @return string $firstname
245
     */
246
    public function getFirstname()
247
    {
248
        return $this->firstname;
249
    }
250 2
251
    /**
252 2
     * Sets the firstname
253
     *
254
     * @param string $firstname Firstname
255
     */
256
    public function setFirstname($firstname)
257
    {
258
        $this->firstname = $firstname;
259
    }
260
261
    /**
262 22
     * Returns the lastname
263
     *
264 22
     * @return string $lastname
265 22
     */
266
    public function getLastname()
267
    {
268
        return $this->lastname;
269
    }
270
271
    /**
272 2
     * Sets the lastname
273
     *
274 2
     * @param string $lastname Lastname
275
     */
276
    public function setLastname($lastname)
277
    {
278
        $this->lastname = $lastname;
279
    }
280
281
    /**
282
     * Returns the title
283
     *
284 2
     * @return string $title
285
     */
286 2
    public function getTitle()
287 2
    {
288
        return $this->title;
289
    }
290
291
    /**
292
     * Sets the title
293
     *
294 2
     * @param string $title Title
295
     */
296 2
    public function setTitle($title)
297
    {
298
        $this->title = $title;
299
    }
300
301
    /**
302
     * Returns the company
303
     *
304
     * @return string $company
305
     */
306 2
    public function getCompany()
307
    {
308 2
        return $this->company;
309 2
    }
310
311
    /**
312
     * Sets the company
313
     *
314
     * @param string $company Company
315
     */
316 2
    public function setCompany($company)
317
    {
318 2
        $this->company = $company;
319
    }
320
321
    /**
322
     * Returns the address
323
     *
324
     * @return string $address
325
     */
326
    public function getAddress()
327
    {
328 2
        return $this->address;
329
    }
330 2
331 2
    /**
332
     * Sets the address
333
     *
334
     * @param string $address Address
335
     */
336
    public function setAddress($address)
337
    {
338 2
        $this->address = $address;
339
    }
340 2
341
    /**
342
     * Returns the zip
343
     *
344
     * @return string $zip
345
     */
346
    public function getZip()
347
    {
348
        return $this->zip;
349
    }
350 2
351
    /**
352 2
     * Sets the zip
353 2
     *
354
     * @param string $zip Zip
355
     */
356
    public function setZip($zip)
357
    {
358
        $this->zip = $zip;
359
    }
360 2
361
    /**
362 2
     * Returns the city
363
     *
364
     * @return string $city
365
     */
366
    public function getCity()
367
    {
368
        return $this->city;
369
    }
370
371
    /**
372 2
     * Sets the city
373
     *
374 2
     * @param string $city City
375 2
     */
376
    public function setCity($city)
377
    {
378
        $this->city = $city;
379
    }
380
381
    /**
382 2
     * Returns the country
383
     *
384 2
     * @return string $country
385
     */
386
    public function getCountry()
387
    {
388
        return $this->country;
389
    }
390
391
    /**
392
     * Sets the country
393
     *
394 2
     * @param string $country Country
395
     */
396 2
    public function setCountry($country)
397 2
    {
398
        $this->country = $country;
399
    }
400
401
    /**
402
     * Returns the phone
403
     *
404 2
     * @return string $phone
405
     */
406 2
    public function getPhone()
407
    {
408
        return $this->phone;
409
    }
410
411
    /**
412
     * Sets the phone
413
     *
414
     * @param string $phone Phone
415
     */
416 2
    public function setPhone($phone)
417
    {
418 2
        $this->phone = $phone;
419 2
    }
420
421
    /**
422
     * Returns the email
423
     *
424
     * @return string $email
425
     */
426 22
    public function getEmail()
427
    {
428 22
        return $this->email;
429
    }
430
431
    /**
432
     * Sets the email
433
     *
434
     * @param string $email E-Mail
435
     */
436
    public function setEmail($email)
437
    {
438 52
        $this->email = trim($email);
439
    }
440 52
441 52
    /**
442
     * Returns boolean state of ignoreNotifications
443
     *
444
     * @return bool
445
     */
446
    public function isIgnoreNotifications()
447
    {
448 34
        return $this->ignoreNotifications;
449
    }
450 34
451
    /**
452
     * Returns ignoreNotifications
453
     *
454
     * @return bool
455
     */
456
    public function getIgnoreNotifications()
457
    {
458 4
        return $this->ignoreNotifications;
459
    }
460 4
461
    /**
462
     * Sets ignoreNotifications
463
     *
464
     * @param bool $ignoreNotifications IgnoreNotifications
465
     */
466
    public function setIgnoreNotifications($ignoreNotifications)
467
    {
468
        $this->ignoreNotifications = $ignoreNotifications;
469
    }
470 18
471
    /**
472 18
     * Returns the gender
473 18
     *
474
     * @return string $gender
475
     */
476
    public function getGender()
477
    {
478
        return $this->gender;
479
    }
480 2
481
    /**
482 2
     * Sets the gender
483
     *
484
     * @param string $gender Gender
485
     */
486
    public function setGender($gender)
487
    {
488
        $this->gender = $gender;
489
    }
490
491
    /**
492 2
     * Sets the date of birth
493
     *
494 2
     * @param \DateTime $dateOfBirth DateOfBirth
495 2
     */
496
    public function setDateOfBirth($dateOfBirth)
497
    {
498
        $this->dateOfBirth = $dateOfBirth;
499
    }
500
501
    /**
502
     * Returns the date of birth
503
     *
504 2
     * @return \DateTime
505
     */
506 2
    public function getDateOfBirth()
507 2
    {
508
        return $this->dateOfBirth;
509
    }
510
511
    /**
512
     * Returns accept terms and conditions
513
     *
514 2
     * @return bool $accepttc
515
     */
516 2
    public function getAccepttc()
517
    {
518
        return $this->accepttc;
519
    }
520
521
    /**
522
     * Sets accept terms and conditions
523
     *
524 4
     * @param bool $accepttc Accept terms and conditions
525
     */
526 4
    public function setAccepttc($accepttc)
527
    {
528
        $this->accepttc = $accepttc;
529
    }
530
531
    /**
532
     * Returns the confirmed
533
     *
534
     * @return bool $confirmed Confirmed
535
     */
536 2
    public function getConfirmed()
537
    {
538 2
        return $this->confirmed;
539 2
    }
540
541
    /**
542
     * Sets the confirmed
543
     *
544
     * @param bool $confirmed Confirmed
545
     */
546 2
    public function setConfirmed($confirmed)
547
    {
548 2
        $this->confirmed = $confirmed;
549
    }
550
551
    /**
552
     * Returns the boolean state of confirmed
553
     *
554
     * @return bool
555
     */
556
    public function isConfirmed()
557
    {
558 10
        return $this->confirmed;
559
    }
560 10
561 10
    /**
562
     * Returns the paid
563
     *
564
     * @return bool $paid
565
     */
566
    public function getPaid()
567
    {
568 8
        return $this->paid;
569
    }
570 8
571
    /**
572
     * Sets the paid
573
     *
574
     * @param bool $paid Paid
575
     */
576
    public function setPaid($paid)
577
    {
578 2
        $this->paid = $paid;
579
    }
580 2
581
    /**
582
     * Returns the boolean state of paid
583
     *
584
     * @return bool
585
     */
586
    public function isPaid()
587
    {
588
        return $this->paid;
589
    }
590 4
591
    /**
592 4
     * Sets the event
593 4
     *
594
     * @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event Event
595
     */
596
    public function setEvent($event)
597
    {
598
        $this->event = $event;
599
    }
600 2
601
    /**
602 2
     * Returns the event
603
     *
604
     * @return \DERHANSEN\SfEventMgt\Domain\Model\Event
605
     */
606
    public function getEvent()
607
    {
608
        return $this->event;
609
    }
610
611
    /**
612 4
     * Sets the mainRegistration
613
     *
614 4
     * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration
615 4
     */
616
    public function setMainRegistration($registration)
617
    {
618
        $this->mainRegistration = $registration;
619
    }
620
621
    /**
622 14
     * Returns the event
623
     *
624 14
     * @return \DERHANSEN\SfEventMgt\Domain\Model\Registration
625
     */
626
    public function getMainRegistration()
627
    {
628
        return $this->mainRegistration;
629
    }
630
631
    /**
632
     * Setter for notes
633
     *
634 2
     * @param string $notes Notes
635
     */
636 2
    public function setNotes($notes)
637 2
    {
638
        $this->notes = $notes;
639
    }
640
641
    /**
642
     * Getter for notes
643
     *
644 4
     * @return string
645
     */
646 4
    public function getNotes()
647
    {
648
        return $this->notes;
649
    }
650
651
    /**
652
     * Sets confirmUntil
653
     *
654
     * @param \DateTime $confirmationUntil Confirmation Until
655
     */
656 2
    public function setConfirmationUntil($confirmationUntil)
657
    {
658 2
        $this->confirmationUntil = $confirmationUntil;
659 2
    }
660
661
    /**
662
     * Returns confirmationUntil
663
     *
664
     * @return \DateTime
665
     */
666 2
    public function getConfirmationUntil()
667
    {
668 2
        return $this->confirmationUntil;
669
    }
670
671
    /**
672
     * Returns registrationDate
673
     *
674
     * @return \DateTime
675
     */
676
    public function getRegistrationDate()
677
    {
678 2
        return $this->registrationDate;
679
    }
680 2
681 2
    /**
682
     * Sets registrationDate
683
     *
684
     * @param \DateTime $registrationDate
685
     */
686
    public function setRegistrationDate($registrationDate)
687
    {
688 2
        $this->registrationDate = $registrationDate;
689
    }
690 2
691
    /**
692
     * Sets hidden
693
     *
694
     * @param bool $hidden Hidden
695
     */
696
    public function setHidden($hidden)
697
    {
698
        $this->hidden = $hidden;
699
    }
700 2
701
    /**
702 2
     * Returns hidden
703 2
     *
704
     * @return bool
705
     */
706
    public function getHidden()
707
    {
708
        return $this->hidden;
709
    }
710 4
711
    /**
712 4
     * Returns amountOfRegistrations
713
     *
714
     * @return int
715
     */
716
    public function getAmountOfRegistrations()
717
    {
718
        return $this->amountOfRegistrations;
719
    }
720 4
721
    /**
722 4
     * Sets amountOfRegistrations
723
     *
724
     * @param int $amountOfRegistrations AmountOfRegistrations
725
     */
726
    public function setAmountOfRegistrations($amountOfRegistrations)
727
    {
728
        $this->amountOfRegistrations = $amountOfRegistrations;
729
    }
730
731
    /**
732 2
     * Returns the language
733
     *
734 2
     * @return string
735 2
     */
736
    public function getLanguage()
737
    {
738
        return $this->language;
739
    }
740
741
    /**
742 64
     * Sets the language
743
     *
744 64
     * @param string $language
745
     */
746
    public function setLanguage($language)
747
    {
748
        $this->language = $language;
749
    }
750
751
    /**
752
     * Returns recaptcha
753 2
     *
754
     * @return string
755 2
     */
756 2
    public function getRecaptcha()
757
    {
758
        return $this->recaptcha;
759
    }
760
761
    /**
762
     * Sets recaptcha
763 4
     *
764
     * @param string $recaptcha
765 4
     */
766
    public function setRecaptcha($recaptcha)
767
    {
768
        $this->recaptcha = $recaptcha;
769
    }
770
771
    /**
772
     * Returns the frontenduser
773
     *
774 2
     * @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
775
     */
776 2
    public function getFeUser()
777 2
    {
778
        return $this->feUser;
779
    }
780
781
    /**
782
     * Sets the frontenduser
783
     *
784 4
     * @param \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $feUser
785
     */
786 4
    public function setFeUser($feUser)
787
    {
788
        $this->feUser = $feUser;
789
    }
790
791
    /**
792
     * Returns the payment method
793
     *
794
     * @return string
795 2
     */
796
    public function getPaymentmethod()
797 2
    {
798 2
        return $this->paymentmethod;
799
    }
800
801
    /**
802
     * Sets the payment method
803
     *
804
     * @param string $paymentmethod
805 4
     */
806
    public function setPaymentmethod($paymentmethod)
807 4
    {
808
        $this->paymentmethod = $paymentmethod;
809
    }
810
811
    /**
812
     * Returns paymentReference
813
     *
814
     * @return string
815
     */
816 2
    public function getPaymentReference()
817
    {
818 2
        return $this->paymentReference;
819 2
    }
820
821
    /**
822
     * Sets paymentReference
823
     *
824
     * @param string $paymentReference
825
     */
826 4
    public function setPaymentReference($paymentReference)
827
    {
828 4
        $this->paymentReference = $paymentReference;
829
    }
830
831
    /**
832
     * Returns waitlist
833
     *
834
     * @return bool
835
     */
836
    public function getWaitlist()
837 2
    {
838
        return $this->waitlist;
839 2
    }
840 2
841
    /**
842
     * Sets waitlist
843
     *
844
     * @param bool $waitlist
845
     */
846
    public function setWaitlist($waitlist)
847
    {
848
        $this->waitlist = $waitlist;
849
    }
850
851
    /**
852
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
853
     */
854
    public function getFieldValues()
855
    {
856
        return $this->fieldValues;
857
    }
858 2
859
    /**
860 2
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $fieldValues
861 2
     */
862
    public function setFieldValues($fieldValues)
863
    {
864
        $this->fieldValues = $fieldValues;
865
    }
866
867
    /**
868
     * @return string
869
     */
870
    public function getFullname()
871
    {
872
        return $this->getFirstname() . ' ' . $this->lastname;
873
    }
874
}
875