Failed Conditions
Push — feature/post-pay ( d719f9 )
by Reüel
08:19
created
src/Address.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @param string $first_name First name.
106 106
 	 */
107
-	public function set_first_name( $first_name ) {
107
+	public function set_first_name($first_name) {
108 108
 		$this->first_name = $first_name;
109 109
 	}
110 110
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @param string $middle_name Middle name.
124 124
 	 */
125
-	public function set_middle_name( $middle_name ) {
125
+	public function set_middle_name($middle_name) {
126 126
 		$this->middle_name = $middle_name;
127 127
 	}
128 128
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 *
141 141
 	 * @param string $last_name Last name.
142 142
 	 */
143
-	public function set_last_name( $last_name ) {
143
+	public function set_last_name($last_name) {
144 144
 		$this->last_name = $last_name;
145 145
 	}
146 146
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 *
159 159
 	 * @param string $street Street.
160 160
 	 */
161
-	public function set_street( $street ) {
161
+	public function set_street($street) {
162 162
 		$this->street = $street;
163 163
 	}
164 164
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @param string $house_number House number.
178 178
 	 */
179
-	public function set_house_number( $house_number ) {
179
+	public function set_house_number($house_number) {
180 180
 		$this->house_number = $house_number;
181 181
 	}
182 182
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @param string $house_number_addition House number addition.
196 196
 	 */
197
-	public function set_house_number_addition( $house_number_addition ) {
197
+	public function set_house_number_addition($house_number_addition) {
198 198
 		$this->house_number_addition = $house_number_addition;
199 199
 	}
200 200
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @param string $postal_code Postal code.
214 214
 	 */
215
-	public function set_postal_code( $postal_code ) {
215
+	public function set_postal_code($postal_code) {
216 216
 		$this->postal_code = $postal_code;
217 217
 	}
218 218
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @param string $city City.
232 232
 	 */
233
-	public function set_city( $city ) {
233
+	public function set_city($city) {
234 234
 		$this->city = $city;
235 235
 	}
236 236
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @param string $country_code Country code.
250 250
 	 */
251
-	public function set_country_code( $country_code ) {
251
+	public function set_country_code($country_code) {
252 252
 		$this->country_code = $country_code;
253 253
 	}
254 254
 
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 			'countryCode'         => $this->country_code,
271 271
 		);
272 272
 
273
-		$data = array_filter( $data );
273
+		$data = array_filter($data);
274 274
 
275
-		if ( empty( $data ) ) {
275
+		if (empty($data)) {
276 276
 			return null;
277 277
 		}
278 278
 
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
 		);
295 295
 
296 296
 		// Optional house number fields.
297
-		if ( null !== $this->house_number ) {
297
+		if (null !== $this->house_number) {
298 298
 			$data[] = $this->house_number;
299 299
 		}
300 300
 
301
-		if ( null !== $this->house_number_addition ) {
301
+		if (null !== $this->house_number_addition) {
302 302
 			$data[] = $this->house_number_addition;
303 303
 		}
304 304
 
Please login to merge, or discard this patch.
src/Money.php 1 patch
Spacing   +10 added lines, -10 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,19 +108,19 @@  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
 }
Please login to merge, or discard this patch.
src/Order.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -154,8 +154,8 @@  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->timestamp           = date( DATE_ATOM );
157
+	public function __construct($merchant_order_id, $amount, $merchant_return_url) {
158
+		$this->timestamp           = date(DATE_ATOM);
159 159
 		$this->merchant_order_id   = $merchant_order_id;
160 160
 		$this->amount              = $amount;
161 161
 		$this->merchant_return_url = $merchant_return_url;
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @param string $description Description.
168 168
 	 */
169
-	public function set_description( $description ) {
169
+	public function set_description($description) {
170 170
 		$this->description = $description;
171 171
 	}
172 172
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @param string $language Language.
177 177
 	 */
178
-	public function set_language( $language ) {
178
+	public function set_language($language) {
179 179
 		$this->language = $language;
180 180
 	}
181 181
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 *
185 185
 	 * @param string|null $payment_brand Payment brand.
186 186
 	 */
187
-	public function set_payment_brand( $payment_brand ) {
187
+	public function set_payment_brand($payment_brand) {
188 188
 		$this->payment_brand = $payment_brand;
189 189
 	}
190 190
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @param string $payment_brand_force Payment brand force.
195 195
 	 */
196
-	public function set_payment_brand_force( $payment_brand_force ) {
196
+	public function set_payment_brand_force($payment_brand_force) {
197 197
 		$this->payment_brand_force = $payment_brand_force;
198 198
 	}
199 199
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return void
206 206
 	 */
207
-	public function set_order_items( OrderItems $order_items ) {
207
+	public function set_order_items(OrderItems $order_items) {
208 208
 		$this->order_items = $order_items;
209 209
 	}
210 210
 
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 	 *
216 216
 	 * @return void
217 217
 	 */
218
-	public function set_items( Items $items ) {
218
+	public function set_items(Items $items) {
219 219
 		$order_items = new OrderItems();
220 220
 
221 221
 		$items = $items->getIterator();
222 222
 
223
-		while ( $items->valid() ) {
223
+		while ($items->valid()) {
224 224
 			$item = $items->current();
225 225
 
226 226
 			// New order item.
@@ -231,19 +231,19 @@  discard block
 block discarded – undo
231 231
 					'quantity' => $item->get_quantity(),
232 232
 					'amount'   => new Money(
233 233
 						$this->amount->get_currency(),
234
-						Util::amount_to_cents( $item->get_price() )
234
+						Util::amount_to_cents($item->get_price())
235 235
 					),
236 236
 					'category' => ProductCategories::DIGITAL,
237 237
 				)
238 238
 			);
239 239
 
240 240
 			// Add order item.
241
-			$order_items->add_item( $order_item );
241
+			$order_items->add_item($order_item);
242 242
 
243 243
 			$items->next();
244 244
 		}
245 245
 
246
-		$this->set_order_items( $order_items );
246
+		$this->set_order_items($order_items);
247 247
 	}
248 248
 
249 249
 	/**
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @param Address $shipping_detail Shipping address details.
253 253
 	 */
254
-	public function set_shipping_detail( $shipping_detail ) {
254
+	public function set_shipping_detail($shipping_detail) {
255 255
 		$this->billing_detail = $shipping_detail;
256 256
 	}
257 257
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 *
261 261
 	 * @param Address $billing_detail Billing address details.
262 262
 	 */
263
-	public function set_billing_detail( $billing_detail ) {
263
+	public function set_billing_detail($billing_detail) {
264 264
 		$this->billing_detail = $billing_detail;
265 265
 	}
266 266
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @param CustomerInformation $customer_information Customer information.
271 271
 	 */
272
-	public function set_customer_information( $customer_information ) {
272
+	public function set_customer_information($customer_information) {
273 273
 		$this->customer_information = $customer_information;
274 274
 	}
275 275
 
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
 			'description'     => $this->description,
286 286
 		);
287 287
 
288
-		if ( $this->order_items instanceof OrderItems ) {
288
+		if ($this->order_items instanceof OrderItems) {
289 289
 			$data['orderItems'] = $this->order_items->get_json();
290 290
 		}
291 291
 
292 292
 		$data['amount'] = $this->amount->get_json();
293 293
 
294
-		if ( $this->shipping_detail instanceof Address ) {
294
+		if ($this->shipping_detail instanceof Address) {
295 295
 			$data['shippingDetail'] = $this->shipping_detail->get_json();
296 296
 		}
297 297
 
298
-		if ( $this->billing_detail instanceof Address ) {
298
+		if ($this->billing_detail instanceof Address) {
299 299
 			$data['billingDetail'] = $this->billing_detail->get_json();
300 300
 		}
301 301
 
302
-		if ( $this->customer_information instanceof CustomerInformation ) {
302
+		if ($this->customer_information instanceof CustomerInformation) {
303 303
 			$data['customerInformation'] = $this->customer_information->get_json();
304 304
 		}
305 305
 
@@ -334,19 +334,19 @@  discard block
 block discarded – undo
334 334
 		$customer_information = null;
335 335
 		$billing_detail       = null;
336 336
 
337
-		if ( $this->order_items instanceof OrderItems ) {
337
+		if ($this->order_items instanceof OrderItems) {
338 338
 			$order_items = $this->order_items->get_signature_data();
339 339
 		}
340 340
 
341
-		if ( $this->shipping_detail instanceof Address ) {
341
+		if ($this->shipping_detail instanceof Address) {
342 342
 			$shipping_detail = $this->shipping_detail->get_signature_data();
343 343
 		}
344 344
 
345
-		if ( $this->customer_information instanceof CustomerInformation ) {
345
+		if ($this->customer_information instanceof CustomerInformation) {
346 346
 			$customer_information = $this->customer_information->get_signature_data();
347 347
 		}
348 348
 
349
-		if ( $this->billing_detail instanceof Address ) {
349
+		if ($this->billing_detail instanceof Address) {
350 350
 			$billing_detail = $this->billing_detail->get_signature_data();
351 351
 		}
352 352
 
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 		);
361 361
 
362 362
 		// Remove empty optional fields.
363
-		$optional = array_filter( $optional );
363
+		$optional = array_filter($optional);
364 364
 
365
-		return array_merge( $fields, $optional );
365
+		return array_merge($fields, $optional);
366 366
 	}
367 367
 }
Please login to merge, or discard this patch.
src/OrderItems.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @param array $items Order items.
32 32
 	 */
33
-	public function __construct( $items = null ) {
34
-		if ( is_array( $items ) ) {
35
-			foreach ( $items as $item ) {
36
-				$this->add_item( $item );
33
+	public function __construct($items = null) {
34
+		if (is_array($items)) {
35
+			foreach ($items as $item) {
36
+				$this->add_item($item);
37 37
 			}
38 38
 		}
39 39
 	}
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return void
47 47
 	 */
48
-	public function add_item( $order_item ) {
49
-		if ( ! ( $order_item instanceof OrderItem ) ) {
50
-			$order_item = new OrderItem( $order_item );
48
+	public function add_item($order_item) {
49
+		if ( ! ($order_item instanceof OrderItem)) {
50
+			$order_item = new OrderItem($order_item);
51 51
 		}
52 52
 
53 53
 		$this->order_items[] = $order_item;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 		$items = $this->get_order_items();
74 74
 
75
-		foreach ( $items as $item ) {
75
+		foreach ($items as $item) {
76 76
 			$amount = $item->get_amount();
77 77
 			$tax    = $item->get_tax();
78 78
 
@@ -81,20 +81,20 @@  discard block
 block discarded – undo
81 81
 				'name'        => $item->get_name(),
82 82
 				'description' => $item->get_description(),
83 83
 				'quantity'    => $item->get_quantity(),
84
-				'amount'      => ( $amount instanceof Money ) ? $amount->get_json() : null,
85
-				'tax'         => ( $tax instanceof Money ) ? $tax->get_json() : null,
84
+				'amount'      => ($amount instanceof Money) ? $amount->get_json() : null,
85
+				'tax'         => ($tax instanceof Money) ? $tax->get_json() : null,
86 86
 				'category'    => $item->get_category(),
87 87
 				'vatCategory' => $item->get_vat_category(),
88 88
 			);
89 89
 
90
-			$item_data = array_filter( $item_data );
90
+			$item_data = array_filter($item_data);
91 91
 
92
-			if ( ! empty( $item_data ) ) {
92
+			if ( ! empty($item_data)) {
93 93
 				$data[] = (object) $item_data;
94 94
 			}
95 95
 		}
96 96
 
97
-		if ( empty( $data ) ) {
97
+		if (empty($data)) {
98 98
 			return null;
99 99
 		}
100 100
 
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 
112 112
 		$order_items = $this->get_order_items();
113 113
 
114
-		foreach ( $order_items as $item ) {
114
+		foreach ($order_items as $item) {
115 115
 			// Optional ID.
116 116
 			$item_id = $item->get_id();
117 117
 
118
-			if ( ! empty( $item_id ) ) {
118
+			if ( ! empty($item_id)) {
119 119
 				$data[] = $item_id;
120 120
 			}
121 121
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			// Required tax field.
130 130
 			$tax = $item->get_tax();
131 131
 
132
-			if ( empty( $tax ) ) {
132
+			if (empty($tax)) {
133 133
 				$data[] = $tax;
134 134
 			} else {
135 135
 				$data[] = $tax->get_currency();
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 			// Optional VAT category.
143 143
 			$vat_category = $item->get_vat_category();
144 144
 
145
-			if ( ! empty( $vat_category ) ) {
145
+			if ( ! empty($vat_category)) {
146 146
 				$data[] = $vat_category;
147 147
 			}
148 148
 		}
Please login to merge, or discard this patch.
src/PaymentBrands.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -113,13 +113,13 @@
 block discarded – undo
113 113
 	 *
114 114
 	 * @return string|null
115 115
 	 */
116
-	public static function transform( $payment_method, $default = null ) {
117
-		if ( ! is_scalar( $payment_method ) ) {
116
+	public static function transform($payment_method, $default = null) {
117
+		if ( ! is_scalar($payment_method)) {
118 118
 			return null;
119 119
 		}
120 120
 
121
-		if ( isset( self::$map[ $payment_method ] ) ) {
122
-			return self::$map[ $payment_method ];
121
+		if (isset(self::$map[$payment_method])) {
122
+			return self::$map[$payment_method];
123 123
 		}
124 124
 
125 125
 		return $default;
Please login to merge, or discard this patch.
src/Gateway.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -35,23 +35,23 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param Config $config Config.
37 37
 	 */
38
-	public function __construct( Config $config ) {
39
-		parent::__construct( $config );
38
+	public function __construct(Config $config) {
39
+		parent::__construct($config);
40 40
 
41
-		$this->set_method( self::METHOD_HTTP_REDIRECT );
41
+		$this->set_method(self::METHOD_HTTP_REDIRECT);
42 42
 
43 43
 		// Client.
44 44
 		$this->client = new Client();
45 45
 
46 46
 		$url = Client::URL_PRODUCTION;
47 47
 
48
-		if ( self::MODE_TEST === $config->mode ) {
48
+		if (self::MODE_TEST === $config->mode) {
49 49
 			$url = Client::URL_SANDBOX;
50 50
 		}
51 51
 
52
-		$this->client->set_url( $url );
53
-		$this->client->set_refresh_token( $config->refresh_token );
54
-		$this->client->set_signing_key( $config->signing_key );
52
+		$this->client->set_url($url);
53
+		$this->client->set_refresh_token($config->refresh_token);
54
+		$this->client->set_signing_key($config->signing_key);
55 55
 	}
56 56
 
57 57
 	/**
@@ -78,87 +78,87 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @param Payment $payment Payment.
80 80
 	 */
81
-	public function start( Payment $payment ) {
81
+	public function start(Payment $payment) {
82 82
 		// Merchant order ID.
83
-		$merchant_order_id = $payment->format_string( $this->config->order_id );
83
+		$merchant_order_id = $payment->format_string($this->config->order_id);
84 84
 
85
-		$payment->set_meta( 'omnikassa_2_merchant_order_id', $merchant_order_id );
85
+		$payment->set_meta('omnikassa_2_merchant_order_id', $merchant_order_id);
86 86
 
87 87
 		// Billing and shipping details.
88 88
 		$shipping_address = $payment->get_shipping_address();
89 89
 		$billing_address  = $payment->get_billing_address();
90 90
 
91 91
 		$shipping_detail = new Address();
92
-		$shipping_detail->set_first_name( $shipping_address->get_name()->get_first_name() );
93
-		$shipping_detail->set_middle_name( $shipping_address->get_name()->get_middle_name() );
94
-		$shipping_detail->set_last_name( $shipping_address->get_name()->get_last_name() );
95
-		$shipping_detail->set_street( $shipping_address->get_street_name() );
96
-		$shipping_detail->set_house_number( $shipping_address->get_house_number() );
97
-		$shipping_detail->set_house_number_addition( $shipping_address->get_house_number_addition() );
98
-		$shipping_detail->set_postal_code( $shipping_address->get_postal_code() );
99
-		$shipping_detail->set_city( $shipping_address->get_city() );
100
-		$shipping_detail->set_country_code( $shipping_address->get_country_code() );
92
+		$shipping_detail->set_first_name($shipping_address->get_name()->get_first_name());
93
+		$shipping_detail->set_middle_name($shipping_address->get_name()->get_middle_name());
94
+		$shipping_detail->set_last_name($shipping_address->get_name()->get_last_name());
95
+		$shipping_detail->set_street($shipping_address->get_street_name());
96
+		$shipping_detail->set_house_number($shipping_address->get_house_number());
97
+		$shipping_detail->set_house_number_addition($shipping_address->get_house_number_addition());
98
+		$shipping_detail->set_postal_code($shipping_address->get_postal_code());
99
+		$shipping_detail->set_city($shipping_address->get_city());
100
+		$shipping_detail->set_country_code($shipping_address->get_country_code());
101 101
 
102 102
 		$billing_detail = new Address();
103
-		$billing_detail->set_first_name( $billing_address->get_name()->get_first_name() );
104
-		$billing_detail->set_middle_name( $billing_address->get_name()->get_middle_name() );
105
-		$billing_detail->set_last_name( $billing_address->get_name()->get_last_name() );
106
-		$billing_detail->set_street( $billing_address->get_street_name() );
107
-		$billing_detail->set_house_number( $billing_address->get_house_number() );
108
-		$billing_detail->set_house_number_addition( $billing_address->get_house_number_addition() );
109
-		$billing_detail->set_postal_code( $billing_address->get_postal_code() );
110
-		$billing_detail->set_city( $billing_address->get_city() );
111
-		$billing_detail->set_country_code( $billing_address->get_country_code() );
103
+		$billing_detail->set_first_name($billing_address->get_name()->get_first_name());
104
+		$billing_detail->set_middle_name($billing_address->get_name()->get_middle_name());
105
+		$billing_detail->set_last_name($billing_address->get_name()->get_last_name());
106
+		$billing_detail->set_street($billing_address->get_street_name());
107
+		$billing_detail->set_house_number($billing_address->get_house_number());
108
+		$billing_detail->set_house_number_addition($billing_address->get_house_number_addition());
109
+		$billing_detail->set_postal_code($billing_address->get_postal_code());
110
+		$billing_detail->set_city($billing_address->get_city());
111
+		$billing_detail->set_country_code($billing_address->get_country_code());
112 112
 
113 113
 		// Customer information.
114 114
 		$customer_information = new CustomerInformation();
115
-		$customer_information->set_email_address( $payment->get_contact()->get_email() );
116
-		$customer_information->set_telephone_number( $payment->get_contact()->get_phone() );
115
+		$customer_information->set_email_address($payment->get_contact()->get_email());
116
+		$customer_information->set_telephone_number($payment->get_contact()->get_phone());
117 117
 
118 118
 		// Payment brand.
119
-		$payment_brand = PaymentBrands::transform( $payment->get_method() );
119
+		$payment_brand = PaymentBrands::transform($payment->get_method());
120 120
 
121 121
 		// New order.
122 122
 		$order = new Order(
123 123
 			$merchant_order_id,
124 124
 			new Money(
125 125
 				$payment->get_currency(),
126
-				Core_Util::amount_to_cents( $payment->get_amount()->get_amount() )
126
+				Core_Util::amount_to_cents($payment->get_amount()->get_amount())
127 127
 			),
128 128
 			$payment->get_return_url()
129 129
 		);
130 130
 
131
-		$order->set_description( $payment->get_description() );
132
-		$order->set_language( $payment->get_contact()->get_language() );
133
-		$order->set_items( $payment->get_order_items() );
134
-		$order->set_shipping_detail( $shipping_detail );
135
-		$order->set_billing_detail( $billing_detail );
136
-		$order->set_customer_information( $customer_information );
137
-		$order->set_payment_brand( $payment_brand );
131
+		$order->set_description($payment->get_description());
132
+		$order->set_language($payment->get_contact()->get_language());
133
+		$order->set_items($payment->get_order_items());
134
+		$order->set_shipping_detail($shipping_detail);
135
+		$order->set_billing_detail($billing_detail);
136
+		$order->set_customer_information($customer_information);
137
+		$order->set_payment_brand($payment_brand);
138 138
 
139
-		if ( null !== $payment_brand ) {
139
+		if (null !== $payment_brand) {
140 140
 			// Payment brand force should only be set if payment brand is not empty.
141
-			$order->set_payment_brand_force( PaymentBrandForce::FORCE_ONCE );
141
+			$order->set_payment_brand_force(PaymentBrandForce::FORCE_ONCE);
142 142
 		}
143 143
 
144 144
 		// Maybe update access token.
145 145
 		$this->maybe_update_access_token();
146 146
 
147 147
 		// Handle errors.
148
-		if ( $this->get_client_error() ) {
148
+		if ($this->get_client_error()) {
149 149
 			return;
150 150
 		}
151 151
 
152 152
 		// Announce order.
153
-		$result = $this->client->order_announce( $this->config, $order );
153
+		$result = $this->client->order_announce($this->config, $order);
154 154
 
155 155
 		// Handle errors.
156
-		if ( $this->get_client_error() ) {
156
+		if ($this->get_client_error()) {
157 157
 			return;
158 158
 		}
159 159
 
160
-		if ( $result ) {
161
-			$payment->set_action_url( $result->redirectUrl );
160
+		if ($result) {
161
+			$payment->set_action_url($result->redirectUrl);
162 162
 		}
163 163
 	}
164 164
 
@@ -167,45 +167,45 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @param Payment $payment Payment.
169 169
 	 */
170
-	public function update_status( Payment $payment ) {
171
-		if ( ! ReturnParameters::contains( $_GET ) ) { // WPCS: CSRF ok.
170
+	public function update_status(Payment $payment) {
171
+		if ( ! ReturnParameters::contains($_GET)) { // WPCS: CSRF ok.
172 172
 			return;
173 173
 		}
174 174
 
175
-		$parameters = ReturnParameters::from_array( $_GET ); // WPCS: CSRF ok.
175
+		$parameters = ReturnParameters::from_array($_GET); // WPCS: CSRF ok.
176 176
 
177 177
 		// Note.
178 178
 		$note_values = array(
179 179
 			'order_id'  => $parameters->get_order_id(),
180 180
 			'status'    => $parameters->get_status(),
181 181
 			'signature' => $parameters->get_signature(),
182
-			'valid'     => $parameters->is_valid( $this->config->signing_key ) ? 'true' : 'false',
182
+			'valid'     => $parameters->is_valid($this->config->signing_key) ? 'true' : 'false',
183 183
 		);
184 184
 
185 185
 		$note = '';
186 186
 
187 187
 		$note .= '<p>';
188
-		$note .= __( 'OmniKassa 2.0 return URL requested:', 'pronamic_ideal' );
188
+		$note .= __('OmniKassa 2.0 return URL requested:', 'pronamic_ideal');
189 189
 		$note .= '</p>';
190 190
 
191 191
 		$note .= '<dl>';
192 192
 
193
-		foreach ( $note_values as $key => $value ) {
194
-			$note .= sprintf( '<dt>%s</dt>', esc_html( $key ) );
195
-			$note .= sprintf( '<dd>%s</dd>', esc_html( $value ) );
193
+		foreach ($note_values as $key => $value) {
194
+			$note .= sprintf('<dt>%s</dt>', esc_html($key));
195
+			$note .= sprintf('<dd>%s</dd>', esc_html($value));
196 196
 		}
197 197
 
198 198
 		$note .= '</dl>';
199 199
 
200
-		$payment->add_note( $note );
200
+		$payment->add_note($note);
201 201
 
202 202
 		// Validate.
203
-		if ( ! $parameters->is_valid( $this->config->signing_key ) ) {
203
+		if ( ! $parameters->is_valid($this->config->signing_key)) {
204 204
 			return;
205 205
 		}
206 206
 
207 207
 		// Status.
208
-		$payment->set_status( Statuses::transform( $parameters->get_status() ) );
208
+		$payment->set_status(Statuses::transform($parameters->get_status()));
209 209
 	}
210 210
 
211 211
 	/**
@@ -215,14 +215,14 @@  discard block
 block discarded – undo
215 215
 	 *
216 216
 	 * @return void
217 217
 	 */
218
-	public function handle_notification( Notification $notification ) {
219
-		if ( ! $notification->is_valid( $this->config->signing_key ) ) {
218
+	public function handle_notification(Notification $notification) {
219
+		if ( ! $notification->is_valid($this->config->signing_key)) {
220 220
 			return;
221 221
 		}
222 222
 
223
-		switch ( $notification->get_event_name() ) {
223
+		switch ($notification->get_event_name()) {
224 224
 			case 'merchant.order.status.changed':
225
-				$this->handle_merchant_order_status_changed( $notification );
225
+				$this->handle_merchant_order_status_changed($notification);
226 226
 		}
227 227
 	}
228 228
 
@@ -233,39 +233,39 @@  discard block
 block discarded – undo
233 233
 	 *
234 234
 	 * @return void
235 235
 	 */
236
-	private function handle_merchant_order_status_changed( Notification $notification ) {
236
+	private function handle_merchant_order_status_changed(Notification $notification) {
237 237
 		do {
238
-			$order_results = $this->client->get_order_results( $notification->get_authentication() );
238
+			$order_results = $this->client->get_order_results($notification->get_authentication());
239 239
 
240
-			if ( ! $order_results || $order_results->is_valid( $this->config->signing_key ) ) {
240
+			if ( ! $order_results || $order_results->is_valid($this->config->signing_key)) {
241 241
 				return;
242 242
 			}
243 243
 
244
-			foreach ( $order_results as $order_result ) {
245
-				$payment = get_pronamic_payment_by_meta( '_pronamic_payment_omnikassa_2_merchant_order_id', $order_result->get_merchant_order_id() );
244
+			foreach ($order_results as $order_result) {
245
+				$payment = get_pronamic_payment_by_meta('_pronamic_payment_omnikassa_2_merchant_order_id', $order_result->get_merchant_order_id());
246 246
 
247
-				if ( empty( $payment ) ) {
247
+				if (empty($payment)) {
248 248
 					continue;
249 249
 				}
250 250
 
251
-				$payment->set_transaction_id( $order_result->get_omnikassa_order_id() );
252
-				$payment->set_status( Statuses::transform( $order_result->get_order_status() ) );
251
+				$payment->set_transaction_id($order_result->get_omnikassa_order_id());
252
+				$payment->set_status(Statuses::transform($order_result->get_order_status()));
253 253
 
254 254
 				// Note.
255 255
 				$note = '';
256 256
 
257 257
 				$note .= '<p>';
258
-				$note .= __( 'OmniKassa 2.0 webhook URL requested:', 'pronamic_ideal' );
258
+				$note .= __('OmniKassa 2.0 webhook URL requested:', 'pronamic_ideal');
259 259
 				$note .= '</p>';
260 260
 				$note .= '<pre>';
261
-				$note .= wp_json_encode( $order_result->get_json(), JSON_PRETTY_PRINT );
261
+				$note .= wp_json_encode($order_result->get_json(), JSON_PRETTY_PRINT);
262 262
 				$note .= '</pre>';
263 263
 
264
-				$payment->add_note( $note );
264
+				$payment->add_note($note);
265 265
 
266 266
 				$payment->save();
267 267
 			}
268
-		} while ( $order_results->more_available() );
268
+		} while ($order_results->more_available());
269 269
 	}
270 270
 
271 271
 	/**
@@ -274,20 +274,20 @@  discard block
 block discarded – undo
274 274
 	 * @return void
275 275
 	 */
276 276
 	private function maybe_update_access_token() {
277
-		if ( $this->config->is_access_token_valid() ) {
277
+		if ($this->config->is_access_token_valid()) {
278 278
 			return;
279 279
 		}
280 280
 
281 281
 		$data = $this->client->get_access_token_data();
282 282
 
283
-		if ( ! is_object( $data ) ) {
283
+		if ( ! is_object($data)) {
284 284
 			return;
285 285
 		}
286 286
 
287 287
 		$this->config->access_token             = $data->token;
288 288
 		$this->config->access_token_valid_until = $data->validUntil;
289 289
 
290
-		update_post_meta( $this->config->post_id, '_pronamic_gateway_omnikassa_2_access_token', $data->token );
290
+		update_post_meta($this->config->post_id, '_pronamic_gateway_omnikassa_2_access_token', $data->token);
291 291
 		update_post_meta(
292 292
 			$this->config->post_id,
293 293
 			'_pronamic_gateway_omnikassa_2_access_token_valid_until',
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	private function get_client_error() {
304 304
 		$error = $this->client->get_error();
305 305
 
306
-		if ( is_wp_error( $error ) ) {
306
+		if (is_wp_error($error)) {
307 307
 			$this->error = $error;
308 308
 
309 309
 			return $error;
Please login to merge, or discard this patch.
src/OrderItem.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -81,37 +81,37 @@
 block discarded – undo
81 81
 	 *
82 82
 	 * @return self
83 83
 	 */
84
-	public function __construct( array $item ) {
85
-		if ( isset( $item['id'] ) ) {
84
+	public function __construct(array $item) {
85
+		if (isset($item['id'])) {
86 86
 			$this->id = $item['id'];
87 87
 		}
88 88
 
89
-		if ( isset( $item['name'] ) ) {
89
+		if (isset($item['name'])) {
90 90
 			$this->name = $item['name'];
91 91
 		}
92 92
 
93
-		if ( isset( $item['description'] ) ) {
93
+		if (isset($item['description'])) {
94 94
 			$this->description = $item['description'];
95 95
 		}
96 96
 
97
-		if ( isset( $item['quantity'] ) ) {
98
-			$this->quantity = intval( $item['quantity'] );
97
+		if (isset($item['quantity'])) {
98
+			$this->quantity = intval($item['quantity']);
99 99
 		}
100 100
 
101
-		if ( isset( $item['amount'] ) ) {
101
+		if (isset($item['amount'])) {
102 102
 			$this->amount = $item['amount'];
103 103
 		}
104 104
 
105
-		if ( isset( $item['tax'] ) ) {
105
+		if (isset($item['tax'])) {
106 106
 			$this->tax = $item['tax'];
107 107
 		}
108 108
 
109
-		if ( isset( $item['category'] ) ) {
109
+		if (isset($item['category'])) {
110 110
 			$this->category = $item['category'];
111 111
 		}
112 112
 
113
-		if ( isset( $item['vat_category'] ) ) {
114
-			$this->vat_category = intval( $item['vat_category'] );
113
+		if (isset($item['vat_category'])) {
114
+			$this->vat_category = intval($item['vat_category']);
115 115
 		}
116 116
 	}
117 117
 
Please login to merge, or discard this patch.
src/CustomerInformation.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @param string $email_address E-mailadress of the consumer.
60 60
 	 */
61
-	public function set_email_address( $email_address ) {
61
+	public function set_email_address($email_address) {
62 62
 		$this->email_address = $email_address;
63 63
 	}
64 64
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @param string $date_of_birth Date of birth.
69 69
 	 */
70
-	public function set_date_of_birth( $date_of_birth ) {
70
+	public function set_date_of_birth($date_of_birth) {
71 71
 		$this->date_of_birth = $date_of_birth;
72 72
 	}
73 73
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @param string $gender Gender.
78 78
 	 */
79
-	public function set_gender( $gender ) {
79
+	public function set_gender($gender) {
80 80
 		$this->gender = $gender;
81 81
 	}
82 82
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @param string $initials Initials.
87 87
 	 */
88
-	public function set_initials( $initials ) {
88
+	public function set_initials($initials) {
89 89
 		$this->initials = $initials;
90 90
 	}
91 91
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @param string $telephone_number Telephone number.
96 96
 	 */
97
-	public function set_telephone_number( $telephone_number ) {
97
+	public function set_telephone_number($telephone_number) {
98 98
 		$this->telephone_number = $telephone_number;
99 99
 	}
100 100
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 			'telephoneNumber' => $this->telephone_number,
113 113
 		);
114 114
 
115
-		$data = array_filter( $data );
115
+		$data = array_filter($data);
116 116
 
117
-		if ( empty( $data ) ) {
117
+		if (empty($data)) {
118 118
 			return null;
119 119
 		}
120 120
 
Please login to merge, or discard this patch.
src/Security.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,35 +25,35 @@  discard block
 block discarded – undo
25 25
 	 * @param string   $signing_key Signing Key.
26 26
 	 * @return string|null
27 27
 	 */
28
-	public static function get_signature( Signable $signable, $signing_key ) {
28
+	public static function get_signature(Signable $signable, $signing_key) {
29 29
 		$data = $signable->get_signature_data();
30 30
 
31
-		if ( empty( $data ) ) {
31
+		if (empty($data)) {
32 32
 			return null;
33 33
 		}
34 34
 
35
-		if ( empty( $signing_key ) ) {
35
+		if (empty($signing_key)) {
36 36
 			return null;
37 37
 		}
38 38
 
39
-		$decoded_signing_key = base64_decode( $signing_key );
39
+		$decoded_signing_key = base64_decode($signing_key);
40 40
 
41
-		if ( false === $decoded_signing_key ) {
41
+		if (false === $decoded_signing_key) {
42 42
 			return null;
43 43
 		}
44 44
 
45 45
 		// Convert array to comma separated string.
46
-		foreach ( $data as &$part ) {
47
-			if ( ! is_array( $part ) ) {
46
+		foreach ($data as &$part) {
47
+			if ( ! is_array($part)) {
48 48
 				continue;
49 49
 			}
50 50
 
51
-			$part = implode( ',', $part );
51
+			$part = implode(',', $part);
52 52
 		}
53 53
 
54 54
 		$signature = hash_hmac(
55 55
 			'sha512',
56
-			implode( ',', $data ),
56
+			implode(',', $data),
57 57
 			$decoded_signing_key
58 58
 		);
59 59
 
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 	 * @param string $signature_b Signature B.
68 68
 	 * @return bool True if valid, false otherwise.
69 69
 	 */
70
-	public static function validate_signature( $signature_a, $signature_b ) {
71
-		if ( empty( $signature_a ) || empty( $signature_b ) ) {
70
+	public static function validate_signature($signature_a, $signature_b) {
71
+		if (empty($signature_a) || empty($signature_b)) {
72 72
 			// Empty signature string or null from calculation.
73 73
 			return false;
74 74
 		}
75 75
 
76
-		return ( 0 === strcasecmp( $signature_a, $signature_b ) );
76
+		return (0 === strcasecmp($signature_a, $signature_b));
77 77
 	}
78 78
 }
Please login to merge, or discard this patch.