Completed
Pull Request — master (#34)
by
unknown
05:32
created

Request::getPostcode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace WMDE\Fundraising\Entities;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
/**
8
 * @since 0.1
9
 *
10
 * @ORM\Table(name="request", indexes={@ORM\Index(name="idx_donation_id", columns={"donation_id"})})
11
 * @ORM\Entity
12
 */
13
class Request {
14
	/**
15
	 * @var integer
16
	 *
17
	 * @ORM\Column(name="donation_id", type="integer", nullable=true)
18
	 */
19
	private $donationId;
20
21
	/**
22
	 * @var \DateTime
23
	 *
24
	 * @ORM\Column(name="timestamp", type="datetime", options={"default":"1970-01-01 00:00:00"}, nullable=false)
25
	 */
26
	private $timestamp = '1970-01-01 00:00:00';
27
28
	/**
29
	 * @var string
30
	 *
31
	 * @ORM\Column(name="anrede", type="string", length=16, nullable=true)
32
	 */
33
	private $salutation;
34
35
	/**
36
	 * @var string
37
	 *
38
	 * @ORM\Column(name="firma", type="string", length=100, nullable=true)
39
	 */
40
	private $company;
41
42
	/**
43
	 * @var string
44
	 *
45
	 * @ORM\Column(name="titel", type="string", length=16, nullable=true)
46
	 */
47
	private $title;
48
49
	/**
50
	 * @var string
51
	 *
52
	 * @ORM\Column(name="name", type="string", length=250, options={"default":""}, nullable=false)
53
	 */
54
	private $name = '';
55
56
	/**
57
	 * @var string
58
	 *
59
	 * @ORM\Column(name="vorname", type="string", length=50, options={"default":""}, nullable=false)
60
	 */
61
	private $firstName = '';
62
63
	/**
64
	 * @var string
65
	 *
66
	 * @ORM\Column(name="nachname", type="string", length=50, options={"default":""}, nullable=false)
67
	 */
68
	private $lastName = '';
69
70
	/**
71
	 * @var string
72
	 *
73
	 * @ORM\Column(name="strasse", type="string", length=100, nullable=true)
74
	 */
75
	private $address;
76
77
	/**
78
	 * @var string
79
	 *
80
	 * @ORM\Column(name="plz", type="string", length=8, nullable=true)
81
	 */
82
	private $postcode;
83
84
	/**
85
	 * @var string
86
	 *
87
	 * @ORM\Column(name="ort", type="string", length=100, nullable=true)
88
	 */
89
	private $city;
90
91
	/**
92
	 * @var string
93
	 *
94
	 * @ORM\Column(name="email", type="string", length=250, options={"default":""}, nullable=false)
95
	 */
96
	private $email = '';
97
98
	/**
99
	 * @var string
100
	 *
101
	 * @ORM\Column(name="phone", type="string", length=30, options={"default":""}, nullable=false)
102
	 */
103
	private $phone = '';
104
105
	/**
106
	 * @var \DateTime
107
	 *
108
	 * @ORM\Column(name="dob", type="date", options={"default":"0000-00-00"}, nullable=false)
109
	 */
110
	private $dob = '0000-00-00';
111
112
	/**
113
	 * @var string
114
	 *
115
	 * @ORM\Column(name="wikimedium_shipping", type="string", options={"default":""}, nullable=false)
116
	 */
117
	private $wikimediumShipping = 'none';
118
119
	/**
120
	 * @var string
121
	 *
122
	 * @ORM\Column(name="membership_type", type="string", options={"default":"sustaining"}, nullable=false)
123
	 */
124
	private $membershipType = 'sustaining';
125
126
	/**
127
	 * @var integer
128
	 *
129
	 * @ORM\Column(name="membership_fee", type="integer", options={"default":0}, nullable=false)
130
	 */
131
	private $membershipFee = 0;
132
133
	/**
134
	 * @var integer
135
	 *
136
	 * @ORM\Column(name="membership_fee_interval", type="smallint", options={"default":12}, nullable=true)
137
	 */
138
139
	private $membershipFeeInterval = 12;
140
141
	/**
142
	 * @var string
143
	 *
144
	 * @ORM\Column(name="account_number", type="string", length=16, options={"default":""}, nullable=false)
145
	 */
146
	private $accountNumber = '';
147
148
	/**
149
	 * @var string
150
	 *
151
	 * @ORM\Column(name="bank_name", type="string", length=50, options={"default":""}, nullable=false)
152
	 */
153
	private $bankName = '';
154
155
	/**
156
	 * @var string
157
	 *
158
	 * @ORM\Column(name="bank_code", type="string", length=16, options={"default":""}, nullable=false)
159
	 */
160
	private $bankCode = '';
161
162
	/**
163
	 * @var string
164
	 *
165
	 * @ORM\Column(name="iban", type="string", length=32, options={"default":""}, nullable=true)
166
	 */
167
	private $iban = '';
168
169
	/**
170
	 * @var string
171
	 *
172
	 * @ORM\Column(name="bic", type="string", length=32, options={"default":""}, nullable=true)
173
	 */
174
	private $bic = '';
175
176
	/**
177
	 * @var string
178
	 *
179
	 * @ORM\Column(name="account_holder", type="string", length=50, options={"default":""}, nullable=false)
180
	 */
181
	private $accountHolder = '';
182
183
	/**
184
	 * @var string
185
	 *
186
	 * @ORM\Column(name="comment", type="text", options={"default":""}, nullable=false)
187
	 */
188
	private $comment = '';
189
190
	/**
191
	 * @var \DateTime
192
	 *
193
	 * @ORM\Column(name="export", type="datetime", nullable=true)
194
	 */
195
	private $export;
196
197
	/**
198
	 * @var \DateTime
199
	 *
200
	 * @ORM\Column(name="backup", type="datetime", nullable=true)
201
	 */
202
	private $backup;
203
204
	/**
205
	 * @var boolean
206
	 *
207
	 * @ORM\Column(name="wikilogin", type="boolean", options={"default":0}, nullable=false)
208
	 */
209
	private $wikilogin = 0;
210
211
	/**
212
	 * @var string
213
	 *
214
	 * @ORM\Column(name="tracking", type="string", length=50, nullable=true)
215
	 */
216
	private $tracking;
217
218
	/**
219
	 * @var integer
220
	 *
221
	 * @ORM\Column(name="status", type="smallint", options={"default":0}, nullable=true)
222
	 */
223
	private $status = 0;
224
225
	/**
226
	 * @var string
227
	 *
228
	 * @ORM\Column(name="country", type="string", length=8, options={"default":""}, nullable=true)
229
	 */
230
	private $country = '';
231
232
	/**
233
	 * @var string
234
	 *
235
	 * @ORM\Column(name="data", type="text", nullable=true)
236
	 */
237
	private $data;
238
239
	/**
240
	 * @var string
241
	 *
242
	 * @ORM\Column(name="guid", type="blob", length=16, nullable=true)
243
	 */
244
	private $guid;
245
246
	/**
247
	 * @var string
248
	 *
249
	 * @ORM\Column(name="type", type="string", options={"default":"membership"}, nullable=false)
250
	 */
251
	private $type = 'membership';
252
253
	/**
254
	 * @var integer
255
	 *
256
	 * @ORM\Column(name="id", type="integer")
257
	 * @ORM\Id
258
	 * @ORM\GeneratedValue(strategy="IDENTITY")
259
	 */
260
	private $id;
261
262
	const STATUS_CONFIRMED = 1;
263
	const STATUS_NEUTRAL = 0;
264
	const STATUS_DELETED = -1;
265
	const STATUS_MODERATION = -2;
266
	const STATUS_ABORTED = -4;
267
	const STATUS_CANCELED = -8;
268
269
	const TYPE_MEMBERSHIP = 'membership';
270
	const TYPE_SUBSCRIPTION = 'subscription';
271
	const TYPE_OTHER = 'other';
272
273
	/**
274
	 * Set donationId
275
	 *
276
	 * @param integer $donationId
277
	 * @return Request
278
	 */
279
	public function setDonationId( $donationId ) {
280
		$this->donationId = $donationId;
281
282
		return $this;
283
	}
284
285
	/**
286
	 * Get donationId
287
	 *
288
	 * @return integer
289
	 */
290
	public function getDonationId() {
291
		return $this->donationId;
292
	}
293
294
	/**
295
	 * Set timestamp
296
	 *
297
	 * @param \DateTime $timestamp
298
	 * @return Request
299
	 */
300
	public function setTimestamp( $timestamp ) {
301
		$this->timestamp = $timestamp;
302
303
		return $this;
304
	}
305
306
	/**
307
	 * Get timestamp
308
	 *
309
	 * @return \DateTime
310
	 */
311
	public function getTimestamp() {
312
		return $this->timestamp;
313
	}
314
315
	/**
316
	 * Set salutation
317
	 *
318
	 * @param string $salutation
319
	 * @return Request
320
	 */
321
	public function setSalutation( $salutation ) {
322
		$this->salutation = $salutation;
323
324
		return $this;
325
	}
326
327
	/**
328
	 * Get salutation
329
	 *
330
	 * @return string
331
	 */
332
	public function getSalutation() {
333
		return $this->salutation;
334
	}
335
336
	/**
337
	 * Set company name
338
	 *
339
	 * @param string $company
340
	 * @return Request
341
	 */
342
	public function setCompany( $company ) {
343
		$this->company = $company;
344
345
		return $this;
346
	}
347
348
	/**
349
	 * Get company name
350
	 *
351
	 * @return string
352
	 */
353
	public function getCompany() {
354
		return $this->company;
355
	}
356
357
	/**
358
	 * Set title
359
	 *
360
	 * @param string $title
361
	 * @return Request
362
	 */
363
	public function setTitle( $title ) {
364
		$this->title = $title;
365
366
		return $this;
367
	}
368
369
	/**
370
	 * Get title
371
	 *
372
	 * @return string
373
	 */
374
	public function getTitle() {
375
		return $this->title;
376
	}
377
378
	/**
379
	 * Set name
380
	 *
381
	 * @param string $name
382
	 * @return Request
383
	 */
384
	public function setName( $name ) {
385
		$this->name = $name;
386
387
		return $this;
388
	}
389
390
	/**
391
	 * Get name
392
	 *
393
	 * @return string
394
	 */
395
	public function getName() {
396
		return $this->name;
397
	}
398
399
	/**
400
	 * Set first name
401
	 *
402
	 * @param string $firstName
403
	 * @return Request
404
	 */
405
	public function setFirstName( $firstName ) {
406
		$this->firstName = $firstName;
407
		$this->setNameFromParts( $firstName, $this->getLastName() );
408
409
		return $this;
410
	}
411
412
	/**
413
	 * Get first name
414
	 *
415
	 * @return string
416
	 */
417
	public function getFirstName() {
418
		return $this->firstName;
419
	}
420
421
	/**
422
	 * Set last name
423
	 *
424
	 * @param string $lastName
425
	 * @return Request
426
	 */
427
	public function setLastName( $lastName ) {
428
		$this->lastName = $lastName;
429
		$this->setNameFromParts( $this->getFirstName(), $lastName );
430
431
		return $this;
432
	}
433
434
	/**
435
	 * Get last name
436
	 *
437
	 * @return string
438
	 */
439
	public function getLastName() {
440
		return $this->lastName;
441
	}
442
443
	/**
444
	 * Sets the full name
445
	 */
446
	public function setNameFromParts( $vorname, $nachname) {
447
		$parts = array_filter( [ $vorname, $nachname ] );
448
		$this->setName( implode( ' ', $parts ) );
449
450
		return $this;
451
	}
452
453
	/**
454
	 * Set address (street, etc)
455
	 *
456
	 * @param string $address
457
	 * @return Request
458
	 */
459
	public function setAddress( $address ) {
460
		$this->address = $address;
461
462
		return $this;
463
	}
464
465
	/**
466
	 * Get address (street, etc)
467
	 *
468
	 * @return string
469
	 */
470
	public function getAddress() {
471
		return $this->address;
472
	}
473
474
	/**
475
	 * Set postcode
476
	 *
477
	 * @param string $postcode
478
	 * @return Request
479
	 */
480
	public function setPostcode( $postcode ) {
481
		$this->postcode = $postcode;
482
483
		return $this;
484
	}
485
486
	/**
487
	 * Get postcode
488
	 *
489
	 * @return string
490
	 */
491
	public function getPostcode() {
492
		return $this->postcode;
493
	}
494
495
	/**
496
	 * Set city
497
	 *
498
	 * @param string $city
499
	 * @return Request
500
	 */
501
	public function setCity( $city ) {
502
		$this->city = $city;
503
504
		return $this;
505
	}
506
507
	/**
508
	 * Get city
509
	 *
510
	 * @return string
511
	 */
512
	public function getCity() {
513
		return $this->city;
514
	}
515
516
	/**
517
	 * Set email
518
	 *
519
	 * @param string $email
520
	 * @return Request
521
	 */
522
	public function setEmail( $email ) {
523
		$this->email = $email;
524
525
		return $this;
526
	}
527
528
	/**
529
	 * Get email
530
	 *
531
	 * @return string
532
	 */
533
	public function getEmail() {
534
		return $this->email;
535
	}
536
537
	/**
538
	 * Set phone
539
	 *
540
	 * @param string $phone
541
	 * @return Request
542
	 */
543
	public function setPhone( $phone ) {
544
		$this->phone = $phone;
545
546
		return $this;
547
	}
548
549
	/**
550
	 * Get phone
551
	 *
552
	 * @return string
553
	 */
554
	public function getPhone() {
555
		return $this->phone;
556
	}
557
558
	/**
559
	 * Set dob
560
	 *
561
	 * @param \DateTime $dob
562
	 * @return Request
563
	 */
564
	public function setDob( $dob ) {
565
		$this->dob = $dob;
566
567
		return $this;
568
	}
569
570
	/**
571
	 * Get dob
572
	 *
573
	 * @return \DateTime
574
	 */
575
	public function getDob() {
576
		return $this->dob;
577
	}
578
579
	/**
580
	 * Set wikimediumShipping
581
	 *
582
	 * @param string $wikimediumShipping
583
	 * @return Request
584
	 */
585
	public function setWikimediumShipping( $wikimediumShipping ) {
586
		$this->wikimediumShipping = $wikimediumShipping;
587
588
		return $this;
589
	}
590
591
	/**
592
	 * Get wikimediumShipping
593
	 *
594
	 * @return string
595
	 */
596
	public function getWikimediumShipping() {
597
		return $this->wikimediumShipping;
598
	}
599
600
	/**
601
	 * Set membershipType
602
	 *
603
	 * @param string $membershipType
604
	 * @return Request
605
	 */
606
	public function setMembershipType( $membershipType ) {
607
		$this->membershipType = $membershipType;
608
609
		return $this;
610
	}
611
612
	/**
613
	 * Get membershipType
614
	 *
615
	 * @return string
616
	 */
617
	public function getMembershipType() {
618
		return $this->membershipType;
619
	}
620
621
	/**
622
	 * Set membershipFee
623
	 *
624
	 * @param integer $membershipFee
625
	 * @return Request
626
	 */
627
	public function setMembershipFee( $membershipFee ) {
628
		$this->membershipFee = $membershipFee;
629
630
		return $this;
631
	}
632
633
	/**
634
	 * Get membershipFee
635
	 *
636
	 * @return integer
637
	 */
638
	public function getMembershipFee() {
639
		return $this->membershipFee;
640
	}
641
642
	/**
643
	 * Set membershipFeeInterval
644
	 *
645
	 * @param integer $membershipFeeInterval
646
	 *
647
	 * @return Request
648
	 */
649
	public function setMembershipFeeInterval($membershipFeeInterval) {
650
		$this->membershipFeeInterval = $membershipFeeInterval;
651
652
		return $this;
653
	}
654
655
	/**
656
	 * Get membershipFeeInterval
657
	 *
658
	 * @return integer
659
	 */
660
	public function getMembershipFeeInterval() {
661
		return $this->membershipFeeInterval;
662
	}
663
664
665
	/**
666
	 * Set accountNumber
667
	 *
668
	 * @param string $accountNumber
669
	 * @return Request
670
	 */
671
	public function setAccountNumber( $accountNumber ) {
672
		$this->accountNumber = $accountNumber;
673
674
		return $this;
675
	}
676
677
	/**
678
	 * Get accountNumber
679
	 *
680
	 * @return string
681
	 */
682
	public function getAccountNumber() {
683
		return $this->accountNumber;
684
	}
685
686
	/**
687
	 * Set bankName
688
	 *
689
	 * @param string $bankName
690
	 * @return Request
691
	 */
692
	public function setBankName( $bankName ) {
693
		$this->bankName = $bankName;
694
695
		return $this;
696
	}
697
698
	/**
699
	 * Get bankName
700
	 *
701
	 * @return string
702
	 */
703
	public function getBankName() {
704
		return $this->bankName;
705
	}
706
707
	/**
708
	 * Set bankCode
709
	 *
710
	 * @param string $bankCode
711
	 * @return Request
712
	 */
713
	public function setBankCode( $bankCode ) {
714
		$this->bankCode = $bankCode;
715
716
		return $this;
717
	}
718
719
	/**
720
	 * Get bankCode
721
	 *
722
	 * @return string
723
	 */
724
	public function getBankCode() {
725
		return $this->bankCode;
726
	}
727
728
	/**
729
	 * Set iban
730
	 *
731
	 * @param string $iban
732
	 * @return Request
733
	 */
734
	public function setIban( $iban ) {
735
		$this->iban = $iban;
736
737
		return $this;
738
	}
739
740
	/**
741
	 * Get iban
742
	 *
743
	 * @return string
744
	 */
745
	public function getIban() {
746
		return $this->iban;
747
	}
748
749
	/**
750
	 * Set bic
751
	 *
752
	 * @param string $bic
753
	 * @return Request
754
	 */
755
	public function setBic( $bic ) {
756
		$this->bic = $bic;
757
758
		return $this;
759
	}
760
761
	/**
762
	 * Get bic
763
	 *
764
	 * @return string
765
	 */
766
	public function getBic() {
767
		return $this->bic;
768
	}
769
770
	/**
771
	 * Set accountHolder
772
	 *
773
	 * @param string $accountHolder
774
	 * @return Request
775
	 */
776
	public function setAccountHolder( $accountHolder ) {
777
		$this->accountHolder = $accountHolder;
778
779
		return $this;
780
	}
781
782
	/**
783
	 * Get accountHolder
784
	 *
785
	 * @return string
786
	 */
787
	public function getAccountHolder() {
788
		return $this->accountHolder;
789
	}
790
791
	/**
792
	 * Set comment
793
	 *
794
	 * @param string $comment
795
	 * @return Request
796
	 */
797
	public function setComment( $comment ) {
798
		$this->comment = $comment;
799
800
		return $this;
801
	}
802
803
	/**
804
	 * Get comment
805
	 *
806
	 * @return string
807
	 */
808
	public function getComment() {
809
		return $this->comment;
810
	}
811
812
	/**
813
	 * Set export
814
	 *
815
	 * @param \DateTime $export
816
	 * @return Request
817
	 */
818
	public function setExport( $export ) {
819
		$this->export = $export;
820
821
		return $this;
822
	}
823
824
	/**
825
	 * Get export
826
	 *
827
	 * @return \DateTime
828
	 */
829
	public function getExport() {
830
		return $this->export;
831
	}
832
833
	/**
834
	 * Set backup
835
	 *
836
	 * @param \DateTime $backup
837
	 * @return Request
838
	 */
839
	public function setBackup( $backup ) {
840
		$this->backup = $backup;
841
842
		return $this;
843
	}
844
845
	/**
846
	 * Get backup
847
	 *
848
	 * @return \DateTime
849
	 */
850
	public function getBackup() {
851
		return $this->backup;
852
	}
853
854
	/**
855
	 * Set wikilogin
856
	 *
857
	 * @param boolean $wikilogin
858
	 * @return Request
859
	 */
860
	public function setWikilogin( $wikilogin ) {
861
		$this->wikilogin = $wikilogin;
862
863
		return $this;
864
	}
865
866
	/**
867
	 * Get wikilogin
868
	 *
869
	 * @return boolean
870
	 */
871
	public function getWikilogin() {
872
		return $this->wikilogin;
873
	}
874
875
	/**
876
	 * Set tracking
877
	 *
878
	 * @param string $tracking
879
	 * @return Request
880
	 */
881
	public function setTracking( $tracking ) {
882
		$this->tracking = $tracking;
883
884
		return $this;
885
	}
886
887
	/**
888
	 * Get tracking
889
	 *
890
	 * @return string
891
	 */
892
	public function getTracking() {
893
		return $this->tracking;
894
	}
895
896
	/**
897
	 * Set status
898
	 *
899
	 * @param integer $status
900
	 * @return Request
901
	 */
902
	public function setStatus( $status ) {
903
		$this->status = $status;
904
905
		return $this;
906
	}
907
908
	/**
909
	 * Get status
910
	 *
911
	 * @return integer
912
	 */
913
	public function getStatus() {
914
		return $this->status;
915
	}
916
917
	/**
918
	 * Set country
919
	 *
920
	 * @param string $country
921
	 * @return Request
922
	 */
923
	public function setCountry( $country ) {
924
		$this->country = $country;
925
926
		return $this;
927
	}
928
929
	/**
930
	 * Get country
931
	 *
932
	 * @return string
933
	 */
934
	public function getCountry() {
935
		return $this->country;
936
	}
937
938
	/**
939
	 * Set data
940
	 *
941
	 * @param string $data
942
	 * @return Request
943
	 */
944
	public function setData( $data ) {
945
		$this->data = $data;
946
947
		return $this;
948
	}
949
950
	/**
951
	 * Get data
952
	 *
953
	 * @return string
954
	 */
955
	public function getData() {
956
		return $this->data;
957
	}
958
959
	/**
960
	 * Set guid
961
	 *
962
	 * @param string $guid
963
	 * @return Request
964
	 */
965
	public function setGuid( $guid ) {
966
		$this->guid = $guid;
967
968
		return $this;
969
	}
970
971
	/**
972
	 * Get guid
973
	 *
974
	 * @return string
975
	 */
976
	public function getGuid() {
977
		return $this->guid;
978
	}
979
980
	/**
981
	 * Set type
982
	 *
983
	 * @param string $type
984
	 * @return Request
985
	 */
986
	public function setType( $type ) {
987
		$this->type = $type;
988
989
		return $this;
990
	}
991
992
	/**
993
	 * Get type
994
	 *
995
	 * @return string
996
	 */
997
	public function getType() {
998
		return $this->type;
999
	}
1000
1001
	/**
1002
	 * Get id
1003
	 *
1004
	 * @return integer
1005
	 */
1006
	public function getId() {
1007
		return $this->id;
1008
	}
1009
1010
	public function isUnconfirmed() {
1011
		return $this->getStatus() === self::STATUS_NEUTRAL;
1012
	}
1013
1014
	public function log( $message ) {
1015
		$dataArray = $this->getDataArray();
1016
		$dataArray[ "log" ][ date( "Y-m-d H:i:s" ) ] = $message;
1017
		return $this->saveDataArray( $dataArray );
1018
	}
1019
1020
	private function getDataArray() {
1021
		return unserialize( base64_decode( $this->data ) );
1022
	}
1023
1024
	private function saveDataArray( array $dataArray ) {
1025
		$this->data = base64_encode( serialize( $dataArray ) );
1026
		return $this;
1027
	}
1028
}
1029