Passed
Push — master ( 1d7c8a...8d2aba )
by Reüel
04:34 queued 12s
created
src/Listener.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,33 +17,33 @@
 block discarded – undo
17 17
 class Listener {
18 18
 	public static function listen() {
19 19
 		// Also check for typo 'xml_notifaction', as this has been used in the past.
20
-		if ( ! filter_has_var( INPUT_GET, 'xml_notification' ) && ! filter_has_var( INPUT_GET, 'xml_notifaction' ) ) {
20
+		if ( ! filter_has_var(INPUT_GET, 'xml_notification') && ! filter_has_var(INPUT_GET, 'xml_notifaction')) {
21 21
 			return;
22 22
 		}
23 23
 
24 24
 		$notification = Util::get_notification();
25 25
 
26
-		if ( ! $notification ) {
26
+		if ( ! $notification) {
27 27
 			return;
28 28
 		}
29 29
 
30
-		$payment = get_pronamic_payment_by_purchase_id( $notification->get_purchase_id() );
30
+		$payment = get_pronamic_payment_by_purchase_id($notification->get_purchase_id());
31 31
 
32
-		if ( null !== $payment ) {
32
+		if (null !== $payment) {
33 33
 			// Add note.
34 34
 			$note = sprintf(
35 35
 				/* translators: %s: iDEAL Basic */
36
-				__( 'Webhook requested by %s.', 'pronamic_ideal' ),
37
-				__( 'iDEAL Basic', 'pronamic_ideal' )
36
+				__('Webhook requested by %s.', 'pronamic_ideal'),
37
+				__('iDEAL Basic', 'pronamic_ideal')
38 38
 			);
39 39
 
40
-			$payment->add_note( $note );
40
+			$payment->add_note($note);
41 41
 
42
-			$payment->set_status( $notification->get_status() );
43
-			$payment->set_transaction_id( $notification->get_transaction_id() );
42
+			$payment->set_status($notification->get_status());
43
+			$payment->set_transaction_id($notification->get_transaction_id());
44 44
 
45 45
 			// Update payment.
46
-			Plugin::update_payment( $payment );
46
+			Plugin::update_payment($payment);
47 47
 		}
48 48
 	}
49 49
 }
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 
177 177
 		$this->forbidden_characters = array();
178 178
 
179
-		$this->set_payment_type( self::PAYMENT_TYPE_IDEAL );
180
-		$this->set_expire_date_format( self::DATE_EXPIRE_FORMAT );
181
-		$this->set_expire_date_modifier( self::EXPIRE_DATE_MODIFIER );
182
-		$this->set_forbidden_characters( self::FORBIDDEN_CHARACHTERS );
179
+		$this->set_payment_type(self::PAYMENT_TYPE_IDEAL);
180
+		$this->set_expire_date_format(self::DATE_EXPIRE_FORMAT);
181
+		$this->set_expire_date_modifier(self::EXPIRE_DATE_MODIFIER);
182
+		$this->set_forbidden_characters(self::FORBIDDEN_CHARACHTERS);
183 183
 	}
184 184
 
185 185
 	/**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 *
197 197
 	 * @param string $url Payment server URL.
198 198
 	 */
199
-	public function set_payment_server_url( $url ) {
199
+	public function set_payment_server_url($url) {
200 200
 		$this->payment_server_url = $url;
201 201
 	}
202 202
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @param string $merchant_id Merchant ID.
216 216
 	 */
217
-	public function set_merchant_id( $merchant_id ) {
217
+	public function set_merchant_id($merchant_id) {
218 218
 		$this->merchant_id = $merchant_id;
219 219
 	}
220 220
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 *
233 233
 	 * @param string $sub_id Sub ID.
234 234
 	 */
235
-	public function set_sub_id( $sub_id ) {
235
+	public function set_sub_id($sub_id) {
236 236
 		$this->sub_id = $sub_id;
237 237
 	}
238 238
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @param string $hash_key Hash key.
253 253
 	 */
254
-	public function set_hash_key( $hash_key ) {
254
+	public function set_hash_key($hash_key) {
255 255
 		$this->hash_key = $hash_key;
256 256
 	}
257 257
 
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 *
271 271
 	 * @param string $purchase_id Purchase ID.
272 272
 	 */
273
-	public function set_purchase_id( $purchase_id ) {
274
-		$this->purchase_id = substr( $purchase_id, 0, 16 );
273
+	public function set_purchase_id($purchase_id) {
274
+		$this->purchase_id = substr($purchase_id, 0, 16);
275 275
 	}
276 276
 
277 277
 	/**
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	 *
289 289
 	 * @param string $language Language.
290 290
 	 */
291
-	public function set_language( $language ) {
291
+	public function set_language($language) {
292 292
 		$this->language = $language;
293 293
 	}
294 294
 
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
 	 *
308 308
 	 * @param string $description Description.
309 309
 	 */
310
-	public function set_description( $description ) {
311
-		$this->description = DataHelper::an32( $description );
310
+	public function set_description($description) {
311
+		$this->description = DataHelper::an32($description);
312 312
 	}
313 313
 
314 314
 	/**
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @param string $currency Currency.
327 327
 	 */
328
-	public function set_currency( $currency ) {
328
+	public function set_currency($currency) {
329 329
 		$this->currency = $currency;
330 330
 	}
331 331
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 *
345 345
 	 * @param string $payment_type Payment type.
346 346
 	 */
347
-	public function set_payment_type( $payment_type ) {
347
+	public function set_payment_type($payment_type) {
348 348
 		$this->payment_type = $payment_type;
349 349
 	}
350 350
 
@@ -355,10 +355,10 @@  discard block
 block discarded – undo
355 355
 	 *
356 356
 	 * @return DateTime
357 357
 	 */
358
-	public function get_expire_date( $create_new = false ) {
359
-		if ( null === $this->expire_date || $create_new ) {
360
-			$this->expire_date = new DateTime( null, new DateTimeZone( Plugin::TIMEZONE ) );
361
-			$this->expire_date->modify( $this->expire_date_modifier );
358
+	public function get_expire_date($create_new = false) {
359
+		if (null === $this->expire_date || $create_new) {
360
+			$this->expire_date = new DateTime(null, new DateTimeZone(Plugin::TIMEZONE));
361
+			$this->expire_date->modify($this->expire_date_modifier);
362 362
 		}
363 363
 
364 364
 		return $this->expire_date;
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 	 *
379 379
 	 * @param string $expire_date_format Expire date format.
380 380
 	 */
381
-	public function set_expire_date_format( $expire_date_format ) {
381
+	public function set_expire_date_format($expire_date_format) {
382 382
 		$this->expire_date_format = $expire_date_format;
383 383
 	}
384 384
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	 *
397 397
 	 * @param string $expire_date_modifier Expire date modifier.
398 398
 	 */
399
-	public function set_expire_date_modifier( $expire_date_modifier ) {
399
+	public function set_expire_date_modifier($expire_date_modifier) {
400 400
 		$this->expire_date_modifier = $expire_date_modifier;
401 401
 	}
402 402
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 *
406 406
 	 * @param DateTime $date Expire date.
407 407
 	 */
408
-	public function set_expire_date( DateTime $date ) {
408
+	public function set_expire_date(DateTime $date) {
409 409
 		$this->expire_date = $date;
410 410
 	}
411 411
 
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
 	 *
426 426
 	 * @throws InvalidArgumentException Passed characters is not an array or string.
427 427
 	 */
428
-	public function set_forbidden_characters( $characters ) {
429
-		if ( ! is_array( $characters ) && ! is_string( $characters ) ) {
430
-			throw new InvalidArgumentException( 'Invalid characters argument.' );
428
+	public function set_forbidden_characters($characters) {
429
+		if ( ! is_array($characters) && ! is_string($characters)) {
430
+			throw new InvalidArgumentException('Invalid characters argument.');
431 431
 		}
432 432
 
433
-		if ( is_string( $characters ) ) {
434
-			$characters = str_split( $characters );
433
+		if (is_string($characters)) {
434
+			$characters = str_split($characters);
435 435
 		}
436 436
 
437 437
 		$this->forbidden_characters = $characters;
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	 *
452 452
 	 * @param string $url Success URL.
453 453
 	 */
454
-	public function set_success_url( $url ) {
454
+	public function set_success_url($url) {
455 455
 		$this->success_url = $url;
456 456
 	}
457 457
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 	 *
470 470
 	 * @param string $url Cancel URL.
471 471
 	 */
472
-	public function set_cancel_url( $url ) {
472
+	public function set_cancel_url($url) {
473 473
 		$this->cancel_url = $url;
474 474
 	}
475 475
 
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 	 *
488 488
 	 * @param string $url Error URL.
489 489
 	 */
490
-	public function set_error_url( $url ) {
490
+	public function set_error_url($url) {
491 491
 		$this->error_url = $url;
492 492
 	}
493 493
 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 	 *
506 506
 	 * @param Items $items Items.
507 507
 	 */
508
-	public function set_items( Items $items ) {
508
+	public function set_items(Items $items) {
509 509
 		$this->items = $items;
510 510
 	}
511 511
 
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 		$string[] = $this->get_sub_id();
535 535
 
536 536
 		// Total amount of transaction.
537
-		$string[] = intval( $this->get_amount()->get_cents() );
537
+		$string[] = intval($this->get_amount()->get_cents());
538 538
 
539 539
 		// The online shop's unique order number, also known as purchase id.
540 540
 		$string[] = $this->get_purchase_id();
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 
545 545
 		// yyyy-MMddTHH:mm:ss.SSS Z Time at which the transaction expires (maximum of 1 hour later).
546 546
 		// The consumer has time until then to pay with iDEAL.
547
-		$string[] = $this->get_expire_date()->format( $this->get_expire_date_format() );
547
+		$string[] = $this->get_expire_date()->format($this->get_expire_date_format());
548 548
 
549 549
 		// Iterate through the items and concat.
550
-		foreach ( $this->get_items() as $item ) {
550
+		foreach ($this->get_items() as $item) {
551 551
 			// Article number. <n> is 1 for the first product, 2 for the second, etc.
552 552
 			// N.B. Note that for every product type the parameters
553 553
 			// itemNumber<n>, itemDescription<n>, itemQuantity<n> and itemPrice<n> are mandatory.
@@ -560,17 +560,17 @@  discard block
 block discarded – undo
560 560
 			$string[] = $item->get_quantity();
561 561
 
562 562
 			// Price of article <n> in whole eurocents.
563
-			$string[] = intval( $item->get_price()->get_cents() );
563
+			$string[] = intval($item->get_price()->get_cents());
564 564
 		}
565 565
 
566
-		$concat_string = implode( '', $string );
566
+		$concat_string = implode('', $string);
567 567
 
568 568
 		// The characters "\t", "\n", "\r", " " (spaces) may not exist in the string.
569 569
 		$forbidden_characters = $this->get_forbidden_characters();
570
-		$concat_string        = str_replace( $forbidden_characters, '', $concat_string );
570
+		$concat_string        = str_replace($forbidden_characters, '', $concat_string);
571 571
 
572 572
 		// Delete special HTML entities.
573
-		$concat_string = html_entity_decode( $concat_string, ENT_COMPAT, 'UTF-8' );
573
+		$concat_string = html_entity_decode($concat_string, ENT_COMPAT, 'UTF-8');
574 574
 
575 575
 		return $concat_string;
576 576
 	}
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 	 * @return string Hash
582 582
 	 */
583 583
 	public function create_hash() {
584
-		return sha1( $this->create_hash_string() );
584
+		return sha1($this->create_hash_string());
585 585
 	}
586 586
 
587 587
 	/**
@@ -596,23 +596,23 @@  discard block
 block discarded – undo
596 596
 		$fields['merchantID'] = $this->get_merchant_id();
597 597
 		$fields['subID']      = $this->get_sub_id();
598 598
 
599
-		$fields['amount']      = intval( $this->get_amount()->get_cents() );
599
+		$fields['amount']      = intval($this->get_amount()->get_cents());
600 600
 		$fields['purchaseID']  = $this->get_purchase_id();
601 601
 		$fields['language']    = $this->get_language();
602 602
 		$fields['currency']    = $this->get_currency();
603 603
 		$fields['description'] = $this->get_description();
604 604
 		$fields['hash']        = $this->create_hash();
605 605
 		$fields['paymentType'] = $this->get_payment_type();
606
-		$fields['validUntil']  = $this->get_expire_date()->format( $this->get_expire_date_format() );
606
+		$fields['validUntil']  = $this->get_expire_date()->format($this->get_expire_date_format());
607 607
 
608 608
 		$serial_number = 1;
609
-		foreach ( $this->get_items() as $item ) {
610
-			$fields[ 'itemNumber' . $serial_number ]      = $item->get_number();
611
-			$fields[ 'itemDescription' . $serial_number ] = $item->get_description();
612
-			$fields[ 'itemQuantity' . $serial_number ]    = $item->get_quantity();
613
-			$fields[ 'itemPrice' . $serial_number ]       = intval( $item->get_price()->get_cents() );
609
+		foreach ($this->get_items() as $item) {
610
+			$fields['itemNumber' . $serial_number]      = $item->get_number();
611
+			$fields['itemDescription' . $serial_number] = $item->get_description();
612
+			$fields['itemQuantity' . $serial_number]    = $item->get_quantity();
613
+			$fields['itemPrice' . $serial_number]       = intval($item->get_price()->get_cents());
614 614
 
615
-			$serial_number ++;
615
+			$serial_number++;
616 616
 		}
617 617
 
618 618
 		$fields['urlCancel']  = $this->get_cancel_url();
Please login to merge, or discard this patch.
src/Items.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	// Function name "getIterator" is in camel caps format, try 'get_iterator'
41 41
 	public function getIterator() {
42 42
 		// @codingStandardsIgnoreEnd
43
-		return new ArrayIterator( $this->items );
43
+		return new ArrayIterator($this->items);
44 44
 	}
45 45
 
46 46
 	/**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @param Item $item Item.
50 50
 	 */
51
-	public function add_item( Item $item ) {
51
+	public function add_item(Item $item) {
52 52
 		$this->items[] = $item;
53 53
 	}
54 54
 
@@ -58,20 +58,20 @@  discard block
 block discarded – undo
58 58
 	public function get_amount() {
59 59
 		$amount = 0;
60 60
 
61
-		$use_bcmath = extension_loaded( 'bcmath' );
61
+		$use_bcmath = extension_loaded('bcmath');
62 62
 
63
-		foreach ( $this->items as $item ) {
64
-			if ( $use_bcmath ) {
63
+		foreach ($this->items as $item) {
64
+			if ($use_bcmath) {
65 65
 				// Use non-locale aware float value.
66 66
 				// @link http://php.net/sprintf.
67
-				$item_amount = sprintf( '%F', $item->get_amount() );
67
+				$item_amount = sprintf('%F', $item->get_amount());
68 68
 
69
-				$amount = bcadd( $amount, $item_amount, 8 );
69
+				$amount = bcadd($amount, $item_amount, 8);
70 70
 			} else {
71 71
 				$amount += $item->get_amount();
72 72
 			}
73 73
 		}
74 74
 
75
-		return new Money( $amount );
75
+		return new Money($amount);
76 76
 	}
77 77
 }
Please login to merge, or discard this patch.
src/ConfigFactory.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,22 +17,22 @@
 block discarded – undo
17 17
 class ConfigFactory extends GatewayConfigFactory {
18 18
 	private $config_class;
19 19
 
20
-	public function __construct( $config_class = null, $config_test_class = null ) {
21
-		$this->config_class      = is_null( $config_class ) ? __NAMESPACE__ . '\Config' : $config_class;
22
-		$this->config_test_class = is_null( $config_test_class ) ? __NAMESPACE__ . '\Config' : $config_test_class;
20
+	public function __construct($config_class = null, $config_test_class = null) {
21
+		$this->config_class      = is_null($config_class) ? __NAMESPACE__ . '\Config' : $config_class;
22
+		$this->config_test_class = is_null($config_test_class) ? __NAMESPACE__ . '\Config' : $config_test_class;
23 23
 	}
24 24
 
25
-	public function get_config( $post_id ) {
26
-		$mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true );
25
+	public function get_config($post_id) {
26
+		$mode = get_post_meta($post_id, '_pronamic_gateway_mode', true);
27 27
 
28
-		$config_class = ( Gateway::MODE_TEST === $mode ) ? $this->config_test_class : $this->config_class;
28
+		$config_class = (Gateway::MODE_TEST === $mode) ? $this->config_test_class : $this->config_class;
29 29
 
30 30
 		$config = new $config_class();
31 31
 
32
-		$config->merchant_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_merchant_id', true );
33
-		$config->sub_id      = get_post_meta( $post_id, '_pronamic_gateway_ideal_sub_id', true );
34
-		$config->hash_key    = get_post_meta( $post_id, '_pronamic_gateway_ideal_hash_key', true );
35
-		$config->purchase_id = get_post_meta( $post_id, '_pronamic_gateway_ideal_purchase_id', true );
32
+		$config->merchant_id = get_post_meta($post_id, '_pronamic_gateway_ideal_merchant_id', true);
33
+		$config->sub_id      = get_post_meta($post_id, '_pronamic_gateway_ideal_sub_id', true);
34
+		$config->hash_key    = get_post_meta($post_id, '_pronamic_gateway_ideal_hash_key', true);
35
+		$config->purchase_id = get_post_meta($post_id, '_pronamic_gateway_ideal_purchase_id', true);
36 36
 
37 37
 		return $config;
38 38
 	}
Please login to merge, or discard this patch.
src/Gateway.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -30,17 +30,17 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @param Config $config Config.
32 32
 	 */
33
-	public function __construct( Config $config ) {
34
-		parent::__construct( $config );
33
+	public function __construct(Config $config) {
34
+		parent::__construct($config);
35 35
 
36
-		$this->set_method( self::METHOD_HTML_FORM );
36
+		$this->set_method(self::METHOD_HTML_FORM);
37 37
 
38 38
 		$this->client = new Client();
39 39
 
40
-		$this->client->set_payment_server_url( $config->get_payment_server_url() );
41
-		$this->client->set_merchant_id( $config->merchant_id );
42
-		$this->client->set_sub_id( $config->sub_id );
43
-		$this->client->set_hash_key( $config->hash_key );
40
+		$this->client->set_payment_server_url($config->get_payment_server_url());
41
+		$this->client->set_merchant_id($config->merchant_id);
42
+		$this->client->set_sub_id($config->sub_id);
43
+		$this->client->set_hash_key($config->hash_key);
44 44
 	}
45 45
 
46 46
 	/**
@@ -70,34 +70,34 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @param Payment $payment Payment.
72 72
 	 */
73
-	public function start( Payment $payment ) {
74
-		$payment->set_action_url( $this->client->get_payment_server_url() );
73
+	public function start(Payment $payment) {
74
+		$payment->set_action_url($this->client->get_payment_server_url());
75 75
 
76 76
 		// Purchase ID.
77
-		$purchase_id = $payment->format_string( $this->config->purchase_id );
77
+		$purchase_id = $payment->format_string($this->config->purchase_id);
78 78
 
79
-		$payment->set_meta( 'purchase_id', $purchase_id );
79
+		$payment->set_meta('purchase_id', $purchase_id);
80 80
 
81 81
 		// General.
82
-		$this->client->set_currency( $payment->get_total_amount()->get_currency()->get_alphabetic_code() );
83
-		$this->client->set_purchase_id( $purchase_id );
84
-		$this->client->set_description( $payment->get_description() );
82
+		$this->client->set_currency($payment->get_total_amount()->get_currency()->get_alphabetic_code());
83
+		$this->client->set_purchase_id($purchase_id);
84
+		$this->client->set_description($payment->get_description());
85 85
 
86
-		if ( null !== $payment->get_customer() ) {
87
-			$this->client->set_language( $payment->get_customer()->get_language() );
86
+		if (null !== $payment->get_customer()) {
87
+			$this->client->set_language($payment->get_customer()->get_language());
88 88
 		}
89 89
 
90 90
 		// Items.
91 91
 		$items = new Items();
92 92
 
93
-		$items->add_item( new Item( 1, $payment->get_description(), 1, $payment->get_total_amount() ) );
93
+		$items->add_item(new Item(1, $payment->get_description(), 1, $payment->get_total_amount()));
94 94
 
95
-		$this->client->set_items( $items );
95
+		$this->client->set_items($items);
96 96
 
97 97
 		// URLs.
98
-		$this->client->set_cancel_url( add_query_arg( 'status', Statuses::CANCELLED, $payment->get_return_url() ) );
99
-		$this->client->set_success_url( add_query_arg( 'status', Statuses::SUCCESS, $payment->get_return_url() ) );
100
-		$this->client->set_error_url( add_query_arg( 'status', Statuses::FAILURE, $payment->get_return_url() ) );
98
+		$this->client->set_cancel_url(add_query_arg('status', Statuses::CANCELLED, $payment->get_return_url()));
99
+		$this->client->set_success_url(add_query_arg('status', Statuses::SUCCESS, $payment->get_return_url()));
100
+		$this->client->set_error_url(add_query_arg('status', Statuses::FAILURE, $payment->get_return_url()));
101 101
 	}
102 102
 
103 103
 	/**
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @param Payment $payment Payment.
107 107
 	 */
108
-	public function update_status( Payment $payment ) {
109
-		if ( ! filter_has_var( INPUT_GET, 'status' ) ) {
108
+	public function update_status(Payment $payment) {
109
+		if ( ! filter_has_var(INPUT_GET, 'status')) {
110 110
 			return;
111 111
 		}
112 112
 
113
-		$status = filter_input( INPUT_GET, 'status', FILTER_SANITIZE_STRING );
113
+		$status = filter_input(INPUT_GET, 'status', FILTER_SANITIZE_STRING);
114 114
 
115 115
 		// Update payment status.
116
-		$payment->set_status( $status );
116
+		$payment->set_status($status);
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.