Passed
Push — feature/post-pay ( faf3dd...ce3905 )
by Remco
04:38
created
src/Order.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
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->set_timestamp( new DateTime() );
159
-		$this->set_merchant_order_id( $merchant_order_id );
160
-		$this->set_amount( $amount );
161
-		$this->set_merchant_return_url( $merchant_return_url );
157
+	public function __construct($merchant_order_id, $amount, $merchant_return_url) {
158
+		$this->set_timestamp(new DateTime());
159
+		$this->set_merchant_order_id($merchant_order_id);
160
+		$this->set_amount($amount);
161
+		$this->set_merchant_return_url($merchant_return_url);
162 162
 	}
163 163
 
164 164
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @param DateTime $timestamp Timestamp.
168 168
 	 */
169
-	public function set_timestamp( DateTime $timestamp ) {
169
+	public function set_timestamp(DateTime $timestamp) {
170 170
 		$this->timestamp = $timestamp;
171 171
 	}
172 172
 
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 	 * @param string $merchant_order_id Merchant order ID.
177 177
 	 * @throws InvalidArgumentException Throws invalid argument exception when value does not apply to format `AN..max 10`.
178 178
 	 */
179
-	public function set_merchant_order_id( $merchant_order_id ) {
180
-		DataHelper::validate_an( $merchant_order_id, 10 );
179
+	public function set_merchant_order_id($merchant_order_id) {
180
+		DataHelper::validate_an($merchant_order_id, 10);
181 181
 
182 182
 		$this->merchant_order_id = $merchant_order_id;
183 183
 	}
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 *
188 188
 	 * @param Money $amount Amount.
189 189
 	 */
190
-	public function set_amount( Money $amount ) {
190
+	public function set_amount(Money $amount) {
191 191
 		$this->amount = $amount;
192 192
 	}
193 193
 
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
 	 * @param string $url Merchant return URL.
200 200
 	 * @throws InvalidArgumentException Throws invalid argument exception when value does not apply to format `AN..max 1024`.
201 201
 	 */
202
-	public function set_merchant_return_url( $url ) {
203
-		DataHelper::validate_an( $url, 1024 );
202
+	public function set_merchant_return_url($url) {
203
+		DataHelper::validate_an($url, 1024);
204 204
 
205 205
 		$this->merchant_return_url = $url;
206 206
 	}
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	 * @param string|null $description Description.
212 212
 	 * @throws InvalidArgumentException Throws invalid argument exception when value does not apply to format `AN..max 35`.
213 213
 	 */
214
-	public function set_description( $description ) {
214
+	public function set_description($description) {
215 215
 		$this->description = $description;
216 216
 	}
217 217
 
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 * @param string|null $language Language.
222 222
 	 * @throws InvalidArgumentException Throws invalid argument exception when value does not apply to format `AN..2`.
223 223
 	 */
224
-	public function set_language( $language ) {
225
-		DataHelper::validate_null_or_an( $language, 2 );
224
+	public function set_language($language) {
225
+		DataHelper::validate_null_or_an($language, 2);
226 226
 
227 227
 		$this->language = $language;
228 228
 	}
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @param string|null $payment_brand Payment brand.
234 234
 	 * @throws InvalidArgumentException Throws invalid argument exception when value does not apply to format `AN..50`.
235 235
 	 */
236
-	public function set_payment_brand( $payment_brand ) {
237
-		DataHelper::validate_null_or_an( $payment_brand, 50 );
236
+	public function set_payment_brand($payment_brand) {
237
+		DataHelper::validate_null_or_an($payment_brand, 50);
238 238
 
239 239
 		$this->payment_brand = $payment_brand;
240 240
 	}
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
 	 * @param string|null $payment_brand_force Payment brand force.
246 246
 	 * @throws InvalidArgumentException Throws invalid argument exception when value does not apply to format `AN..50`.
247 247
 	 */
248
-	public function set_payment_brand_force( $payment_brand_force ) {
249
-		DataHelper::validate_null_or_an( $payment_brand_force, 50 );
248
+	public function set_payment_brand_force($payment_brand_force) {
249
+		DataHelper::validate_null_or_an($payment_brand_force, 50);
250 250
 
251 251
 		$this->payment_brand_force = $payment_brand_force;
252 252
 	}
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @param OrderItems|null $order_items Order items.
269 269
 	 */
270
-	public function set_order_items( OrderItems $order_items = null ) {
270
+	public function set_order_items(OrderItems $order_items = null) {
271 271
 		$this->order_items = $order_items;
272 272
 	}
273 273
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 *
277 277
 	 * @param Address|null $shipping_detail Shipping address details.
278 278
 	 */
279
-	public function set_shipping_detail( Address $shipping_detail = null ) {
279
+	public function set_shipping_detail(Address $shipping_detail = null) {
280 280
 		$this->shipping_detail = $shipping_detail;
281 281
 	}
282 282
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @param Address|null $billing_detail Billing address details.
287 287
 	 */
288
-	public function set_billing_detail( Address $billing_detail = null ) {
288
+	public function set_billing_detail(Address $billing_detail = null) {
289 289
 		$this->billing_detail = $billing_detail;
290 290
 	}
291 291
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	 *
295 295
 	 * @param CustomerInformation $customer_information Customer information.
296 296
 	 */
297
-	public function set_customer_information( CustomerInformation $customer_information ) {
297
+	public function set_customer_information(CustomerInformation $customer_information) {
298 298
 		$this->customer_information = $customer_information;
299 299
 	}
300 300
 
@@ -306,42 +306,42 @@  discard block
 block discarded – undo
306 306
 	public function get_json() {
307 307
 		$object = (object) array();
308 308
 
309
-		$object->timestamp       = $this->timestamp->format( DATE_ATOM );
309
+		$object->timestamp       = $this->timestamp->format(DATE_ATOM);
310 310
 		$object->merchantOrderId = $this->merchant_order_id;
311 311
 
312
-		if ( null !== $this->description ) {
312
+		if (null !== $this->description) {
313 313
 			$object->description = $this->description;
314 314
 		}
315 315
 
316
-		if ( null !== $this->order_items ) {
316
+		if (null !== $this->order_items) {
317 317
 			$object->orderItems = $this->order_items->get_json();
318 318
 		}
319 319
 
320 320
 		$object->amount = $this->amount->get_json();
321 321
 
322
-		if ( null !== $this->shipping_detail ) {
322
+		if (null !== $this->shipping_detail) {
323 323
 			$object->shippingDetail = $this->shipping_detail->get_json();
324 324
 		}
325 325
 
326
-		if ( null !== $this->billing_detail ) {
326
+		if (null !== $this->billing_detail) {
327 327
 			$object->billingDetail = $this->billing_detail->get_json();
328 328
 		}
329 329
 
330
-		if ( null !== $this->customer_information ) {
330
+		if (null !== $this->customer_information) {
331 331
 			$object->customerInformation = $this->customer_information->get_json();
332 332
 		}
333 333
 
334
-		if ( null !== $this->language ) {
334
+		if (null !== $this->language) {
335 335
 			$object->language = $this->language;
336 336
 		}
337 337
 
338 338
 		$object->merchantReturnURL = $this->merchant_return_url;
339 339
 
340
-		if ( null !== $this->payment_brand ) {
340
+		if (null !== $this->payment_brand) {
341 341
 			$object->paymentBrand = $this->payment_brand;
342 342
 		}
343 343
 
344
-		if ( null !== $this->payment_brand_force ) {
344
+		if (null !== $this->payment_brand_force) {
345 345
 			$object->paymentBrandForce = $this->payment_brand_force;
346 346
 		}
347 347
 
@@ -354,38 +354,38 @@  discard block
 block discarded – undo
354 354
 	 * @param array $fields Fields.
355 355
 	 * @return array
356 356
 	 */
357
-	public function get_signature_fields( $fields = array() ) {
358
-		$fields[] = $this->timestamp->format( DATE_ATOM );
357
+	public function get_signature_fields($fields = array()) {
358
+		$fields[] = $this->timestamp->format(DATE_ATOM);
359 359
 		$fields[] = $this->merchant_order_id;
360 360
 
361
-		$fields = $this->amount->get_signature_fields( $fields );
361
+		$fields = $this->amount->get_signature_fields($fields);
362 362
 
363 363
 		$fields[] = $this->language;
364 364
 		$fields[] = $this->description;
365 365
 		$fields[] = $this->merchant_return_url;
366 366
 
367
-		if ( null !== $this->order_items ) {
368
-			$fields = $this->order_items->get_signature_fields( $fields );
367
+		if (null !== $this->order_items) {
368
+			$fields = $this->order_items->get_signature_fields($fields);
369 369
 		}
370 370
 
371
-		if ( null !== $this->shipping_detail ) {
372
-			$fields = $this->shipping_detail->get_signature_fields( $fields );
371
+		if (null !== $this->shipping_detail) {
372
+			$fields = $this->shipping_detail->get_signature_fields($fields);
373 373
 		}
374 374
 
375
-		if ( null !== $this->payment_brand ) {
375
+		if (null !== $this->payment_brand) {
376 376
 			$fields[] = $this->payment_brand;
377 377
 		}
378 378
 
379
-		if ( null !== $this->payment_brand_force ) {
379
+		if (null !== $this->payment_brand_force) {
380 380
 			$fields[] = $this->payment_brand_force;
381 381
 		}
382 382
 
383
-		if ( null !== $this->customer_information ) {
384
-			$fields = $this->customer_information->get_signature_fields( $fields );
383
+		if (null !== $this->customer_information) {
384
+			$fields = $this->customer_information->get_signature_fields($fields);
385 385
 		}
386 386
 
387
-		if ( null !== $this->billing_detail ) {
388
-			$fields = $this->billing_detail->get_signature_fields( $fields );
387
+		if (null !== $this->billing_detail) {
388
+			$fields = $this->billing_detail->get_signature_fields($fields);
389 389
 		}
390 390
 
391 391
 		return $fields;
Please login to merge, or discard this patch.
src/Money.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param string $currency Authentication.
45 45
 	 * @param int    $amount   Amount in cents.
46 46
 	 */
47
-	public function __construct( $currency, $amount ) {
47
+	public function __construct($currency, $amount) {
48 48
 		$this->currency = $currency;
49 49
 		$this->amount   = $amount;
50 50
 	}
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 	 * @return Money
87 87
 	 * @throws InvalidArgumentException Throws invalid argument exception when object does not contains the required properties.
88 88
 	 */
89
-	public static function from_object( stdClass $object ) {
90
-		if ( ! isset( $object->currency ) ) {
91
-			throw new InvalidArgumentException( 'Object must contain `currency` property.' );
89
+	public static function from_object(stdClass $object) {
90
+		if ( ! isset($object->currency)) {
91
+			throw new InvalidArgumentException('Object must contain `currency` property.');
92 92
 		}
93 93
 
94
-		if ( ! isset( $object->amount ) ) {
95
-			throw new InvalidArgumentException( 'Object must contain `amount` property.' );
94
+		if ( ! isset($object->amount)) {
95
+			throw new InvalidArgumentException('Object must contain `amount` property.');
96 96
 		}
97 97
 
98 98
 		return new self(
@@ -108,20 +108,20 @@  discard block
 block discarded – undo
108 108
 	 * @return Money
109 109
 	 * @throws \JsonSchema\Exception\ValidationException Throws JSON schema validation exception when JSON is invalid.
110 110
 	 */
111
-	public static function from_json( $json ) {
112
-		$data = json_decode( $json );
111
+	public static function from_json($json) {
112
+		$data = json_decode($json);
113 113
 
114 114
 		$validator = new Validator();
115 115
 
116 116
 		$validator->validate(
117 117
 			$data,
118 118
 			(object) array(
119
-				'$ref' => 'file://' . realpath( __DIR__ . '/../json-schemas/json-schema-money.json' ),
119
+				'$ref' => 'file://' . realpath(__DIR__ . '/../json-schemas/json-schema-money.json'),
120 120
 			),
121 121
 			Constraint::CHECK_MODE_EXCEPTIONS
122 122
 		);
123 123
 
124
-		return self::from_object( $data );
124
+		return self::from_object($data);
125 125
 	}
126 126
 
127 127
 	/**
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 	 * @param array $fields Fields.
131 131
 	 * @return array
132 132
 	 */
133
-	public function get_signature_fields( $fields = array() ) {
133
+	public function get_signature_fields($fields = array()) {
134 134
 		$fields[] = $this->get_currency();
135
-		$fields[] = strval( $this->get_amount() );
135
+		$fields[] = strval($this->get_amount());
136 136
 
137 137
 		return $fields;
138 138
 	}
Please login to merge, or discard this patch.
src/DataHelper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 	 * @param int    $max   Max length of value.
29 29
 	 * @throws InvalidArgumentException Throws invalid argument exception when string is longer then max length.
30 30
 	 */
31
-	public static function validate_an( $value, $max ) {
32
-		if ( strlen( $value ) > $max ) {
31
+	public static function validate_an($value, $max) {
32
+		if (strlen($value) > $max) {
33 33
 			throw new InvalidArgumentException(
34 34
 				sprintf(
35 35
 					'Value "%s" can not be longer then `%d`.',
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 	 * @param int         $max   Max length of value.
50 50
 	 * @throws InvalidArgumentException Throws invalid argument exception when value is not null and longer then max length.
51 51
 	 */
52
-	public static function validate_null_or_an( $value, $max ) {
53
-		if ( null === $value ) {
52
+	public static function validate_null_or_an($value, $max) {
53
+		if (null === $value) {
54 54
 			return true;
55 55
 		}
56 56
 
57
-		return self::validate_an( $value, $max );
57
+		return self::validate_an($value, $max);
58 58
 	}
59 59
 }
Please login to merge, or discard this patch.
src/CustomerInformation.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param string $email_address E-mailadress of the consumer.
62 62
 	 */
63
-	public function set_email_address( $email_address ) {
63
+	public function set_email_address($email_address) {
64 64
 		$this->email_address = $email_address;
65 65
 	}
66 66
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @param DateTime $date_of_birth Date of birth.
71 71
 	 */
72
-	public function set_date_of_birth( DateTime $date_of_birth ) {
72
+	public function set_date_of_birth(DateTime $date_of_birth) {
73 73
 		$this->date_of_birth = $date_of_birth;
74 74
 	}
75 75
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @param string $gender Gender.
80 80
 	 */
81
-	public function set_gender( $gender ) {
81
+	public function set_gender($gender) {
82 82
 		$this->gender = $gender;
83 83
 	}
84 84
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @param string $initials Initials.
89 89
 	 */
90
-	public function set_initials( $initials ) {
90
+	public function set_initials($initials) {
91 91
 		$this->initials = $initials;
92 92
 	}
93 93
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @param string $telephone_number Telephone number.
98 98
 	 */
99
-	public function set_telephone_number( $telephone_number ) {
99
+	public function set_telephone_number($telephone_number) {
100 100
 		$this->telephone_number = $telephone_number;
101 101
 	}
102 102
 
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
 	public function get_json() {
109 109
 		$object = (object) array();
110 110
 
111
-		if ( null !== $this->email_address ) {
111
+		if (null !== $this->email_address) {
112 112
 			$object->emailAddress = $this->email_address;
113 113
 		}
114 114
 
115
-		if ( null !== $this->date_of_birth ) {
116
-			$object->dateOfBirth = $this->date_of_birth->format( 'd-m-Y' );
115
+		if (null !== $this->date_of_birth) {
116
+			$object->dateOfBirth = $this->date_of_birth->format('d-m-Y');
117 117
 		}
118 118
 
119
-		if ( null !== $this->gender ) {
119
+		if (null !== $this->gender) {
120 120
 			$object->gender = $this->gender;
121 121
 		}
122 122
 
123
-		if ( null !== $this->initials ) {
123
+		if (null !== $this->initials) {
124 124
 			$object->initials = $this->initials;
125 125
 		}
126 126
 
127
-		if ( null !== $this->telephone_number ) {
127
+		if (null !== $this->telephone_number) {
128 128
 			$object->telephoneNumber = $this->telephone_number;
129 129
 		}
130 130
 
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 	 * @param array $fields Fields.
138 138
 	 * @return array
139 139
 	 */
140
-	public function get_signature_fields( $fields = array() ) {
140
+	public function get_signature_fields($fields = array()) {
141 141
 		$fields[] = $this->email_address;
142
-		$fields[] = ( null === $this->date_of_birth ) ? null : $this->date_of_birth->format( 'd-m-Y' );
142
+		$fields[] = (null === $this->date_of_birth) ? null : $this->date_of_birth->format('d-m-Y');
143 143
 		$fields[] = $this->gender;
144 144
 		$fields[] = $this->initials;
145 145
 		$fields[] = $this->telephone_number;
Please login to merge, or discard this patch.
src/OrderItem.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @param Money  $amount   Amount.
83 83
 	 * @param string $category Category.
84 84
 	 */
85
-	public function __construct( $name, $quantity, Money $amount, $category ) {
85
+	public function __construct($name, $quantity, Money $amount, $category) {
86 86
 		$this->name     = $name;
87 87
 		$this->quantity = $quantity;
88 88
 		$this->amount   = $amount;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @param string|null $id ID.
105 105
 	 */
106
-	public function set_id( $id = null ) {
106
+	public function set_id($id = null) {
107 107
 		$this->id = $id;
108 108
 	}
109 109
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @param string $description Description.
132 132
 	 */
133
-	public function set_description( $description ) {
133
+	public function set_description($description) {
134 134
 		$this->description = $description;
135 135
 	}
136 136
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @param Money|null $tax Tax.
168 168
 	 */
169
-	public function set_tax( Money $tax = null ) {
169
+	public function set_tax(Money $tax = null) {
170 170
 		$this->tax = $tax;
171 171
 	}
172 172
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @param int $vat_category VAT category.
195 195
 	 */
196
-	public function set_vat_category( $vat_category ) {
196
+	public function set_vat_category($vat_category) {
197 197
 		$this->vat_category = $vat_category;
198 198
 	}
199 199
 
@@ -205,26 +205,26 @@  discard block
 block discarded – undo
205 205
 	public function get_json() {
206 206
 		$object = (object) array();
207 207
 
208
-		if ( null !== $this->id ) {
208
+		if (null !== $this->id) {
209 209
 			$object->id = $this->id;
210 210
 		}
211 211
 
212 212
 		$object->name = $this->name;
213 213
 
214
-		if ( null !== $this->description ) {
214
+		if (null !== $this->description) {
215 215
 			$object->description = $this->description;
216 216
 		}
217 217
 
218 218
 		$object->quantity = $this->quantity;
219 219
 		$object->amount   = $this->amount->get_json();
220 220
 
221
-		if ( null !== $this->tax ) {
221
+		if (null !== $this->tax) {
222 222
 			$object->tax = $this->tax->get_json();
223 223
 		}
224 224
 
225 225
 		$object->category = $this->category;
226 226
 
227
-		if ( null !== $this->vat_category ) {
227
+		if (null !== $this->vat_category) {
228 228
 			$object->vatCategory = $this->vat_category;
229 229
 		}
230 230
 
@@ -237,26 +237,26 @@  discard block
 block discarded – undo
237 237
 	 * @param array $fields Fields.
238 238
 	 * @return array
239 239
 	 */
240
-	public function get_signature_fields( $fields = array() ) {
241
-		if ( null !== $this->id ) {
240
+	public function get_signature_fields($fields = array()) {
241
+		if (null !== $this->id) {
242 242
 			$fields[] = $this->id;
243 243
 		}
244 244
 
245 245
 		$fields[] = $this->name;
246 246
 		$fields[] = $this->description;
247
-		$fields[] = strval( $this->quantity );
247
+		$fields[] = strval($this->quantity);
248 248
 
249
-		$fields = $this->amount->get_signature_fields( $fields );
249
+		$fields = $this->amount->get_signature_fields($fields);
250 250
 
251
-		if ( null === $this->tax ) {
251
+		if (null === $this->tax) {
252 252
 			$fields[] = null;
253 253
 		} else {
254
-			$fields = $this->tax->get_signature_fields( $fields );
254
+			$fields = $this->tax->get_signature_fields($fields);
255 255
 		}
256 256
 
257 257
 		$fields[] = $this->category;
258 258
 
259
-		if ( null !== $this->vat_category ) {
259
+		if (null !== $this->vat_category) {
260 260
 			$fields[] = $this->vat_category;
261 261
 		}
262 262
 
Please login to merge, or discard this patch.