1 | <?php declare(strict_types=1); |
||
10 | final class Notification implements \ArrayAccess, \IteratorAggregate, \JsonSerializable |
||
11 | { |
||
12 | use HasSignature; |
||
13 | |||
14 | const AUTHORIZED = 'AUTHORIZED'; |
||
15 | const CONFIRMED = 'CONFIRMED'; |
||
16 | const PARTIAL_REFUNDED = 'PARTIAL_REFUNDED'; |
||
17 | const REFUNDED = 'REFUNDED'; |
||
18 | const REJECTED = 'REJECTED'; |
||
19 | const REVERSED = 'REVERSED'; |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private $values; |
||
25 | |||
26 | public function __construct(array $values) |
||
27 | { |
||
28 | $this->values = $values; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Create a new notification from request instance. |
||
33 | * |
||
34 | * @param RequestInterface $request |
||
35 | * @return Notification |
||
36 | */ |
||
37 | public static function fromRequest(RequestInterface $request) |
||
41 | |||
42 | /** |
||
43 | * Throws an exception if token is invalid. |
||
44 | * |
||
45 | * @param string $secret |
||
46 | * @throws InvalidToken |
||
47 | */ |
||
48 | public function validate(string $secret) |
||
55 | |||
56 | /** |
||
57 | * Get a payment card instance if card id is exists. |
||
58 | * |
||
59 | * @return PaymentCard|null |
||
60 | */ |
||
61 | public function getPaymentCard() |
||
71 | |||
72 | /** |
||
73 | * Get a subset of the values. |
||
74 | * |
||
75 | * @param array ...$values |
||
76 | * @return self |
||
77 | */ |
||
78 | public function only(...$values) |
||
86 | |||
87 | /** |
||
88 | * Get all of the given instance except for a specified array of keys. |
||
89 | * |
||
90 | * @param array ...$values |
||
91 | * @return self |
||
92 | */ |
||
93 | public static function except(...$values) |
||
101 | |||
102 | /** |
||
103 | * Get an iterator for the values. |
||
104 | * |
||
105 | * @return \ArrayIterator |
||
106 | */ |
||
107 | public function getIterator() |
||
111 | |||
112 | /** |
||
113 | * Determine if a value exists at an offset. |
||
114 | * |
||
115 | * @param mixed $key |
||
116 | * @return bool |
||
117 | */ |
||
118 | public function offsetExists($key) |
||
122 | /** |
||
123 | * Get a value at a given offset. |
||
124 | * |
||
125 | * @param mixed $key |
||
126 | * @return mixed |
||
127 | */ |
||
128 | public function offsetGet($key) |
||
132 | /** |
||
133 | * Set the value at a given offset. |
||
134 | * |
||
135 | * @param mixed $key |
||
136 | * @param mixed $value |
||
137 | * @return void |
||
138 | */ |
||
139 | public function offsetSet($key, $value) |
||
147 | /** |
||
148 | * Unset the value at a given offset. |
||
149 | * |
||
150 | * @param string $key |
||
151 | * @return void |
||
152 | */ |
||
153 | public function offsetUnset($key) |
||
157 | |||
158 | /** |
||
159 | * {@inheritdoc} |
||
160 | */ |
||
161 | public function jsonSerialize() |
||
165 | |||
166 | /** |
||
167 | * Get all values as JSON. |
||
168 | * |
||
169 | * @param int $options |
||
170 | * @return string |
||
171 | */ |
||
172 | public function toJson($options = 0) |
||
176 | |||
177 | /** |
||
178 | * Get all values as a plain array. |
||
179 | * |
||
180 | * @return array |
||
181 | */ |
||
182 | public function toArray() |
||
186 | } |
||
187 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.