Test Failed
Push — feature/post-pay ( e3663d...906e88 )
by Remco
04:22
created
src/AddressTransformer.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * @param PronamicAddress|null $pronamic_address Pronamic address to convert.
27 27
 	 * @return Address
28 28
 	 */
29
-	public static function transform( PronamicAddress $pronamic_address = null ) {
30
-		if ( null === $pronamic_address ) {
29
+	public static function transform(PronamicAddress $pronamic_address = null) {
30
+		if (null === $pronamic_address) {
31 31
 			return null;
32 32
 		}
33 33
 
@@ -39,19 +39,19 @@  discard block
 block discarded – undo
39 39
 		$city         = $pronamic_address->get_city();
40 40
 		$country_code = $pronamic_address->get_country_code();
41 41
 
42
-		if ( ! isset( $last_name, $street, $postal_code, $city, $country_code ) ) {
42
+		if ( ! isset($last_name, $street, $postal_code, $city, $country_code)) {
43 43
 			return null;
44 44
 		}
45 45
 
46
-		$address = new Address( $last_name, $street, $postal_code, $city, $country_code );
46
+		$address = new Address($last_name, $street, $postal_code, $city, $country_code);
47 47
 
48
-		if ( null !== $name ) {
49
-			$address->set_first_name( $name->get_first_name() );
50
-			$address->set_middle_name( $name->get_middle_name() );
48
+		if (null !== $name) {
49
+			$address->set_first_name($name->get_first_name());
50
+			$address->set_middle_name($name->get_middle_name());
51 51
 		}
52 52
 
53
-		$address->set_house_number( $pronamic_address->get_house_number() );
54
-		$address->set_house_number_addition( $pronamic_address->get_house_number_addition() );
53
+		$address->set_house_number($pronamic_address->get_house_number());
54
+		$address->set_house_number_addition($pronamic_address->get_house_number_addition());
55 55
 
56 56
 		return $address;
57 57
 	}
Please login to merge, or discard this patch.
src/Security.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 	 * @param array $fields Fields.
25 25
 	 * @return string
26 26
 	 */
27
-	public static function get_signature_fields_combined( $fields ) {
28
-		return implode( ',', $fields );
27
+	public static function get_signature_fields_combined($fields) {
28
+		return implode(',', $fields);
29 29
 	}
30 30
 
31 31
 	/**
@@ -35,24 +35,24 @@  discard block
 block discarded – undo
35 35
 	 * @param string   $signing_key Signing Key.
36 36
 	 * @return string|null
37 37
 	 */
38
-	public static function get_signature( Signable $signable, $signing_key ) {
38
+	public static function get_signature(Signable $signable, $signing_key) {
39 39
 		$fields = $signable->get_signature_fields();
40 40
 
41
-		if ( empty( $fields ) ) {
41
+		if (empty($fields)) {
42 42
 			return null;
43 43
 		}
44 44
 
45
-		if ( empty( $signing_key ) ) {
45
+		if (empty($signing_key)) {
46 46
 			return null;
47 47
 		}
48 48
 
49
-		$decoded_signing_key = base64_decode( $signing_key );
49
+		$decoded_signing_key = base64_decode($signing_key);
50 50
 
51
-		if ( false === $decoded_signing_key ) {
51
+		if (false === $decoded_signing_key) {
52 52
 			return null;
53 53
 		}
54 54
 
55
-		$combined = self::get_signature_fields_combined( $fields );
55
+		$combined = self::get_signature_fields_combined($fields);
56 56
 
57 57
 		$signature = hash_hmac(
58 58
 			'sha512',
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 	 * @param string $signature_b Signature B.
71 71
 	 * @return bool True if valid, false otherwise.
72 72
 	 */
73
-	public static function validate_signature( $signature_a, $signature_b ) {
74
-		if ( empty( $signature_a ) || empty( $signature_b ) ) {
73
+	public static function validate_signature($signature_a, $signature_b) {
74
+		if (empty($signature_a) || empty($signature_b)) {
75 75
 			// Empty signature string or null from calculation.
76 76
 			return false;
77 77
 		}
78 78
 
79
-		return ( 0 === strcasecmp( $signature_a, $signature_b ) );
79
+		return (0 === strcasecmp($signature_a, $signature_b));
80 80
 	}
81 81
 }
Please login to merge, or discard this patch.
src/Category.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,8 @@
 block discarded – undo
40 40
 	 * @param string $type Pronamic payment line type.
41 41
 	 * @return string
42 42
 	 */
43
-	public static function transform( $type ) {
44
-		switch ( $type ) {
43
+	public static function transform($type) {
44
+		switch ($type) {
45 45
 			case PaymentLineType::DIGITAL:
46 46
 				return self::DIGITAL;
47 47
 			case PaymentLineType::DISCOUNT:
Please login to merge, or discard this patch.
src/OrderItems.php 1 patch
Spacing   +12 added lines, -12 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
 	}
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @return OrderItem
45 45
 	 */
46
-	public function new_item( $name, $quantity, Money $amount, $category ) {
47
-		$item = new OrderItem( $name, $quantity, $amount, $category );
46
+	public function new_item($name, $quantity, Money $amount, $category) {
47
+		$item = new OrderItem($name, $quantity, $amount, $category);
48 48
 
49
-		$this->add_item( $item ):
49
+		$this->add_item($item):
50 50
 
51 51
 		return $item;
52 52
 	}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @param OrderItem $item Order item.
58 58
 	 */
59
-	public function add_item( OrderItem $item ) {
59
+	public function add_item(OrderItem $item) {
60 60
 		$this->order_items[] = $item;
61 61
 	}
62 62
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function get_json() {
78 78
 		$data = array_map(
79
-			function( $item ) {
79
+			function($item) {
80 80
 				return $item->get_json();
81 81
 			},
82 82
 			$this->get_order_items()
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 	 * @param array $fields Fields.
92 92
 	 * @return array
93 93
 	 */
94
-	public function get_signature_fields( $fields = array() ) {
95
-		foreach ( $this->get_order_items() as $item ) {
96
-			$fields = $item->get_signature_fields( $fields );
94
+	public function get_signature_fields($fields = array()) {
95
+		foreach ($this->get_order_items() as $item) {
96
+			$fields = $item->get_signature_fields($fields);
97 97
 		}
98 98
 
99 99
 		return $fields;
Please login to merge, or discard this patch.
src/MoneyTransformer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@
 block discarded – undo
26 26
 	 * @param PronamicMoney|null $pronamic_money Pronamic money to convert.
27 27
 	 * @return Money
28 28
 	 */
29
-	public static function transform( PronamicMoney $pronamic_money = null ) {
30
-		if ( null === $pronamic_money ) {
29
+	public static function transform(PronamicMoney $pronamic_money = null) {
30
+		if (null === $pronamic_money) {
31 31
 			return null;
32 32
 		}
33 33
 
34 34
 		$money = new Money(
35 35
 			$pronamic_money->get_currency()->get_alphabetic_code(),
36
-			intval( $pronamic_money->get_cents() )
36
+			intval($pronamic_money->get_cents())
37 37
 		);
38 38
 
39 39
 		return $money;
Please login to merge, or discard this patch.
src/Order.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  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 ) {
157
+	public function __construct($merchant_order_id, $amount, $merchant_return_url) {
158 158
 		$this->timestamp           = new DateTime();
159 159
 		$this->merchant_order_id   = $merchant_order_id;
160 160
 		$this->amount              = $amount;
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @param DateTime $timestamp Timestamp.
168 168
 	 */
169
-	public function set_timestamp( DateTime $timestamp ) {
169
+	public function set_timestamp(DateTime $timestamp) {
170 170
 		$this->timestamp = $timestamp;
171 171
 	}
172 172
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @param string $description Description.
177 177
 	 */
178
-	public function set_description( $description ) {
178
+	public function set_description($description) {
179 179
 		$this->description = $description;
180 180
 	}
181 181
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 *
185 185
 	 * @param string $language Language.
186 186
 	 */
187
-	public function set_language( $language ) {
187
+	public function set_language($language) {
188 188
 		$this->language = $language;
189 189
 	}
190 190
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @param string|null $payment_brand Payment brand.
195 195
 	 */
196
-	public function set_payment_brand( $payment_brand ) {
196
+	public function set_payment_brand($payment_brand) {
197 197
 		$this->payment_brand = $payment_brand;
198 198
 	}
199 199
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @param string $payment_brand_force Payment brand force.
204 204
 	 */
205
-	public function set_payment_brand_force( $payment_brand_force ) {
205
+	public function set_payment_brand_force($payment_brand_force) {
206 206
 		$this->payment_brand_force = $payment_brand_force;
207 207
 	}
208 208
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @param OrderItems|null $order_items Order items.
224 224
 	 */
225
-	public function set_order_items( OrderItems $order_items = null ) {
225
+	public function set_order_items(OrderItems $order_items = null) {
226 226
 		$this->order_items = $order_items;
227 227
 	}
228 228
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 *
232 232
 	 * @param Address|null $shipping_detail Shipping address details.
233 233
 	 */
234
-	public function set_shipping_detail( Address $shipping_detail = null ) {
234
+	public function set_shipping_detail(Address $shipping_detail = null) {
235 235
 		$this->shipping_detail = $shipping_detail;
236 236
 	}
237 237
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @param Address|null $billing_detail Billing address details.
242 242
 	 */
243
-	public function set_billing_detail( Address $billing_detail = null ) {
243
+	public function set_billing_detail(Address $billing_detail = null) {
244 244
 		$this->billing_detail = $billing_detail;
245 245
 	}
246 246
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * @param CustomerInformation $customer_information Customer information.
251 251
 	 */
252
-	public function set_customer_information( CustomerInformation $customer_information ) {
252
+	public function set_customer_information(CustomerInformation $customer_information) {
253 253
 		$this->customer_information = $customer_information;
254 254
 	}
255 255
 
@@ -261,42 +261,42 @@  discard block
 block discarded – undo
261 261
 	public function get_json() {
262 262
 		$object = (object) array();
263 263
 
264
-		$object->timestamp       = $this->timestamp->format( DATE_ATOM );
264
+		$object->timestamp       = $this->timestamp->format(DATE_ATOM);
265 265
 		$object->merchantOrderId = $this->merchant_order_id;
266 266
 
267
-		if ( null !== $this->description ) {
267
+		if (null !== $this->description) {
268 268
 			$object->description = $this->description;
269 269
 		}
270 270
 
271
-		if ( null !== $this->order_items ) {
271
+		if (null !== $this->order_items) {
272 272
 			$object->orderItems = $this->order_items->get_json();
273 273
 		}
274 274
 
275 275
 		$object->amount = $this->amount->get_json();
276 276
 
277
-		if ( null !== $this->shipping_detail ) {
277
+		if (null !== $this->shipping_detail) {
278 278
 			$object->shippingDetail = $this->shipping_detail->get_json();
279 279
 		}
280 280
 
281
-		if ( null !== $this->billing_detail ) {
281
+		if (null !== $this->billing_detail) {
282 282
 			$object->billingDetail = $this->billing_detail->get_json();
283 283
 		}
284 284
 
285
-		if ( null !== $this->customer_information ) {
285
+		if (null !== $this->customer_information) {
286 286
 			$object->customerInformation = $this->customer_information->get_json();
287 287
 		}
288 288
 
289
-		if ( null !== $this->language ) {
289
+		if (null !== $this->language) {
290 290
 			$object->language = $this->language;
291 291
 		}
292 292
 
293 293
 		$object->merchantReturnURL = $this->merchant_return_url;
294 294
 
295
-		if ( null !== $this->payment_brand ) {
295
+		if (null !== $this->payment_brand) {
296 296
 			$object->paymentBrand = $this->payment_brand;
297 297
 		}
298 298
 
299
-		if ( null !== $this->payment_brand_force ) {
299
+		if (null !== $this->payment_brand_force) {
300 300
 			$object->paymentBrandForce = $this->payment_brand_force;
301 301
 		}
302 302
 
@@ -309,8 +309,8 @@  discard block
 block discarded – undo
309 309
 	 * @param array $fields Fields.
310 310
 	 * @return array
311 311
 	 */
312
-	public function get_signature_fields( $fields = array() ) {
313
-		$fields[] = $this->timestamp->format( DATE_ATOM );
312
+	public function get_signature_fields($fields = array()) {
313
+		$fields[] = $this->timestamp->format(DATE_ATOM);
314 314
 		$fields[] = $this->merchant_order_id;
315 315
 		$fields[] = $this->amount->get_currency();
316 316
 		$fields[] = $this->amount->get_amount();
@@ -318,28 +318,28 @@  discard block
 block discarded – undo
318 318
 		$fields[] = $this->description;
319 319
 		$fields[] = $this->merchant_return_url;
320 320
 
321
-		if ( null !== $this->order_items ) {
322
-			$fields = $this->order_items->get_signature_fields( $fields );
321
+		if (null !== $this->order_items) {
322
+			$fields = $this->order_items->get_signature_fields($fields);
323 323
 		}
324 324
 
325
-		if ( null !== $this->shipping_detail ) {
326
-			$fields = $this->shipping_detail->get_signature_fields( $fields );
325
+		if (null !== $this->shipping_detail) {
326
+			$fields = $this->shipping_detail->get_signature_fields($fields);
327 327
 		}
328 328
 
329
-		if ( null !== $this->payment_brand ) {
329
+		if (null !== $this->payment_brand) {
330 330
 			$fields[] = $this->payment_brand;
331 331
 		}
332 332
 
333
-		if ( null !== $this->payment_brand_force ) {
333
+		if (null !== $this->payment_brand_force) {
334 334
 			$fields[] = $this->payment_brand_force;
335 335
 		}
336 336
 
337
-		if ( null !== $this->customer_information ) {
338
-			$fields = $this->customer_information->get_signature_fields( $fields );
337
+		if (null !== $this->customer_information) {
338
+			$fields = $this->customer_information->get_signature_fields($fields);
339 339
 		}
340 340
 
341
-		if ( null !== $this->billing_detail ) {
342
-			$fields = $this->billing_detail->get_signature_fields( $fields );
341
+		if (null !== $this->billing_detail) {
342
+			$fields = $this->billing_detail->get_signature_fields($fields);
343 343
 		}
344 344
 
345 345
 		return $fields;
Please login to merge, or discard this patch.