@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @param string $email_address E-mailadress of the consumer. |
60 | 60 | */ |
61 | - public function set_email_address( $email_address ) { |
|
61 | + public function set_email_address($email_address) { |
|
62 | 62 | $this->email_address = $email_address; |
63 | 63 | } |
64 | 64 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @param string $date_of_birth Date of birth. |
69 | 69 | */ |
70 | - public function set_date_of_birth( $date_of_birth ) { |
|
70 | + public function set_date_of_birth($date_of_birth) { |
|
71 | 71 | $this->date_of_birth = $date_of_birth; |
72 | 72 | } |
73 | 73 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @param string $gender Gender. |
78 | 78 | */ |
79 | - public function set_gender( $gender ) { |
|
79 | + public function set_gender($gender) { |
|
80 | 80 | $this->gender = $gender; |
81 | 81 | } |
82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @param string $initials Initials. |
87 | 87 | */ |
88 | - public function set_initials( $initials ) { |
|
88 | + public function set_initials($initials) { |
|
89 | 89 | $this->initials = $initials; |
90 | 90 | } |
91 | 91 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @param string $telephone_number Telephone number. |
96 | 96 | */ |
97 | - public function set_telephone_number( $telephone_number ) { |
|
97 | + public function set_telephone_number($telephone_number) { |
|
98 | 98 | $this->telephone_number = $telephone_number; |
99 | 99 | } |
100 | 100 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | 'telephoneNumber' => $this->telephone_number, |
113 | 113 | ); |
114 | 114 | |
115 | - $data = array_filter( $data ); |
|
115 | + $data = array_filter($data); |
|
116 | 116 | |
117 | - if ( empty( $data ) ) { |
|
117 | + if (empty($data)) { |
|
118 | 118 | return null; |
119 | 119 | } |
120 | 120 |
@@ -25,35 +25,35 @@ discard block |
||
25 | 25 | * @param string $signing_key Signing Key. |
26 | 26 | * @return string|null |
27 | 27 | */ |
28 | - public static function get_signature( Signable $signable, $signing_key ) { |
|
28 | + public static function get_signature(Signable $signable, $signing_key) { |
|
29 | 29 | $data = $signable->get_signature_data(); |
30 | 30 | |
31 | - if ( empty( $data ) ) { |
|
31 | + if (empty($data)) { |
|
32 | 32 | return null; |
33 | 33 | } |
34 | 34 | |
35 | - if ( empty( $signing_key ) ) { |
|
35 | + if (empty($signing_key)) { |
|
36 | 36 | return null; |
37 | 37 | } |
38 | 38 | |
39 | - $decoded_signing_key = base64_decode( $signing_key ); |
|
39 | + $decoded_signing_key = base64_decode($signing_key); |
|
40 | 40 | |
41 | - if ( false === $decoded_signing_key ) { |
|
41 | + if (false === $decoded_signing_key) { |
|
42 | 42 | return null; |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Convert array to comma separated string. |
46 | - foreach ( $data as &$part ) { |
|
47 | - if ( ! is_array( $part ) ) { |
|
46 | + foreach ($data as &$part) { |
|
47 | + if ( ! is_array($part)) { |
|
48 | 48 | continue; |
49 | 49 | } |
50 | 50 | |
51 | - $part = implode( ',', $part ); |
|
51 | + $part = implode(',', $part); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $signature = hash_hmac( |
55 | 55 | 'sha512', |
56 | - implode( ',', $data ), |
|
56 | + implode(',', $data), |
|
57 | 57 | $decoded_signing_key |
58 | 58 | ); |
59 | 59 | |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | * @param string $signature_b Signature B. |
68 | 68 | * @return bool True if valid, false otherwise. |
69 | 69 | */ |
70 | - public static function validate_signature( $signature_a, $signature_b ) { |
|
71 | - if ( empty( $signature_a ) || empty( $signature_b ) ) { |
|
70 | + public static function validate_signature($signature_a, $signature_b) { |
|
71 | + if (empty($signature_a) || empty($signature_b)) { |
|
72 | 72 | // Empty signature string or null from calculation. |
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | |
76 | - return ( 0 === strcasecmp( $signature_a, $signature_b ) ); |
|
76 | + return (0 === strcasecmp($signature_a, $signature_b)); |
|
77 | 77 | } |
78 | 78 | } |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | * @param Money $amount Amount. |
155 | 155 | * @param string $merchant_return_url Merchant return URL. |
156 | 156 | */ |
157 | - public function __construct( $merchant_order_id, $amount, $merchant_return_url ) { |
|
158 | - $this->timestamp = date( DATE_ATOM ); |
|
157 | + public function __construct($merchant_order_id, $amount, $merchant_return_url) { |
|
158 | + $this->timestamp = date(DATE_ATOM); |
|
159 | 159 | $this->merchant_order_id = $merchant_order_id; |
160 | 160 | $this->amount = $amount; |
161 | 161 | $this->merchant_return_url = $merchant_return_url; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @param string $description Description. |
168 | 168 | */ |
169 | - public function set_description( $description ) { |
|
169 | + public function set_description($description) { |
|
170 | 170 | $this->description = $description; |
171 | 171 | } |
172 | 172 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @param string $language Language. |
177 | 177 | */ |
178 | - public function set_language( $language ) { |
|
178 | + public function set_language($language) { |
|
179 | 179 | $this->language = $language; |
180 | 180 | } |
181 | 181 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @param string|null $payment_brand Payment brand. |
186 | 186 | */ |
187 | - public function set_payment_brand( $payment_brand ) { |
|
187 | + public function set_payment_brand($payment_brand) { |
|
188 | 188 | $this->payment_brand = $payment_brand; |
189 | 189 | } |
190 | 190 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @param string $payment_brand_force Payment brand force. |
195 | 195 | */ |
196 | - public function set_payment_brand_force( $payment_brand_force ) { |
|
196 | + public function set_payment_brand_force($payment_brand_force) { |
|
197 | 197 | $this->payment_brand_force = $payment_brand_force; |
198 | 198 | } |
199 | 199 | |
@@ -204,12 +204,12 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return void |
206 | 206 | */ |
207 | - public function set_order_items( Items $items ) { |
|
207 | + public function set_order_items(Items $items) { |
|
208 | 208 | $order_items = new OrderItems(); |
209 | 209 | |
210 | 210 | $items = $items->getIterator(); |
211 | 211 | |
212 | - while ( $items->valid() ) { |
|
212 | + while ($items->valid()) { |
|
213 | 213 | $item = $items->current(); |
214 | 214 | |
215 | 215 | // New order item. |
@@ -220,14 +220,14 @@ discard block |
||
220 | 220 | 'quantity' => $item->get_quantity(), |
221 | 221 | 'amount' => new Money( |
222 | 222 | $this->amount->get_currency(), |
223 | - Util::amount_to_cents( $item->get_price() ) |
|
223 | + Util::amount_to_cents($item->get_price()) |
|
224 | 224 | ), |
225 | 225 | 'category' => ProductCategories::DIGITAL, |
226 | 226 | ) |
227 | 227 | ); |
228 | 228 | |
229 | 229 | // Add order item. |
230 | - $order_items->add_item( $order_item ); |
|
230 | + $order_items->add_item($order_item); |
|
231 | 231 | |
232 | 232 | $items->next(); |
233 | 233 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @param Address $shipping_detail Shipping address details. |
242 | 242 | */ |
243 | - public function set_shipping_detail( Address $shipping_detail ) { |
|
243 | + public function set_shipping_detail(Address $shipping_detail) { |
|
244 | 244 | $this->shipping_detail = $shipping_detail; |
245 | 245 | } |
246 | 246 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @param Address $billing_detail Billing address details. |
251 | 251 | */ |
252 | - public function set_billing_detail( Address $billing_detail ) { |
|
252 | + public function set_billing_detail(Address $billing_detail) { |
|
253 | 253 | $this->billing_detail = $billing_detail; |
254 | 254 | } |
255 | 255 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @param CustomerInformation $customer_information Customer information. |
260 | 260 | */ |
261 | - public function set_customer_information( CustomerInformation $customer_information ) { |
|
261 | + public function set_customer_information(CustomerInformation $customer_information) { |
|
262 | 262 | $this->customer_information = $customer_information; |
263 | 263 | } |
264 | 264 | |
@@ -274,21 +274,21 @@ discard block |
||
274 | 274 | 'description' => $this->description, |
275 | 275 | ); |
276 | 276 | |
277 | - if ( null !== $this->order_items ) { |
|
277 | + if (null !== $this->order_items) { |
|
278 | 278 | $data['orderItems'] = $this->order_items->get_json(); |
279 | 279 | } |
280 | 280 | |
281 | 281 | $data['amount'] = $this->amount->get_json(); |
282 | 282 | |
283 | - if ( null !== $this->shipping_detail ) { |
|
283 | + if (null !== $this->shipping_detail) { |
|
284 | 284 | $data['shippingDetail'] = $this->shipping_detail->get_json(); |
285 | 285 | } |
286 | 286 | |
287 | - if ( null !== $this->billing_detail ) { |
|
287 | + if (null !== $this->billing_detail) { |
|
288 | 288 | $data['billingDetail'] = $this->billing_detail->get_json(); |
289 | 289 | } |
290 | 290 | |
291 | - if ( null !== $this->customer_information ) { |
|
291 | + if (null !== $this->customer_information) { |
|
292 | 292 | $data['customerInformation'] = $this->customer_information->get_json(); |
293 | 293 | } |
294 | 294 | |
@@ -320,28 +320,28 @@ discard block |
||
320 | 320 | // Optional fields. |
321 | 321 | $optional = array(); |
322 | 322 | |
323 | - if ( null !== $this->order_items ) { |
|
323 | + if (null !== $this->order_items) { |
|
324 | 324 | $optional['order_items'] = $this->order_items->get_signature_data(); |
325 | 325 | } |
326 | 326 | |
327 | - if ( null !== $this->shipping_detail ) { |
|
327 | + if (null !== $this->shipping_detail) { |
|
328 | 328 | $optional['shipping_detail'] = $this->shipping_detail->get_signature_data(); |
329 | 329 | } |
330 | 330 | |
331 | 331 | $optional['payment_brand'] = $this->payment_brand; |
332 | 332 | $optional['payment_brand_force'] = $this->payment_brand_force; |
333 | 333 | |
334 | - if ( null !== $this->customer_information ) { |
|
334 | + if (null !== $this->customer_information) { |
|
335 | 335 | $optional['customer_information'] = $this->customer_information->get_signature_data(); |
336 | 336 | } |
337 | 337 | |
338 | - if ( null !== $this->billing_detail ) { |
|
338 | + if (null !== $this->billing_detail) { |
|
339 | 339 | $optional['billing_detail'] = $this->billing_detail->get_signature_data(); |
340 | 340 | } |
341 | 341 | |
342 | 342 | // Remove empty optional fields. |
343 | - $optional = array_filter( $optional ); |
|
343 | + $optional = array_filter($optional); |
|
344 | 344 | |
345 | - return array_merge( $fields, $optional ); |
|
345 | + return array_merge($fields, $optional); |
|
346 | 346 | } |
347 | 347 | } |