Test Failed
Branch master (df4ed5)
by Remco
04:44
created
Category
src/ConfigFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@
 block discarded – undo
15 15
  * @since   1.0.0
16 16
  */
17 17
 class ConfigFactory extends GatewayConfigFactory {
18
-	public function get_config( $post_id ) {
18
+	public function get_config($post_id) {
19 19
 		$config = new Config();
20 20
 
21
-		$config->merchant_id  = get_post_meta( $post_id, '_pronamic_gateway_sisow_merchant_id', true );
22
-		$config->merchant_key = get_post_meta( $post_id, '_pronamic_gateway_sisow_merchant_key', true );
23
-		$config->shop_id      = get_post_meta( $post_id, '_pronamic_gateway_sisow_shop_id', true );
24
-		$config->mode         = get_post_meta( $post_id, '_pronamic_gateway_mode', true );
21
+		$config->merchant_id  = get_post_meta($post_id, '_pronamic_gateway_sisow_merchant_id', true);
22
+		$config->merchant_key = get_post_meta($post_id, '_pronamic_gateway_sisow_merchant_key', true);
23
+		$config->shop_id      = get_post_meta($post_id, '_pronamic_gateway_sisow_shop_id', true);
24
+		$config->mode         = get_post_meta($post_id, '_pronamic_gateway_mode', true);
25 25
 
26 26
 		return $config;
27 27
 	}
Please login to merge, or discard this patch.
src/Util.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * $            Dollar
54 54
 	 */
55 55
 	public static function get_pattern() {
56
-		if ( null === self::$pattern ) {
56
+		if (null === self::$pattern) {
57 57
 			$characters = array(
58 58
 				'A-Z',
59 59
 				'a-z',
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
 			// We use a # as a regex delimiter instead of a / so we don't have to escape the slash
82 82
 			// @see http://stackoverflow.com/q/12239424
83
-			self::$pattern = '#[^' . implode( $characters ) . ']#';
83
+			self::$pattern = '#[^' . implode($characters) . ']#';
84 84
 		}
85 85
 
86 86
 		return self::$pattern;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @return mixed
95 95
 	 */
96
-	public static function filter( $string ) {
97
-		return preg_replace( self::get_pattern(), '', $string );
96
+	public static function filter($string) {
97
+		return preg_replace(self::get_pattern(), '', $string);
98 98
 	}
99 99
 }
Please login to merge, or discard this patch.
src/Error.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 * @param string $code
34 34
 	 * @param string $message
35 35
 	 */
36
-	public function __construct( $code, $message ) {
36
+	public function __construct($code, $message) {
37 37
 		$this->code    = $code;
38 38
 		$this->message = $message;
39 39
 	}
Please login to merge, or discard this patch.
src/Methods.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -150,13 +150,13 @@
 block discarded – undo
150 150
 	 *
151 151
 	 * @return string
152 152
 	 */
153
-	public static function transform( $payment_method ) {
154
-		if ( ! is_scalar( $payment_method ) ) {
153
+	public static function transform($payment_method) {
154
+		if ( ! is_scalar($payment_method)) {
155 155
 			return null;
156 156
 		}
157 157
 
158
-		if ( isset( self::$map[ $payment_method ] ) ) {
159
-			return self::$map[ $payment_method ];
158
+		if (isset(self::$map[$payment_method])) {
159
+			return self::$map[$payment_method];
160 160
 		}
161 161
 
162 162
 		return null;
Please login to merge, or discard this patch.
src/XML/Parser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,5 +20,5 @@
 block discarded – undo
20 20
 	 *
21 21
 	 * @param SimpleXMLElement $xml
22 22
 	 */
23
-	public static function parse( SimpleXMLElement $xml );
23
+	public static function parse(SimpleXMLElement $xml);
24 24
 }
Please login to merge, or discard this patch.
src/XML/TransactionParser.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -19,57 +19,57 @@
 block discarded – undo
19 19
  * @since   1.0.0
20 20
  */
21 21
 class TransactionParser implements Parser {
22
-	public static function parse( SimpleXMLElement $xml ) {
22
+	public static function parse(SimpleXMLElement $xml) {
23 23
 		$transaction = new Transaction();
24 24
 
25 25
 		// Transaction request
26
-		if ( isset( $xml->trxid ) ) {
27
-			$transaction->id = Security::filter( $xml->trxid );
26
+		if (isset($xml->trxid)) {
27
+			$transaction->id = Security::filter($xml->trxid);
28 28
 		}
29 29
 
30
-		if ( isset( $xml->issuerurl ) ) {
31
-			$transaction->issuer_url = urldecode( Security::filter( $xml->issuerurl ) );
30
+		if (isset($xml->issuerurl)) {
31
+			$transaction->issuer_url = urldecode(Security::filter($xml->issuerurl));
32 32
 		}
33 33
 
34 34
 		// Status response
35
-		if ( isset( $xml->status ) ) {
36
-			$transaction->status = Security::filter( $xml->status );
35
+		if (isset($xml->status)) {
36
+			$transaction->status = Security::filter($xml->status);
37 37
 		}
38 38
 
39
-		if ( isset( $xml->amount ) ) {
40
-			$transaction->amount = Pay_Util::cents_to_amount( Security::filter( $xml->amount ) );
39
+		if (isset($xml->amount)) {
40
+			$transaction->amount = Pay_Util::cents_to_amount(Security::filter($xml->amount));
41 41
 		}
42 42
 
43
-		if ( isset( $xml->purchaseid ) ) {
44
-			$transaction->purchase_id = Security::filter( $xml->purchaseid );
43
+		if (isset($xml->purchaseid)) {
44
+			$transaction->purchase_id = Security::filter($xml->purchaseid);
45 45
 		}
46 46
 
47
-		if ( isset( $xml->description ) ) {
48
-			$transaction->description = Security::filter( $xml->description );
47
+		if (isset($xml->description)) {
48
+			$transaction->description = Security::filter($xml->description);
49 49
 		}
50 50
 
51
-		if ( isset( $xml->entrancecode ) ) {
52
-			$transaction->entrance_code = Security::filter( $xml->entrancecode );
51
+		if (isset($xml->entrancecode)) {
52
+			$transaction->entrance_code = Security::filter($xml->entrancecode);
53 53
 		}
54 54
 
55
-		if ( isset( $xml->issuerid ) ) {
56
-			$transaction->issuer_id = Security::filter( $xml->issuerid );
55
+		if (isset($xml->issuerid)) {
56
+			$transaction->issuer_id = Security::filter($xml->issuerid);
57 57
 		}
58 58
 
59
-		if ( isset( $xml->timestamp ) ) {
60
-			$transaction->timestamp = new DateTime( Security::filter( $xml->timestamp ) );
59
+		if (isset($xml->timestamp)) {
60
+			$transaction->timestamp = new DateTime(Security::filter($xml->timestamp));
61 61
 		}
62 62
 
63
-		if ( isset( $xml->consumername ) ) {
64
-			$transaction->consumer_name = Security::filter( $xml->consumername );
63
+		if (isset($xml->consumername)) {
64
+			$transaction->consumer_name = Security::filter($xml->consumername);
65 65
 		}
66 66
 
67
-		if ( isset( $xml->consumeraccount ) ) {
68
-			$transaction->consumer_account = Security::filter( $xml->consumeraccount );
67
+		if (isset($xml->consumeraccount)) {
68
+			$transaction->consumer_account = Security::filter($xml->consumeraccount);
69 69
 		}
70 70
 
71
-		if ( isset( $xml->consumercity ) ) {
72
-			$transaction->consumer_city = Security::filter( $xml->consumercity );
71
+		if (isset($xml->consumercity)) {
72
+			$transaction->consumer_city = Security::filter($xml->consumercity);
73 73
 		}
74 74
 
75 75
 		return $transaction;
Please login to merge, or discard this patch.
src/XML/ErrorParser.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
  * @since   1.0.0
18 18
  */
19 19
 class ErrorParser implements Parser {
20
-	public static function parse( SimpleXMLElement $xml ) {
20
+	public static function parse(SimpleXMLElement $xml) {
21 21
 		$error = new Sisow_Error(
22
-			Security::filter( $xml->errorcode ),
23
-			Security::filter( $xml->errormessage )
22
+			Security::filter($xml->errorcode),
23
+			Security::filter($xml->errormessage)
24 24
 		);
25 25
 
26 26
 		return $error;
Please login to merge, or discard this patch.
src/Settings.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -16,74 +16,74 @@
 block discarded – undo
16 16
  */
17 17
 class Settings extends GatewaySettings {
18 18
 	public function __construct() {
19
-		add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) );
20
-		add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) );
19
+		add_filter('pronamic_pay_gateway_sections', array($this, 'sections'));
20
+		add_filter('pronamic_pay_gateway_fields', array($this, 'fields'));
21 21
 	}
22 22
 
23
-	public function sections( array $sections ) {
23
+	public function sections(array $sections) {
24 24
 		// Sisow
25 25
 		$sections['sisow'] = array(
26
-			'title'       => __( 'Sisow', 'pronamic_ideal' ),
27
-			'methods'     => array( 'sisow' ),
26
+			'title'       => __('Sisow', 'pronamic_ideal'),
27
+			'methods'     => array('sisow'),
28 28
 			'description' => sprintf(
29 29
 				/* translators: %s: Sisow */
30
-				__( 'Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal' ),
31
-				__( 'Sisow', 'pronamic_ideal' )
30
+				__('Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal'),
31
+				__('Sisow', 'pronamic_ideal')
32 32
 			),
33 33
 		);
34 34
 
35 35
 		return $sections;
36 36
 	}
37 37
 
38
-	public function fields( array $fields ) {
38
+	public function fields(array $fields) {
39 39
 		// Merchant ID
40 40
 		$fields[] = array(
41 41
 			'filter'   => FILTER_SANITIZE_STRING,
42 42
 			'section'  => 'sisow',
43
-			'methods'  => array( 'sisow' ),
43
+			'methods'  => array('sisow'),
44 44
 			'meta_key' => '_pronamic_gateway_sisow_merchant_id',
45
-			'title'    => _x( 'Merchant ID', 'sisow', 'pronamic_ideal' ),
45
+			'title'    => _x('Merchant ID', 'sisow', 'pronamic_ideal'),
46 46
 			'type'     => 'text',
47
-			'classes'  => array( 'code' ),
48
-			'tooltip'  => __( 'Merchant ID as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal' ),
47
+			'classes'  => array('code'),
48
+			'tooltip'  => __('Merchant ID as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal'),
49 49
 		);
50 50
 
51 51
 		// Merchant Key
52 52
 		$fields[] = array(
53 53
 			'filter'   => FILTER_SANITIZE_STRING,
54 54
 			'section'  => 'sisow',
55
-			'methods'  => array( 'sisow' ),
55
+			'methods'  => array('sisow'),
56 56
 			'meta_key' => '_pronamic_gateway_sisow_merchant_key',
57
-			'title'    => _x( 'Merchant Key', 'sisow', 'pronamic_ideal' ),
57
+			'title'    => _x('Merchant Key', 'sisow', 'pronamic_ideal'),
58 58
 			'type'     => 'text',
59
-			'classes'  => array( 'regular-text', 'code' ),
60
-			'tooltip'  => __( 'Merchant Key as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal' ),
59
+			'classes'  => array('regular-text', 'code'),
60
+			'tooltip'  => __('Merchant Key as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal'),
61 61
 		);
62 62
 
63 63
 		// Shop ID
64 64
 		$fields[] = array(
65 65
 			'filter'      => FILTER_SANITIZE_STRING,
66 66
 			'section'     => 'sisow',
67
-			'methods'     => array( 'sisow' ),
67
+			'methods'     => array('sisow'),
68 68
 			'meta_key'    => '_pronamic_gateway_sisow_shop_id',
69
-			'title'       => _x( 'Shop ID', 'sisow', 'pronamic_ideal' ),
69
+			'title'       => _x('Shop ID', 'sisow', 'pronamic_ideal'),
70 70
 			'type'        => 'text',
71
-			'classes'     => array( 'regular-text', 'code' ),
72
-			'tooltip'     => __( 'Shop ID as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal' ),
71
+			'classes'     => array('regular-text', 'code'),
72
+			'tooltip'     => __('Shop ID as mentioned at <strong>My Profile</strong> in the Sisow dashboard.', 'pronamic_ideal'),
73 73
 			/* translators: %s: 0 */
74
-			'description' => sprintf( __( 'Default: <code>%s</code>', 'pronamic_ideal' ), 0 ),
74
+			'description' => sprintf(__('Default: <code>%s</code>', 'pronamic_ideal'), 0),
75 75
 			'default'     => 0,
76 76
 		);
77 77
 
78 78
 		// Transaction feedback
79 79
 		$fields[] = array(
80 80
 			'section' => 'sisow',
81
-			'methods' => array( 'sisow' ),
82
-			'title'   => __( 'Transaction feedback', 'pronamic_ideal' ),
81
+			'methods' => array('sisow'),
82
+			'title'   => __('Transaction feedback', 'pronamic_ideal'),
83 83
 			'type'    => 'description',
84 84
 			'html'    => sprintf(
85 85
 				'<span class="dashicons dashicons-yes"></span> %s',
86
-				__( 'Payment status updates will be processed without any additional configuration.', 'pronamic_ideal' )
86
+				__('Payment status updates will be processed without any additional configuration.', 'pronamic_ideal')
87 87
 			),
88 88
 		);
89 89
 
Please login to merge, or discard this patch.
src/Gateway.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -22,19 +22,19 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @param Config $config
24 24
 	 */
25
-	public function __construct( Config $config ) {
26
-		parent::__construct( $config );
25
+	public function __construct(Config $config) {
26
+		parent::__construct($config);
27 27
 
28 28
 		$this->supports = array(
29 29
 			'payment_status_request',
30 30
 		);
31 31
 
32
-		$this->set_method( Gateway::METHOD_HTTP_REDIRECT );
33
-		$this->set_has_feedback( true );
34
-		$this->set_amount_minimum( 0.01 );
32
+		$this->set_method(Gateway::METHOD_HTTP_REDIRECT);
33
+		$this->set_has_feedback(true);
34
+		$this->set_amount_minimum(0.01);
35 35
 
36
-		$this->client = new Client( $config->merchant_id, $config->merchant_key );
37
-		$this->client->set_test_mode( Gateway::MODE_TEST === $config->mode );
36
+		$this->client = new Client($config->merchant_id, $config->merchant_key);
37
+		$this->client->set_test_mode(Gateway::MODE_TEST === $config->mode);
38 38
 	}
39 39
 
40 40
 	/**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$result = $this->client->get_directory();
49 49
 
50
-		if ( $result ) {
50
+		if ($result) {
51 51
 			$groups[] = array(
52 52
 				'options' => $result,
53 53
 			);
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	public function get_issuer_field() {
62 62
 		$payment_method = $this->get_payment_method();
63 63
 
64
-		if ( null === $payment_method || PaymentMethods::IDEAL === $payment_method ) {
64
+		if (null === $payment_method || PaymentMethods::IDEAL === $payment_method) {
65 65
 			return array(
66 66
 				'id'       => 'pronamic_ideal_issuer_id',
67 67
 				'name'     => 'pronamic_ideal_issuer_id',
68
-				'label'    => __( 'Choose your bank', 'pronamic_ideal' ),
68
+				'label'    => __('Choose your bank', 'pronamic_ideal'),
69 69
 				'required' => true,
70 70
 				'type'     => 'select',
71 71
 				'choices'  => $this->get_transient_issuers(),
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @param Payment $payment
111 111
 	 */
112
-	public function start( Payment $payment ) {
112
+	public function start(Payment $payment) {
113 113
 		$order_id    = $payment->get_order_id();
114
-		$purchase_id = empty( $order_id ) ? $payment->get_id() : $order_id;
114
+		$purchase_id = empty($order_id) ? $payment->get_id() : $order_id;
115 115
 
116 116
 		// Maximum length for purchase ID is 16 characters, otherwise an error will occur:
117 117
 		// ideal_sisow_error - purchaseid too long (16)
118
-		$purchase_id = substr( $purchase_id, 0, 16 );
118
+		$purchase_id = substr($purchase_id, 0, 16);
119 119
 
120 120
 		$transaction_request              = new TransactionRequest();
121 121
 		$transaction_request->merchant_id = $this->config->merchant_id;
@@ -123,21 +123,21 @@  discard block
 block discarded – undo
123 123
 
124 124
 		$payment_method = $payment->get_method();
125 125
 
126
-		if ( is_null( $payment_method ) ) {
126
+		if (is_null($payment_method)) {
127 127
 			$payment_method = PaymentMethods::IDEAL;
128 128
 		}
129 129
 
130
-		$this->set_payment_method( $payment_method );
130
+		$this->set_payment_method($payment_method);
131 131
 
132
-		$transaction_request->payment = Methods::transform( $payment_method );
132
+		$transaction_request->payment = Methods::transform($payment_method);
133 133
 
134
-		if ( empty( $transaction_request->payment ) && ! empty( $payment_method ) ) {
134
+		if (empty($transaction_request->payment) && ! empty($payment_method)) {
135 135
 			// Leap of faith if the WordPress payment method could not transform to a Sisow method?
136 136
 			$transaction_request->payment = $payment_method;
137 137
 		}
138 138
 
139
-		$transaction_request->set_purchase_id( $purchase_id );
140
-		$transaction_request->set_entrance_code( $payment->get_entrance_code() );
139
+		$transaction_request->set_purchase_id($purchase_id);
140
+		$transaction_request->set_entrance_code($payment->get_entrance_code());
141 141
 
142 142
 		$transaction_request->amount       = $payment->get_amount()->get_amount();
143 143
 		$transaction_request->issuer_id    = $payment->get_issuer();
@@ -149,15 +149,15 @@  discard block
 block discarded – undo
149 149
 		$transaction_request->callback_url = $payment->get_return_url();
150 150
 		$transaction_request->notify_url   = $payment->get_return_url();
151 151
 
152
-		if ( Methods::IDEALQR === $transaction_request->payment ) {
152
+		if (Methods::IDEALQR === $transaction_request->payment) {
153 153
 			$transaction_request->qrcode = true;
154 154
 		}
155 155
 
156
-		$result = $this->client->create_transaction( $transaction_request );
156
+		$result = $this->client->create_transaction($transaction_request);
157 157
 
158
-		if ( false !== $result ) {
159
-			$payment->set_transaction_id( $result->id );
160
-			$payment->set_action_url( $result->issuer_url );
158
+		if (false !== $result) {
159
+			$payment->set_transaction_id($result->id);
160
+			$payment->set_action_url($result->issuer_url);
161 161
 		} else {
162 162
 			$this->error = $this->client->get_error();
163 163
 		}
@@ -168,28 +168,28 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @param Payment $payment
170 170
 	 */
171
-	public function update_status( Payment $payment ) {
172
-		$result = $this->client->get_status( $payment->get_transaction_id() );
171
+	public function update_status(Payment $payment) {
172
+		$result = $this->client->get_status($payment->get_transaction_id());
173 173
 
174
-		if ( $result instanceof Error ) {
174
+		if ($result instanceof Error) {
175 175
 			$this->error = $this->client->get_error();
176 176
 
177 177
 			return;
178 178
 		}
179 179
 
180
-		if ( false === $result ) {
180
+		if (false === $result) {
181 181
 			$this->error = $this->client->get_error();
182 182
 
183 183
 			return;
184 184
 		}
185 185
 
186
-		if ( $result instanceof Transaction ) {
186
+		if ($result instanceof Transaction) {
187 187
 			$transaction = $result;
188 188
 
189
-			$payment->set_status( $transaction->status );
190
-			$payment->set_consumer_name( $transaction->consumer_name );
191
-			$payment->set_consumer_account_number( $transaction->consumer_account );
192
-			$payment->set_consumer_city( $transaction->consumer_city );
189
+			$payment->set_status($transaction->status);
190
+			$payment->set_consumer_name($transaction->consumer_name);
191
+			$payment->set_consumer_account_number($transaction->consumer_account);
192
+			$payment->set_consumer_city($transaction->consumer_city);
193 193
 		}
194 194
 	}
195 195
 }
Please login to merge, or discard this patch.