Test Failed
Branch master (bba4c5)
by Remco
05:04
created
Category
src/Listener.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@
 block discarded – undo
12 12
 class Pronamic_WP_Pay_Gateways_Mollie_Listener implements Pronamic_Pay_Gateways_ListenerInterface {
13 13
 	public static function listen() {
14 14
 		if (
15
-			filter_has_var( INPUT_GET, 'mollie_webhook' )
15
+			filter_has_var(INPUT_GET, 'mollie_webhook')
16 16
 				&&
17
-			filter_has_var( INPUT_POST, 'id' )
17
+			filter_has_var(INPUT_POST, 'id')
18 18
 		) {
19
-			$transaction_id = filter_input( INPUT_POST, 'id', FILTER_SANITIZE_STRING );
19
+			$transaction_id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING);
20 20
 
21
-			$payment = get_pronamic_payment_by_transaction_id( $transaction_id );
21
+			$payment = get_pronamic_payment_by_transaction_id($transaction_id);
22 22
 
23
-			Pronamic_WP_Pay_Plugin::update_payment( $payment, false );
23
+			Pronamic_WP_Pay_Plugin::update_payment($payment, false);
24 24
 		}
25 25
 	}
26 26
 }
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @param string $api_key
55 55
 	 */
56
-	public function __construct( $api_key ) {
56
+	public function __construct($api_key) {
57 57
 		$this->api_key = $api_key;
58 58
 	}
59 59
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @since 1.1.9
66 66
 	 * @param string $mode
67 67
 	 */
68
-	public function set_mode( $mode ) {
68
+	public function set_mode($mode) {
69 69
 		$this->mode = $mode;
70 70
 	}
71 71
 
@@ -88,39 +88,39 @@  discard block
 block discarded – undo
88 88
 	 * @param string $action
89 89
 	 * @param array $parameters
90 90
 	 */
91
-	private function send_request( $end_point, $method = 'GET', array $data = array(), $expected_response_code = 200 ) {
91
+	private function send_request($end_point, $method = 'GET', array $data = array(), $expected_response_code = 200) {
92 92
 		// Request
93 93
 		$url = self::API_URL . $end_point;
94 94
 
95
-		$response = wp_remote_request( $url, array(
95
+		$response = wp_remote_request($url, array(
96 96
 			'method'  => $method,
97 97
 			'headers' => array(
98 98
 				'Authorization' => 'Bearer ' . $this->api_key,
99 99
 			),
100 100
 			'body'    => $data,
101
-		) );
101
+		));
102 102
 
103 103
 		// Response code
104
-		$response_code = wp_remote_retrieve_response_code( $response );
104
+		$response_code = wp_remote_retrieve_response_code($response);
105 105
 
106
-		if ( $expected_response_code != $response_code ) { // WPCS: loose comparison ok.
107
-			$this->error = new WP_Error( 'mollie_error', 'Unexpected response code.' );
106
+		if ($expected_response_code != $response_code) { // WPCS: loose comparison ok.
107
+			$this->error = new WP_Error('mollie_error', 'Unexpected response code.');
108 108
 		}
109 109
 
110 110
 		// Body
111
-		$body = wp_remote_retrieve_body( $response );
111
+		$body = wp_remote_retrieve_body($response);
112 112
 
113
-		$data = json_decode( $body );
113
+		$data = json_decode($body);
114 114
 
115
-		if ( ! is_object( $data ) ) {
116
-			$this->error = new WP_Error( 'mollie_error', 'Could not parse response.' );
115
+		if ( ! is_object($data)) {
116
+			$this->error = new WP_Error('mollie_error', 'Could not parse response.');
117 117
 
118 118
 			return false;
119 119
 		}
120 120
 
121 121
 		// Mollie error
122
-		if ( isset( $data->error, $data->error->message ) ) {
123
-			$this->error = new WP_Error( 'mollie_error', $data->error->message, $data->error );
122
+		if (isset($data->error, $data->error->message)) {
123
+			$this->error = new WP_Error('mollie_error', $data->error->message, $data->error);
124 124
 
125 125
 			return false;
126 126
 		}
@@ -130,20 +130,20 @@  discard block
 block discarded – undo
130 130
 
131 131
 	/////////////////////////////////////////////////
132 132
 
133
-	public function create_payment( Pronamic_WP_Pay_Gateways_Mollie_PaymentRequest $request ) {
134
-		return $this->send_request( 'payments/', 'POST', $request->get_array(), 201 );
133
+	public function create_payment(Pronamic_WP_Pay_Gateways_Mollie_PaymentRequest $request) {
134
+		return $this->send_request('payments/', 'POST', $request->get_array(), 201);
135 135
 	}
136 136
 
137 137
 	public function get_payments() {
138
-		return $this->send_request( 'payments/', 'GET' );
138
+		return $this->send_request('payments/', 'GET');
139 139
 	}
140 140
 
141
-	public function get_payment( $payment_id ) {
142
-		if ( '' === $payment_id ) {
141
+	public function get_payment($payment_id) {
142
+		if ('' === $payment_id) {
143 143
 			return false;
144 144
 		}
145 145
 
146
-		return $this->send_request( 'payments/' . $payment_id, 'GET' );
146
+		return $this->send_request('payments/' . $payment_id, 'GET');
147 147
 	}
148 148
 
149 149
 	//////////////////////////////////////////////////
@@ -154,21 +154,21 @@  discard block
 block discarded – undo
154 154
 	 * @return array
155 155
 	 */
156 156
 	public function get_issuers() {
157
-		$response = $this->send_request( 'issuers/', 'GET' );
157
+		$response = $this->send_request('issuers/', 'GET');
158 158
 
159
-		if ( false === $response ) {
159
+		if (false === $response) {
160 160
 			return false;
161 161
 		}
162 162
 
163 163
 		$issuers = array();
164 164
 
165
-		if ( isset( $response->data ) ) {
166
-			foreach ( $response->data as $issuer ) {
167
-				if ( Pronamic_WP_Pay_Mollie_Methods::IDEAL === $issuer->method ) {
168
-					$id   = Pronamic_WP_Pay_XML_Security::filter( $issuer->id );
169
-					$name = Pronamic_WP_Pay_XML_Security::filter( $issuer->name );
165
+		if (isset($response->data)) {
166
+			foreach ($response->data as $issuer) {
167
+				if (Pronamic_WP_Pay_Mollie_Methods::IDEAL === $issuer->method) {
168
+					$id   = Pronamic_WP_Pay_XML_Security::filter($issuer->id);
169
+					$name = Pronamic_WP_Pay_XML_Security::filter($issuer->name);
170 170
 
171
-					$issuers[ $id ] = $name;
171
+					$issuers[$id] = $name;
172 172
 				}
173 173
 			}
174 174
 		}
@@ -184,20 +184,20 @@  discard block
 block discarded – undo
184 184
 	 * @return array
185 185
 	 */
186 186
 	public function get_payment_methods() {
187
-		$response = $this->send_request( 'methods/', 'GET' );
187
+		$response = $this->send_request('methods/', 'GET');
188 188
 
189
-		if ( false === $response ) {
189
+		if (false === $response) {
190 190
 			return false;
191 191
 		}
192 192
 
193 193
 		$payment_methods = array();
194 194
 
195
-		if ( isset( $response->data ) ) {
196
-			foreach ( $response->data as $payment_method ) {
197
-				$id   = Pronamic_WP_Pay_XML_Security::filter( $payment_method->id );
198
-				$name = Pronamic_WP_Pay_XML_Security::filter( $payment_method->description );
195
+		if (isset($response->data)) {
196
+			foreach ($response->data as $payment_method) {
197
+				$id   = Pronamic_WP_Pay_XML_Security::filter($payment_method->id);
198
+				$name = Pronamic_WP_Pay_XML_Security::filter($payment_method->description);
199 199
 
200
-				$payment_methods[ $id ] = $name;
200
+				$payment_methods[$id] = $name;
201 201
 			}
202 202
 		}
203 203
 
@@ -213,21 +213,21 @@  discard block
 block discarded – undo
213 213
 	 * @param Pronamic_WP_Pay_PaymentData $data
214 214
 	 * @return array
215 215
 	 */
216
-	public function create_customer( $email, $name ) {
217
-		if ( empty( $email ) || empty( $name ) ) {
216
+	public function create_customer($email, $name) {
217
+		if (empty($email) || empty($name)) {
218 218
 			return false;
219 219
 		}
220 220
 
221
-		$response = $this->send_request( 'customers/', 'POST', array(
221
+		$response = $this->send_request('customers/', 'POST', array(
222 222
 			'name'  => $name,
223 223
 			'email' => $email,
224
-		), 201 );
224
+		), 201);
225 225
 
226
-		if ( false === $response ) {
226
+		if (false === $response) {
227 227
 			return false;
228 228
 		}
229 229
 
230
-		if ( ! isset( $response->id ) ) {
230
+		if ( ! isset($response->id)) {
231 231
 			return false;
232 232
 		}
233 233
 
@@ -243,18 +243,18 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @return array
245 245
 	 */
246
-	public function get_customer( $customer_id ) {
247
-		if ( empty( $customer_id ) ) {
246
+	public function get_customer($customer_id) {
247
+		if (empty($customer_id)) {
248 248
 			return false;
249 249
 		}
250 250
 
251
-		$response = $this->send_request( 'customers/' . $customer_id, 'GET', array(), 200 );
251
+		$response = $this->send_request('customers/' . $customer_id, 'GET', array(), 200);
252 252
 
253
-		if ( false === $response ) {
253
+		if (false === $response) {
254 254
 			return false;
255 255
 		}
256 256
 
257
-		if ( is_wp_error( $this->error ) ) {
257
+		if (is_wp_error($this->error)) {
258 258
 			return false;
259 259
 		}
260 260
 
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 	 *
269 269
 	 * @return array
270 270
 	 */
271
-	public function get_mandates( $customer_id ) {
272
-		if ( '' === $customer_id ) {
271
+	public function get_mandates($customer_id) {
272
+		if ('' === $customer_id) {
273 273
 			return false;
274 274
 		}
275 275
 
276
-		return $this->send_request( 'customers/' . $customer_id . '/mandates?count=250', 'GET' );
276
+		return $this->send_request('customers/' . $customer_id . '/mandates?count=250', 'GET');
277 277
 	}
278 278
 
279 279
 	/**
@@ -283,21 +283,21 @@  discard block
 block discarded – undo
283 283
 	 *
284 284
 	 * @return boolean
285 285
 	 */
286
-	public function has_valid_mandate( $customer_id, $payment_method = null ) {
287
-		$mandates = $this->get_mandates( $customer_id );
286
+	public function has_valid_mandate($customer_id, $payment_method = null) {
287
+		$mandates = $this->get_mandates($customer_id);
288 288
 
289
-		if ( ! $mandates ) {
289
+		if ( ! $mandates) {
290 290
 			return false;
291 291
 		}
292 292
 
293
-		$mollie_method = Pronamic_WP_Pay_Mollie_Methods::transform( $payment_method );
293
+		$mollie_method = Pronamic_WP_Pay_Mollie_Methods::transform($payment_method);
294 294
 
295
-		foreach ( $mandates->data as $mandate ) {
296
-			if ( $mollie_method !== $mandate->method ) {
295
+		foreach ($mandates->data as $mandate) {
296
+			if ($mollie_method !== $mandate->method) {
297 297
 				continue;
298 298
 			}
299 299
 
300
-			if ( 'valid' === $mandate->status ) {
300
+			if ('valid' === $mandate->status) {
301 301
 				return true;
302 302
 			}
303 303
 		}
@@ -312,43 +312,43 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return string
314 314
 	 */
315
-	public function get_first_valid_mandate_datetime( $customer_id, $payment_method = null ) {
316
-		$mandates = $this->get_mandates( $customer_id );
315
+	public function get_first_valid_mandate_datetime($customer_id, $payment_method = null) {
316
+		$mandates = $this->get_mandates($customer_id);
317 317
 
318
-		if ( ! $mandates ) {
318
+		if ( ! $mandates) {
319 319
 			return null;
320 320
 		}
321 321
 
322
-		$mollie_method = Pronamic_WP_Pay_Mollie_Methods::transform( $payment_method );
322
+		$mollie_method = Pronamic_WP_Pay_Mollie_Methods::transform($payment_method);
323 323
 
324
-		foreach ( $mandates->data as $mandate ) {
325
-			if ( $mollie_method !== $mandate->method ) {
324
+		foreach ($mandates->data as $mandate) {
325
+			if ($mollie_method !== $mandate->method) {
326 326
 				continue;
327 327
 			}
328 328
 
329
-			if ( 'valid' !== $mandate->status ) {
329
+			if ('valid' !== $mandate->status) {
330 330
 				continue;
331 331
 			}
332 332
 
333
-			if ( ! isset( $valid_mandates ) ) {
333
+			if ( ! isset($valid_mandates)) {
334 334
 				$valid_mandates = array();
335 335
 			}
336 336
 
337
-			$valid_mandates[ $mandate->createdDatetime ] = $mandate;
337
+			$valid_mandates[$mandate->createdDatetime] = $mandate;
338 338
 		}
339 339
 
340
-		if ( isset( $valid_mandates ) ) {
341
-			ksort( $valid_mandates );
340
+		if (isset($valid_mandates)) {
341
+			ksort($valid_mandates);
342 342
 
343
-			$mandate = array_shift( $valid_mandates );
343
+			$mandate = array_shift($valid_mandates);
344 344
 
345
-			$created = new DateTime( $mandate->createdDatetime );
345
+			$created = new DateTime($mandate->createdDatetime);
346 346
 
347 347
 			return sprintf(
348 348
 				/* translators: 1: date, 2: time */
349
-				__( '%1$s at %2$s', 'pronamic_ideal' ),
350
-				date_i18n( get_option( 'date_format' ), $created->getTimestamp() ),
351
-				date_i18n( get_option( 'time_format' ), $created->getTimestamp() )
349
+				__('%1$s at %2$s', 'pronamic_ideal'),
350
+				date_i18n(get_option('date_format'), $created->getTimestamp()),
351
+				date_i18n(get_option('time_format'), $created->getTimestamp())
352 352
 			);
353 353
 		}
354 354
 
Please login to merge, or discard this patch.
src/LocaleHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	 *
16 16
 	 * @return string|null
17 17
 	 */
18
-	public static function transform( $locale ) {
18
+	public static function transform($locale) {
19 19
 		// Supported locales
20 20
 		$supported = array(
21 21
 			Pronamic_WP_Pay_Mollie_Locales::DE,
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 		);
27 27
 
28 28
 		// Sub string
29
-		$locale = substr( $locale, 0, 2 );
29
+		$locale = substr($locale, 0, 2);
30 30
 
31 31
 		// Lower case
32
-		$locale = strtolower( $locale );
32
+		$locale = strtolower($locale);
33 33
 
34 34
 		// Is supported?
35
-		if ( in_array( $locale, $supported, true ) ) {
35
+		if (in_array($locale, $supported, true)) {
36 36
 			return $locale;
37 37
 		}
38 38
 
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
@@ -128,13 +128,13 @@
 block discarded – undo
128 128
 	 * @param string $method
129 129
 	 * @return string
130 130
 	 */
131
-	public static function transform( $payment_method ) {
132
-		if ( ! is_scalar( $payment_method ) ) {
131
+	public static function transform($payment_method) {
132
+		if ( ! is_scalar($payment_method)) {
133 133
 			return null;
134 134
 		}
135 135
 
136
-		if ( isset( self::$map[ $payment_method ] ) ) {
137
-			return self::$map[ $payment_method ];
136
+		if (isset(self::$map[$payment_method])) {
137
+			return self::$map[$payment_method];
138 138
 		}
139 139
 
140 140
 		return null;
Please login to merge, or discard this patch.
src/PaymentRequest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function get_array() {
119 119
 		$array = array(
120
-			'amount'        => number_format( $this->amount, 2, '.', '' ),
120
+			'amount'        => number_format($this->amount, 2, '.', ''),
121 121
 			'description'   => $this->description,
122 122
 			'method'        => $this->method,
123 123
 			'redirectUrl'   => $this->redirect_url,
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		/*
133 133
 		 * Array filter will remove values NULL, FALSE and empty strings ('')
134 134
 		 */
135
-		$array = array_filter( $array );
135
+		$array = array_filter($array);
136 136
 
137 137
 		return $array;
138 138
 	}
Please login to merge, or discard this patch.
src/Statuses.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,8 +68,8 @@
 block discarded – undo
68 68
 	 *
69 69
 	 * @param string $status
70 70
 	 */
71
-	public static function transform( $status ) {
72
-		switch ( $status ) {
71
+	public static function transform($status) {
72
+		switch ($status) {
73 73
 			case self::PENDING:
74 74
 			case self::OPEN:
75 75
 				return Pronamic_WP_Pay_Statuses::OPEN;
Please login to merge, or discard this patch.
src/ConfigFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@
 block discarded – undo
11 11
  * @since 1.0.0
12 12
  */
13 13
 class Pronamic_WP_Pay_Gateways_Mollie_ConfigFactory extends Pronamic_WP_Pay_GatewayConfigFactory {
14
-	public function get_config( $post_id ) {
14
+	public function get_config($post_id) {
15 15
 		$config = new Pronamic_WP_Pay_Gateways_Mollie_Config();
16 16
 
17
-		$config->api_key = get_post_meta( $post_id, '_pronamic_gateway_mollie_api_key', true );
18
-		$config->mode    = get_post_meta( $post_id, '_pronamic_gateway_mode', true );
17
+		$config->api_key = get_post_meta($post_id, '_pronamic_gateway_mollie_api_key', true);
18
+		$config->mode    = get_post_meta($post_id, '_pronamic_gateway_mode', true);
19 19
 
20 20
 		return $config;
21 21
 	}
Please login to merge, or discard this patch.
src/Integration.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -25,22 +25,22 @@  discard block
 block discarded – undo
25 25
 		$this->id          = 'mollie';
26 26
 		$this->name        = 'Mollie';
27 27
 		$this->url         = 'http://www.mollie.com/en/';
28
-		$this->product_url = __( 'https://www.mollie.com/en/pricing', 'pronamic_ideal' );
28
+		$this->product_url = __('https://www.mollie.com/en/pricing', 'pronamic_ideal');
29 29
 		$this->provider    = 'mollie';
30 30
 
31 31
 		// Actions
32
-		$function = array( 'Pronamic_WP_Pay_Gateways_Mollie_Listener', 'listen' );
32
+		$function = array('Pronamic_WP_Pay_Gateways_Mollie_Listener', 'listen');
33 33
 
34
-		if ( ! has_action( 'wp_loaded', $function ) ) {
35
-			add_action( 'wp_loaded', $function );
34
+		if ( ! has_action('wp_loaded', $function)) {
35
+			add_action('wp_loaded', $function);
36 36
 		}
37 37
 
38
-		if ( is_admin() ) {
39
-			add_action( 'show_user_profile', array( $this, 'user_profile' ) );
40
-			add_action( 'edit_user_profile', array( $this, 'user_profile' ) );
38
+		if (is_admin()) {
39
+			add_action('show_user_profile', array($this, 'user_profile'));
40
+			add_action('edit_user_profile', array($this, 'user_profile'));
41 41
 		}
42 42
 
43
-		add_filter( 'pronamic_payment_provider_url_mollie', array( $this, 'payment_provider_url' ), 10, 2 );
43
+		add_filter('pronamic_payment_provider_url_mollie', array($this, 'payment_provider_url'), 10, 2);
44 44
 	}
45 45
 
46 46
 	public function get_config_factory_class() {
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @since 1.1.6
73 73
 	 * @see https://github.com/WordPress/WordPress/blob/4.5.2/wp-admin/user-edit.php#L578-L600
74 74
 	 */
75
-	public function user_profile( $user ) {
76
-		include dirname( __FILE__ ) . '/../views/html-admin-user-profile.php';
75
+	public function user_profile($user) {
76
+		include dirname(__FILE__) . '/../views/html-admin-user-profile.php';
77 77
 	}
78 78
 
79 79
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param Payment $payment
84 84
 	 * @return string
85 85
 	 */
86
-	public function payment_provider_url( $url, $payment ) {
86
+	public function payment_provider_url($url, $payment) {
87 87
 		return sprintf(
88 88
 			'https://www.mollie.com/dashboard/payments/%s',
89 89
 			$payment->get_transaction_id()
Please login to merge, or discard this patch.
src/Gateway.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param Pronamic_WP_Pay_Gateways_Mollie_Config $config
34 34
 	 */
35
-	public function __construct( Pronamic_WP_Pay_Gateways_Mollie_Config $config ) {
36
-		parent::__construct( $config );
35
+	public function __construct(Pronamic_WP_Pay_Gateways_Mollie_Config $config) {
36
+		parent::__construct($config);
37 37
 
38 38
 		$this->supports = array(
39 39
 			'payment_status_request',
@@ -42,15 +42,15 @@  discard block
 block discarded – undo
42 42
 			'recurring',
43 43
 		);
44 44
 
45
-		$this->set_method( Pronamic_WP_Pay_Gateway::METHOD_HTTP_REDIRECT );
46
-		$this->set_has_feedback( true );
47
-		$this->set_amount_minimum( 1.20 );
48
-		$this->set_slug( self::SLUG );
45
+		$this->set_method(Pronamic_WP_Pay_Gateway::METHOD_HTTP_REDIRECT);
46
+		$this->set_has_feedback(true);
47
+		$this->set_amount_minimum(1.20);
48
+		$this->set_slug(self::SLUG);
49 49
 
50
-		$this->client = new Pronamic_WP_Pay_Gateways_Mollie_Client( $config->api_key );
51
-		$this->client->set_mode( $config->mode );
50
+		$this->client = new Pronamic_WP_Pay_Gateways_Mollie_Client($config->api_key);
51
+		$this->client->set_mode($config->mode);
52 52
 
53
-		if ( 'test' === $config->mode ) {
53
+		if ('test' === $config->mode) {
54 54
 			$this->meta_key_customer_id = '_pronamic_pay_mollie_customer_id_test';
55 55
 		}
56 56
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 		$result = $this->client->get_issuers();
69 69
 
70
-		if ( ! $result ) {
70
+		if ( ! $result) {
71 71
 			$this->error = $this->client->get_error();
72 72
 
73 73
 			return $groups;
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 	/////////////////////////////////////////////////
84 84
 
85 85
 	public function get_issuer_field() {
86
-		if ( Pronamic_WP_Pay_PaymentMethods::IDEAL === $this->get_payment_method() ) {
86
+		if (Pronamic_WP_Pay_PaymentMethods::IDEAL === $this->get_payment_method()) {
87 87
 			return array(
88 88
 				'id'       => 'pronamic_ideal_issuer_id',
89 89
 				'name'     => 'pronamic_ideal_issuer_id',
90
-				'label'    => __( 'Choose your bank', 'pronamic_ideal' ),
90
+				'label'    => __('Choose your bank', 'pronamic_ideal'),
91 91
 				'required' => true,
92 92
 				'type'     => 'select',
93 93
 				'choices'  => $this->get_transient_issuers(),
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 	 * @param int $user_id
102 102
 	 * @return string
103 103
 	 */
104
-	private function get_customer_id_by_wp_user_id( $user_id ) {
105
-		return get_user_meta( $user_id, $this->meta_key_customer_id, true );
104
+	private function get_customer_id_by_wp_user_id($user_id) {
105
+		return get_user_meta($user_id, $this->meta_key_customer_id, true);
106 106
 	}
107 107
 
108
-	private function update_wp_user_customer_id( $user_id, $customer_id ) {
109
-		update_user_meta( $user_id, $this->meta_key_customer_id, $customer_id );
108
+	private function update_wp_user_customer_id($user_id, $customer_id) {
109
+		update_user_meta($user_id, $this->meta_key_customer_id, $customer_id);
110 110
 	}
111 111
 
112 112
 	/**
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @see Pronamic_WP_Pay_Gateway::has_valid_mandate()
116 116
 	 */
117
-	public function has_valid_mandate( $payment_method = '' ) {
118
-		return $this->client->has_valid_mandate( $this->get_customer_id_by_wp_user_id( get_current_user_id() ), $payment_method );
117
+	public function has_valid_mandate($payment_method = '') {
118
+		return $this->client->has_valid_mandate($this->get_customer_id_by_wp_user_id(get_current_user_id()), $payment_method);
119 119
 	}
120 120
 
121 121
 	/**
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @see Pronamic_WP_Pay_Gateway::has_valid_mandate()
125 125
 	 */
126
-	public function get_first_valid_mandate_datetime( $payment_method = '' ) {
127
-		return $this->client->get_first_valid_mandate_datetime( $this->get_customer_id_by_wp_user_id( get_current_user_id() ), $payment_method );
126
+	public function get_first_valid_mandate_datetime($payment_method = '') {
127
+		return $this->client->get_first_valid_mandate_datetime($this->get_customer_id_by_wp_user_id(get_current_user_id()), $payment_method);
128 128
 	}
129 129
 
130 130
 	/////////////////////////////////////////////////
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
 		$result = $this->client->get_payment_methods();
141 141
 
142
-		if ( ! $result ) {
142
+		if ( ! $result) {
143 143
 			$this->error = $this->client->get_error();
144 144
 
145 145
 			return $groups;
@@ -184,19 +184,19 @@  discard block
 block discarded – undo
184 184
 	 * @return string
185 185
 	 */
186 186
 	private function get_webhook_url() {
187
-		$url = home_url( '/' );
187
+		$url = home_url('/');
188 188
 
189
-		$host = parse_url( $url, PHP_URL_HOST );
189
+		$host = parse_url($url, PHP_URL_HOST);
190 190
 
191
-		if ( 'localhost' === $host ) {
191
+		if ('localhost' === $host) {
192 192
 			// Mollie doesn't allow localhost
193 193
 			return null;
194
-		} elseif ( '.dev' === substr( $host, -4 ) ) {
194
+		} elseif ('.dev' === substr($host, -4)) {
195 195
 			// Mollie doesn't allow the TLD .dev
196 196
 			return null;
197 197
 		}
198 198
 
199
-		$url = add_query_arg( 'mollie_webhook', '', $url );
199
+		$url = add_query_arg('mollie_webhook', '', $url);
200 200
 
201 201
 		return $url;
202 202
 	}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @see Pronamic_WP_Pay_Gateway::start()
210 210
 	 */
211
-	public function start( Pronamic_Pay_Payment $payment ) {
211
+	public function start(Pronamic_Pay_Payment $payment) {
212 212
 		$request = new Pronamic_WP_Pay_Gateways_Mollie_PaymentRequest();
213 213
 
214 214
 		$payment_method = $payment->get_method();
@@ -217,90 +217,90 @@  discard block
 block discarded – undo
217 217
 		$request->description  = $payment->get_description();
218 218
 		$request->redirect_url = $payment->get_return_url();
219 219
 		$request->webhook_url  = $this->get_webhook_url();
220
-		$request->locale       = Pronamic_WP_Pay_Mollie_LocaleHelper::transform( $payment->get_language() );
221
-		$request->method       = Pronamic_WP_Pay_Mollie_Methods::transform( $payment_method );
220
+		$request->locale       = Pronamic_WP_Pay_Mollie_LocaleHelper::transform($payment->get_language());
221
+		$request->method       = Pronamic_WP_Pay_Mollie_Methods::transform($payment_method);
222 222
 
223
-		if ( empty( $request->method ) && ! empty( $payment_method ) ) {
223
+		if (empty($request->method) && ! empty($payment_method)) {
224 224
 			// Leap of faith if the WordPress payment method could not transform to a Mollie method?
225 225
 			$request->method = $payment_method;
226 226
 		}
227 227
 
228 228
 		// Customer ID
229 229
 		$user_id     = $payment->post->post_author;
230
-		$customer_id = $this->get_customer_id_by_wp_user_id( $user_id );
230
+		$customer_id = $this->get_customer_id_by_wp_user_id($user_id);
231 231
 
232
-		if ( ! $payment->get_recurring() && ( empty( $customer_id ) || ! $this->client->get_customer( $customer_id ) ) ) {
233
-			$customer_id = $this->client->create_customer( $payment->get_email(), $payment->get_customer_name() );
232
+		if ( ! $payment->get_recurring() && (empty($customer_id) || ! $this->client->get_customer($customer_id))) {
233
+			$customer_id = $this->client->create_customer($payment->get_email(), $payment->get_customer_name());
234 234
 
235
-			if ( '0' !== $user_id && $customer_id ) {
236
-				$this->update_wp_user_customer_id( $user_id, $customer_id );
235
+			if ('0' !== $user_id && $customer_id) {
236
+				$this->update_wp_user_customer_id($user_id, $customer_id);
237 237
 			}
238 238
 		}
239 239
 
240
-		$payment->set_meta( 'mollie_customer_id', $customer_id );
240
+		$payment->set_meta('mollie_customer_id', $customer_id);
241 241
 
242 242
 		// Subscriptions
243 243
 		$subscription = $payment->get_subscription();
244 244
 
245
-		if ( $subscription && Pronamic_WP_Pay_PaymentMethods::is_recurring_method( $payment_method ) ) {
245
+		if ($subscription && Pronamic_WP_Pay_PaymentMethods::is_recurring_method($payment_method)) {
246 246
 			$request->recurring_type = Pronamic_WP_Pay_Mollie_Recurring::RECURRING;
247 247
 
248
-			if ( Pronamic_WP_Pay_PaymentMethods::is_direct_debit_method( $payment_method ) ) {
248
+			if (Pronamic_WP_Pay_PaymentMethods::is_direct_debit_method($payment_method)) {
249 249
 				// Use direct debit payment method for recurring payments if not using credit card
250 250
 				$request->method = Pronamic_WP_Pay_Mollie_Methods::DIRECT_DEBIT;
251 251
 			}
252 252
 
253
-			if ( ! $customer_id && $subscription->has_valid_payment() ) {
253
+			if ( ! $customer_id && $subscription->has_valid_payment()) {
254 254
 				// Get customer ID from first payment
255 255
 				$first       = $subscription->get_first_payment();
256
-				$customer_id = $first->get_meta( 'mollie_customer_id' );
256
+				$customer_id = $first->get_meta('mollie_customer_id');
257 257
 
258
-				$payment->set_meta( 'mollie_customer_id', $customer_id );
258
+				$payment->set_meta('mollie_customer_id', $customer_id);
259 259
 			}
260 260
 
261
-			if ( ! $payment->get_recurring() ) {
261
+			if ( ! $payment->get_recurring()) {
262 262
 				// First payment without valid mandate
263 263
 				$request->recurring_type = Pronamic_WP_Pay_Mollie_Recurring::FIRST;
264 264
 
265
-				if ( Pronamic_WP_Pay_PaymentMethods::is_direct_debit_method( $payment_method ) ) {
265
+				if (Pronamic_WP_Pay_PaymentMethods::is_direct_debit_method($payment_method)) {
266 266
 					// Use corresponding first payment method for direct debit payment method
267
-					$first_method    = Pronamic_WP_Pay_PaymentMethods::get_first_payment_method( $payment_method );
268
-					$request->method = Pronamic_WP_Pay_Mollie_Methods::transform( $first_method );
267
+					$first_method    = Pronamic_WP_Pay_PaymentMethods::get_first_payment_method($payment_method);
268
+					$request->method = Pronamic_WP_Pay_Mollie_Methods::transform($first_method);
269 269
 				}
270 270
 			}
271 271
 
272
-			if ( Pronamic_WP_Pay_Mollie_Recurring::RECURRING === $request->recurring_type ) {
272
+			if (Pronamic_WP_Pay_Mollie_Recurring::RECURRING === $request->recurring_type) {
273 273
 				// Recurring payment
274
-				$payment->set_action_url( $payment->get_return_url() );
274
+				$payment->set_action_url($payment->get_return_url());
275 275
 
276
-				if ( $subscription->has_valid_payment() ) {
276
+				if ($subscription->has_valid_payment()) {
277 277
 					// Use subscription amount if this is not the initial payment.
278 278
 					$payment->amount = $subscription->get_amount();
279 279
 				}
280 280
 			}
281 281
 		}
282 282
 
283
-		if ( Pronamic_WP_Pay_Mollie_Methods::IDEAL === $request->method ) {
283
+		if (Pronamic_WP_Pay_Mollie_Methods::IDEAL === $request->method) {
284 284
 			// If payment method is iDEAL we set the user chosen issuer ID.
285 285
 			$request->issuer = $payment->get_issuer();
286 286
 		}
287 287
 
288 288
 		$request->customer_id = $customer_id;
289 289
 
290
-		$result = $this->client->create_payment( $request );
290
+		$result = $this->client->create_payment($request);
291 291
 
292
-		if ( ! $result ) {
293
-			if ( false !== $subscription ) {
292
+		if ( ! $result) {
293
+			if (false !== $subscription) {
294 294
 				// Payment for a subscription
295 295
 
296
-				if ( ! $payment->get_recurring() ) {
296
+				if ( ! $payment->get_recurring()) {
297 297
 					// First payment
298 298
 
299 299
 					// Cancel subscription to prevent unwanted recurring payments in the future,
300 300
 					// when a valid customer ID might be set for the user.
301
-					$subscription->update_status( Pronamic_WP_Pay_Statuses::CANCELLED );
301
+					$subscription->update_status(Pronamic_WP_Pay_Statuses::CANCELLED);
302 302
 				} else {
303
-					$subscription->set_status( Pronamic_WP_Pay_Statuses::FAILURE );
303
+					$subscription->set_status(Pronamic_WP_Pay_Statuses::FAILURE);
304 304
 				}
305 305
 			}
306 306
 
@@ -309,17 +309,17 @@  discard block
 block discarded – undo
309 309
 			return;
310 310
 		}
311 311
 
312
-		if ( $subscription && Pronamic_WP_Pay_Mollie_Recurring::RECURRING === $request->recurring_type ) {
313
-			if ( ! ( $payment->get_recurring() && Pronamic_WP_Pay_Statuses::CANCELLED === $subscription->get_status() ) ) {
312
+		if ($subscription && Pronamic_WP_Pay_Mollie_Recurring::RECURRING === $request->recurring_type) {
313
+			if ( ! ($payment->get_recurring() && Pronamic_WP_Pay_Statuses::CANCELLED === $subscription->get_status())) {
314 314
 				// Update subscription status if this is not a recurring payment for a cancelled subscription.
315
-				$subscription->update_status( Pronamic_WP_Pay_Mollie_Statuses::transform( $result->status ) );
315
+				$subscription->update_status(Pronamic_WP_Pay_Mollie_Statuses::transform($result->status));
316 316
 			}
317 317
 		}
318 318
 
319
-		$payment->set_transaction_id( $result->id );
319
+		$payment->set_transaction_id($result->id);
320 320
 
321
-		if ( '' === $payment->get_action_url() ) {
322
-			$payment->set_action_url( $result->links->paymentUrl );
321
+		if ('' === $payment->get_action_url()) {
322
+			$payment->set_action_url($result->links->paymentUrl);
323 323
 		}
324 324
 	}
325 325
 
@@ -330,17 +330,17 @@  discard block
 block discarded – undo
330 330
 	 *
331 331
 	 * @param Pronamic_Pay_Payment $payment
332 332
 	 */
333
-	public function update_status( Pronamic_Pay_Payment $payment ) {
334
-		$mollie_payment = $this->client->get_payment( $payment->get_transaction_id() );
333
+	public function update_status(Pronamic_Pay_Payment $payment) {
334
+		$mollie_payment = $this->client->get_payment($payment->get_transaction_id());
335 335
 
336
-		if ( ! $mollie_payment ) {
337
-			$payment->set_status( Pronamic_WP_Pay_Statuses::FAILURE );
336
+		if ( ! $mollie_payment) {
337
+			$payment->set_status(Pronamic_WP_Pay_Statuses::FAILURE);
338 338
 
339
-			if ( '' !== $payment->get_transaction_id() ) {
339
+			if ('' !== $payment->get_transaction_id()) {
340 340
 				// Use payment status as subscription status only if there's a transaction ID
341 341
 
342 342
 				$subscription = $payment->get_subscription();
343
-				$subscription->set_status( Pronamic_WP_Pay_Statuses::FAILURE );
343
+				$subscription->set_status(Pronamic_WP_Pay_Statuses::FAILURE);
344 344
 			}
345 345
 
346 346
 			$this->error = $this->client->get_error();
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 			return;
349 349
 		}
350 350
 
351
-		$status = Pronamic_WP_Pay_Mollie_Statuses::transform( $mollie_payment->status );
351
+		$status = Pronamic_WP_Pay_Mollie_Statuses::transform($mollie_payment->status);
352 352
 
353
-		$payment->set_status( $status );
353
+		$payment->set_status($status);
354 354
 
355 355
 		$subscription = $payment->get_subscription();
356 356
 
357
-		if ( $subscription && '' === $subscription->get_transaction_id() ) {
357
+		if ($subscription && '' === $subscription->get_transaction_id()) {
358 358
 			// First payment or non-subscription recurring payment,
359 359
 			// use payment status for subscription too.
360 360
 
@@ -366,33 +366,33 @@  discard block
 block discarded – undo
366 366
 				Pronamic_WP_Pay_Statuses::FAILURE,
367 367
 			);
368 368
 
369
-			if ( ! $payment->get_recurring() && in_array( $new_status, $failed_statuses, true ) ) {
369
+			if ( ! $payment->get_recurring() && in_array($new_status, $failed_statuses, true)) {
370 370
 				// Cancel subscription if this is the first payment and payment failed/expired,
371 371
 				// to prevent creating unwanted recurring payments in the future.
372 372
 
373
-				$subscription->update_status( Pronamic_WP_Pay_Statuses::CANCELLED );
374
-			} elseif ( ! ( $payment->get_recurring() && Pronamic_WP_Pay_Statuses::CANCELLED === $subscription->get_status() ) ) {
373
+				$subscription->update_status(Pronamic_WP_Pay_Statuses::CANCELLED);
374
+			} elseif ( ! ($payment->get_recurring() && Pronamic_WP_Pay_Statuses::CANCELLED === $subscription->get_status())) {
375 375
 				// Update subscription status if this is not a recurring payment for a cancelled subscription.
376 376
 
377
-				$subscription->update_status( $new_status );
377
+				$subscription->update_status($new_status);
378 378
 			}
379 379
 		}
380 380
 
381
-		if ( isset( $mollie_payment->details ) ) {
381
+		if (isset($mollie_payment->details)) {
382 382
 			$details = $mollie_payment->details;
383 383
 
384
-			if ( isset( $details->consumerName ) ) {
385
-				$payment->set_consumer_name( $details->consumerName );
386
-			} elseif ( isset( $details->cardHolder ) ) {
387
-				$payment->set_consumer_name( $details->cardHolder );
384
+			if (isset($details->consumerName)) {
385
+				$payment->set_consumer_name($details->consumerName);
386
+			} elseif (isset($details->cardHolder)) {
387
+				$payment->set_consumer_name($details->cardHolder);
388 388
 			}
389 389
 
390
-			if ( isset( $details->consumerAccount ) ) {
391
-				$payment->set_consumer_iban( $details->consumerAccount );
390
+			if (isset($details->consumerAccount)) {
391
+				$payment->set_consumer_iban($details->consumerAccount);
392 392
 			}
393 393
 
394
-			if ( isset( $details->consumerBic ) ) {
395
-				$payment->set_consumer_bic( $details->consumerBic );
394
+			if (isset($details->consumerBic)) {
395
+				$payment->set_consumer_bic($details->consumerBic);
396 396
 			}
397 397
 		}
398 398
 	}
Please login to merge, or discard this patch.