Passed
Push — master ( 4f0c15...22d199 )
by Laurens
01:48
created

Customer::getUpdatedAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LauLamanApps\eCurring\Resource;
6
7
use DateTimeImmutable;
8
use LauLamanApps\eCurring\Http\Resource\Creatable;
9
use LauLamanApps\eCurring\Http\Resource\Updatable;
10
use LauLamanApps\eCurring\Resource\Customer\Gender;
11
use LauLamanApps\eCurring\Resource\Customer\VerificationMethod;
12
use LauLamanApps\eCurring\Resource\Transaction\PaymentMethod;
13
14
final class Customer implements CustomerInterface, Creatable, Updatable
15
{
16
    /**
17
     * @var int
18
     */
19
    private $id;
20
21
    /**
22
     * @var Gender|null
23
     *
24
     * The gender of the customer.
25
     * Used to determine the salutation in communication with the customer. Possible values: m / f
26
     */
27
    private $gender;
28
29
    /**
30
     * @var string
31
     *
32
     * The first name of the customer
33
     */
34
    private $firstName;
35
36
    /**
37
     * @var string|null
38
     *
39
     * The middle name of the customer
40
     */
41
    private $middleName;
42
43
    /**
44
     * @var string
45
     *
46
     * The last name of the customer
47
     */
48
    private $lastName;
49
50
    /**
51
     * @var string|null
52
     *
53
     * The name of the company of the customer
54
     */
55
    private $companyName;
56
57
    /**
58
     * @var string|null
59
     *
60
     * The vat number of the company of the customer
61
     */
62
    private $vatNumber;
63
64
    /**
65
     * @var PaymentMethod
66
     *
67
     * The payment type used to collect the funds from the customer.
68
     */
69
    private $paymentType;
70
71
    /**
72
     * @var VerificationMethod|null
73
     *
74
     * The method used used by the customer to validate their bankaccount or creditcard.
75
     * Empty when IBAN is manually entered.
76
     */
77
    private $bankVerificationMethod;
78
79
    /**
80
     * @var string
81
     *
82
     * The name of the holder of the bank account or creditcard.
83
     * Replaces the deprecated bankHolder.
84
     */
85
    private $cardHolder;
86
87
    /**
88
     * @var string
89
     *
90
     * The last 4 digits of the bank account or creditcard of the client.
91
     */
92
    private $cardNumber;
93
94
    /**
95
     * @var string|null
96
     *
97
     * The postalcode of the address of the customer
98
     */
99
    private $postalcode;
100
101
    /**
102
     * @var string|null
103
     *
104
     * The house number of the address of the customer
105
     */
106
    private $houseNumber;
107
108
    /**
109
     * @var string|null
110
     *
111
     * The house number addition of the address of the customer
112
     */
113
    private $houseNumberAdd;
114
115
    /**
116
     * @var string|null
117
     *
118
     * The street of the address of the customer
119
     */
120
    private $street;
121
122
    /**
123
     * @var string|null
124
     *
125
     * The city of the address of the customer
126
     */
127
    private $city;
128
129
    /**
130
     * @var string|null
131
     *
132
     * The 2 letter ISO code of the country of residence of the customer
133
     */
134
    private $countryCode;
135
136
    /**
137
     * @var string|null
138
     *
139
     * The preferred communication language of the customer.
140
     * Any notifications sent to the customer will be in this language.
141
     * Possible values: nl / en.
142
     */
143
    private $language;
144
145
    /**
146
     * @var string
147
     *
148
     * The email address of the customer
149
     */
150
    private $email;
151
152
    /**
153
     * @var string|null
154
     *
155
     * The telephone number of the customer
156
     */
157
    private $telephone;
158
159
    /**
160
     * @var SubscriptionInterface[]
161
     *
162
     * The subscriptions of the customers
163
     */
164
    private $subscriptions;
165
166
    /**
167
     * @var DateTimeImmutable
168
     *
169
     * The date on which the customer was created
170
     */
171
    private $createdAt;
172
173
    /**
174
     * @var DateTimeImmutable
175
     *
176
     * The date on which the customer was last updated
177
     */
178
    private $updatedAt;
179
180 1
    private function __construct()
181
    {
182 1
    }
183
184
    public static function new(
185
        string $firstName,
186
        string $lastName,
187
        PaymentMethod $paymentType,
188
        string $cardHolder,
189
        string $cardNumber,
190
        string $email,
191
        ?Gender $gender = null,
192
        ?string $middleName = null,
193
        ?string $companyName = null,
194
        ?string $vatNumber = null,
195
        ?string $postalcode = null,
196
        ?string $houseNumber = null,
197
        ?string $houseNumberAdd = null,
198
        ?string $street = null,
199
        ?string $city = null,
200
        ?string $countryCode = null,
201
        ?string $language = null,
202
        ?string $telephone = null
203
    ): self {
204
        $self = new self();
205
        $self->gender = $gender;
206
        $self->firstName = $firstName;
207
        $self->lastName = $lastName;
208
        $self->paymentType = $paymentType;
209
        $self->cardHolder = $cardHolder;
210
        $self->cardNumber = $cardNumber;
211
        $self->email = $email;
212
        $self->middleName = $middleName;
213
        $self->companyName = $companyName;
214
        $self->vatNumber = $vatNumber;
215
        $self->postalcode = $postalcode;
216
        $self->houseNumber = $houseNumber;
217
        $self->houseNumberAdd = $houseNumberAdd;
218
        $self->street = $street;
219
        $self->city = $city;
220
        $self->countryCode = $countryCode;
221
        $self->language = $language;
222
        $self->telephone = $telephone;
223
224
        return $self;
225
    }
226
227 1
    public static function fromData(
228
        int $id,
229
        string $firstName,
230
        string $lastName,
231
        PaymentMethod $paymentType,
232
        string $cardHolder,
233
        string $cardNumber,
234
        string $email,
235
        DateTimeImmutable $createdAt,
236
        DateTimeImmutable $updatedAt,
237
        ?Gender $gender = null,
238
        ?string $middleName = null,
239
        ?string $companyName = null,
240
        ?string $vatNumber = null,
241
        ?string $postalcode = null,
242
        ?string $houseNumber = null,
243
        ?string $houseNumberAdd = null,
244
        ?string $street = null,
245
        ?string $city = null,
246
        ?string $countryCode = null,
247
        ?string $language = null,
248
        ?string $telephone = null,
249
        ?VerificationMethod $bankVerificationMethod = null,
250
        ?SubscriptionInterface ...$subscriptions
251
    ): self {
252 1
        $self = new self();
253 1
        $self->id = $id;
254 1
        $self->firstName = $firstName;
255 1
        $self->lastName = $lastName;
256 1
        $self->paymentType = $paymentType;
257 1
        $self->cardHolder = $cardHolder;
258 1
        $self->cardNumber = $cardNumber;
259 1
        $self->email = $email;
260 1
        $self->createdAt = $createdAt;
261 1
        $self->updatedAt = $updatedAt;
262 1
        $self->gender = $gender;
263 1
        $self->companyName = $companyName;
264 1
        $self->vatNumber = $vatNumber;
265 1
        $self->postalcode = $postalcode;
266 1
        $self->houseNumber = $houseNumber;
267 1
        $self->houseNumberAdd = $houseNumberAdd;
268 1
        $self->street = $street;
269 1
        $self->city = $city;
270 1
        $self->countryCode = $countryCode;
271 1
        $self->language = $language;
272 1
        $self->telephone = $telephone;
273 1
        $self->middleName = $middleName;
274 1
        $self->bankVerificationMethod = $bankVerificationMethod;
275 1
        $self->subscriptions = $subscriptions;
276
277 1
        return $self;
278
    }
279
280
    public function setGender(?Gender $gender): void
281
    {
282
        $this->gender = $gender;
283
    }
284
285
    public function setFirstName(string $firstName): void
286
    {
287
        $this->firstName = $firstName;
288
    }
289
290
    public function setMiddleName(?string $middleName): void
291
    {
292
        $this->middleName = $middleName;
293
    }
294
295
    public function setLastName(string $lastName): void
296
    {
297
        $this->lastName = $lastName;
298
    }
299
300
    public function setCompanyName(?string $companyName): void
301
    {
302
        $this->companyName = $companyName;
303
    }
304
305
    public function setVatNumber(?string $vatNumber): void
306
    {
307
        $this->vatNumber = $vatNumber;
308
    }
309
310
    public function setPaymentType(PaymentMethod $paymentType): void
311
    {
312
        $this->paymentType = $paymentType;
313
    }
314
315
    public function setBankVerificationMethod(?VerificationMethod $bankVerificationMethod): void
316
    {
317
        $this->bankVerificationMethod = $bankVerificationMethod;
318
    }
319
320
    public function setCardHolder(string $cardHolder): void
321
    {
322
        $this->cardHolder = $cardHolder;
323
    }
324
325
    public function setCardNumber(string $cardNumber): void
326
    {
327
        $this->cardNumber = $cardNumber;
328
    }
329
330
    public function setPostalcode(?string $postalcode): void
331
    {
332
        $this->postalcode = $postalcode;
333
    }
334
335
    public function setHouseNumber(?string $houseNumber): void
336
    {
337
        $this->houseNumber = $houseNumber;
338
    }
339
340
    public function setHouseNumberAdd(?string $houseNumberAdd): void
341
    {
342
        $this->houseNumberAdd = $houseNumberAdd;
343
    }
344
345
    public function setStreet(?string $street): void
346
    {
347
        $this->street = $street;
348
    }
349
350
    public function setCity(?string $city): void
351
    {
352
        $this->city = $city;
353
    }
354
355
    public function setCountryCode(?string $countryCode): void
356
    {
357
        $this->countryCode = $countryCode;
358
    }
359
360
    public function setLanguage(?string $language): void
361
    {
362
        $this->language = $language;
363
    }
364
365
    public function setTelephone(?string $telephone): void
366
    {
367
        $this->telephone = $telephone;
368
    }
369
370 1
    public function getId(): int
371
    {
372 1
        return $this->id;
373
    }
374
375 1
    public function getGender(): ?Gender
376
    {
377 1
        return $this->gender;
378
    }
379
380 1
    public function getFirstName(): string
381
    {
382 1
        return $this->firstName;
383
    }
384
385 1
    public function getMiddleName(): ?string
386
    {
387 1
        return $this->middleName;
388
    }
389
390 1
    public function getLastName(): string
391
    {
392 1
        return $this->lastName;
393
    }
394
395 1
    public function getCompanyName(): ?string
396
    {
397 1
        return $this->companyName;
398
    }
399
400 1
    public function getVatNumber(): ?string
401
    {
402 1
        return $this->vatNumber;
403
    }
404
405 1
    public function getPaymentType(): PaymentMethod
406
    {
407 1
        return $this->paymentType;
408
    }
409
410 1
    public function getBankVerificationMethod(): ?VerificationMethod
411
    {
412 1
        return $this->bankVerificationMethod;
413
    }
414
415 1
    public function getCardHolder(): string
416
    {
417 1
        return $this->cardHolder;
418
    }
419
420 1
    public function getCardNumber(): string
421
    {
422 1
        return $this->cardNumber;
423
    }
424
425 1
    public function getPostalcode(): ?string
426
    {
427 1
        return $this->postalcode;
428
    }
429
430 1
    public function getHouseNumber(): ?string
431
    {
432 1
        return $this->houseNumber;
433
    }
434
435 1
    public function getHouseNumberAdd(): ?string
436
    {
437 1
        return $this->houseNumberAdd;
438
    }
439
440 1
    public function getStreet(): ?string
441
    {
442 1
        return $this->street;
443
    }
444
445 1
    public function getCity(): ?string
446
    {
447 1
        return $this->city;
448
    }
449
450 1
    public function getCountryCode(): ?string
451
    {
452 1
        return $this->countryCode;
453
    }
454
455 1
    public function getLanguage(): ?string
456
    {
457 1
        return $this->language;
458
    }
459
460 1
    public function getEmail(): string
461
    {
462 1
        return $this->email;
463
    }
464
465 1
    public function getTelephone(): ?string
466
    {
467 1
        return $this->telephone;
468
    }
469
470
    /**
471
     * @return SubscriptionInterface[]
472
     */
473 1
    public function getSubscriptions(): array
474
    {
475 1
        return $this->subscriptions;
476
    }
477
478
    public function getCreatedAt(): DateTimeImmutable
479
    {
480
        return $this->createdAt;
481
    }
482
483
    public function getUpdatedAt(): DateTimeImmutable
484
    {
485
        return $this->updatedAt;
486
    }
487
}
488