1 | <?php |
||
15 | final class LastPaymentError implements CreatableFromArray |
||
16 | { |
||
17 | const TYPE_API_CONNECTION_ERROR = 'api_connection_error'; |
||
18 | const TYPE_API_ERROR = 'api_error'; |
||
19 | const TYPE_AUTHENTICATION_ERROR = 'authentication_error'; |
||
20 | const TYPE_CARD_ERROR = 'card_error'; |
||
21 | const TYPE_IDEMPOTENCY_ERROR = 'idempotency_error'; |
||
22 | const TYPE_INVALID_REQUEST_ERROR = 'invalid_request_error'; |
||
23 | const TYPE_RATE_LIMIT_ERROR = 'rate_limit_error'; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $type; |
||
29 | |||
30 | /** |
||
31 | * @var ?string |
||
32 | */ |
||
33 | private $chargeId; |
||
34 | |||
35 | /** |
||
36 | * @var ?string |
||
37 | */ |
||
38 | private $code; |
||
39 | |||
40 | /** |
||
41 | * @var ?string |
||
42 | */ |
||
43 | private $declineCode; |
||
44 | |||
45 | /** |
||
46 | * @var string |
||
47 | */ |
||
48 | private $docUrl; |
||
49 | |||
50 | /** |
||
51 | * @var ?string |
||
52 | */ |
||
53 | private $param; |
||
54 | |||
55 | /** |
||
56 | * @var ?PaymentIntent |
||
57 | */ |
||
58 | private $paymentIntent; |
||
59 | |||
60 | /** |
||
61 | * @var ?PaymentMethod |
||
62 | */ |
||
63 | private $paymentMethod; |
||
64 | |||
65 | /** |
||
66 | * @var ?Source |
||
67 | */ |
||
68 | private $source; |
||
69 | |||
70 | public static function createFromArray(array $data): self |
||
87 | |||
88 | public function getType(): string |
||
92 | |||
93 | public function getChargeId(): ?string |
||
97 | |||
98 | public function getCode(): ?string |
||
102 | |||
103 | public function getDeclineCode(): ?string |
||
107 | |||
108 | public function getDocUrl(): ?string |
||
112 | |||
113 | public function getMessage(): string |
||
117 | |||
118 | public function getParam(): ?string |
||
122 | |||
123 | public function getPaymentIntent(): ?PaymentIntent |
||
127 | |||
128 | public function getPaymentMethod(): ?PaymentMethod |
||
132 | |||
133 | public function getSource(): ?Source |
||
137 | } |
||
138 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: