|
11 | 11 |
|
12 | 12 | class Card |
13 | 13 | { |
14 | | - public string $maskedCardNumber; |
15 | | - public string $cardHolderName; |
16 | | - public string $type; |
17 | | - public string $issuerCountry; |
18 | | - public string $cardToken; |
19 | | - public bool $cardSavingApproved; |
20 | | - public string $expiryMonth; |
21 | | - public string $expiryYear; |
| 14 | + public ?string $maskedCardNumber; |
| 15 | + public ?string $cardHolderName; |
| 16 | + public ?string $type; |
| 17 | + public ?string $issuerCountry; |
| 18 | + public ?string $cardToken; |
| 19 | + public ?bool $cardSavingApproved; |
| 20 | + public ?string $expiryMonth; |
| 21 | + public ?string $expiryYear; |
22 | 22 |
|
23 | 23 | public static function fromArray(array $data): self |
24 | 24 | { |
25 | 25 | $obj = new self(); |
26 | | - $obj->maskedCardNumber = $data['maskedCardNumber']; |
27 | | - $obj->cardHolderName = $data['cardHolderName'] ?? ''; |
28 | | - $obj->type = $data['type']; |
29 | | - $obj->issuerCountry = $data['issuerCountry']; |
30 | | - $obj->cardToken = $data['cardToken']; |
31 | | - $obj->cardSavingApproved = $data['cardSavingApproved'] ?? false; |
32 | | - $obj->expiryMonth = $data['expiryMonth'] ?? ''; |
33 | | - $obj->expiryYear = $data['expiryYear'] ?? ''; |
| 26 | + $obj->maskedCardNumber = $data['maskedCardNumber'] ?? null; |
| 27 | + $obj->cardHolderName = $data['cardHolderName'] ?? null; |
| 28 | + $obj->type = $data['type'] ?? null; |
| 29 | + $obj->issuerCountry = $data['issuerCountry'] ?? null; |
| 30 | + $obj->cardToken = $data['cardToken'] ?? null; |
| 31 | + $obj->cardSavingApproved = $data['cardSavingApproved'] ?? null; |
| 32 | + $obj->expiryMonth = $data['expiryMonth'] ?? null; |
| 33 | + $obj->expiryYear = $data['expiryYear'] ?? null; |
34 | 34 | return $obj; |
35 | 35 | } |
36 | 36 |
|
37 | | - public function getCardToken(): string |
| 37 | + public function getCardToken(): ?string |
38 | 38 | { |
39 | 39 | return $this->cardToken; |
40 | 40 | } |
41 | 41 |
|
42 | | - public function getExpiryMonth(): string |
| 42 | + public function getExpiryMonth(): ?string |
43 | 43 | { |
44 | 44 | return $this->expiryMonth; |
45 | 45 | } |
46 | 46 |
|
47 | | - public function getExpiryYear(): string |
| 47 | + public function getExpiryYear(): ?string |
48 | 48 | { |
49 | 49 | return $this->expiryYear; |
50 | 50 | } |
51 | 51 |
|
52 | | - public function getCardSavingApproved(): string |
| 52 | + public function getCardSavingApproved(): ?bool |
53 | 53 | { |
54 | 54 | return $this->cardSavingApproved; |
55 | 55 | } |
56 | 56 |
|
57 | | - public function getMaskedCardNumber(): string |
| 57 | + public function getMaskedCardNumber(): ?string |
58 | 58 | { |
59 | 59 | return $this->maskedCardNumber; |
60 | 60 | } |
61 | 61 |
|
62 | | - public function getType(): string |
| 62 | + public function getType(): ?string |
63 | 63 | { |
64 | 64 | return $this->type; |
65 | 65 | } |
|
0 commit comments