Passed
Push — master ( bcac29...922618 )
by Chris
02:32
created
class-edu-klarnacheckout.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 defined( 'ABSPATH' ) || die( 'This plugin must be run within the scope of WordPress.' );
3 3
 
4
-if ( ! class_exists( 'EDU_KlarnaCheckout' ) ) {
4
+if ( !class_exists( 'EDU_KlarnaCheckout' ) ) {
5 5
 	class EDU_KlarnaCheckout extends EDU_Integration {
6 6
 		public function __construct() {
7 7
 			$this->id          = 'eduadmin-klarnacheckout';
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
 			$ebi = new EduAdmin_BookingInfo( $event_booking, $_customer, $_contact );
67 67
 
68
-			if ( ! empty( EDU()->session['klarna-order-id'] ) && ! empty( $_GET['klarna_order_id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) {
68
+			if ( !empty( EDU()->session['klarna-order-id'] ) && !empty( $_GET['klarna_order_id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) {
69 69
 				do_action( 'eduadmin-bookingcompleted', $ebi );
70 70
 			} else {
71 71
 				do_action( 'eduadmin-processbooking', $ebi );
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 				return;
81 81
 			}
82 82
 
83
-			if ( ! empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) {
83
+			if ( !empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) {
84 84
 				$ebi->NoRedirect = true;
85 85
 			}
86 86
 		}
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 			if ( 'no' === $this->get_option( 'enabled', 'no' ) ) {
108 108
 				return;
109 109
 			}
110
-			$checkout_url  = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
110
+			$checkout_url  = !checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
111 111
 			$shared_secret = $this->get_option( 'shared_secret', '' );
112 112
 
113
-			if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( EDU()->session['klarna-order-id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) {
113
+			if ( !empty( $_GET['klarna_order_id'] ) && !empty( EDU()->session['klarna-order-id'] ) && EDU()->session['klarna-order-id'] === $_GET['klarna_order_id'] ) {
114 114
 				try {
115 115
 					$connector = Klarna_Checkout_Connector::create(
116 116
 						$shared_secret,
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		 */
177 177
 		public function create_checkout( $ebi = null ) {
178 178
 
179
-			$checkout_url  = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
179
+			$checkout_url  = !checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
180 180
 			$shared_secret = $this->get_option( 'shared_secret', '' );
181 181
 
182 182
 			$create = array();
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
 
197 197
 			$reference_id = 0;
198 198
 
199
-			if ( ! empty( $ebi->EventBooking['BookingId'] ) ) {
199
+			if ( !empty( $ebi->EventBooking['BookingId'] ) ) {
200 200
 				$booking_id = intval( $ebi->EventBooking['BookingId'] );
201 201
 				$reference_id = $booking_id;
202 202
 			}
203 203
 
204
-			if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
204
+			if ( !empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) {
205 205
 				$programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] );
206 206
 				$reference_id = $programme_booking_id;
207 207
 			}
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 				$cart_item['name']      = $order_row['Description'];
248 248
 				$cart_item['quantity']  = intval( $order_row['Quantity'] );
249 249
 
250
-				if ( ! $order_row['PriceIncVat'] ) {
250
+				if ( !$order_row['PriceIncVat'] ) {
251 251
 					$price_per_unit = $order_row['PricePerUnit'] * ( 1 + ( $order_row['VatPercent'] / 100 ) ) * 100;
252 252
 				} else {
253 253
 					$price_per_unit = $order_row['PricePerUnit'] * 100;
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 		}
285 285
 
286 286
 		public function process_paymentstatus() {
287
-			if ( ! empty( $_GET['klarna_order_id'] ) && ! empty( $_GET['status'] ) ) {
288
-				$checkout_url  = ! checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
287
+			if ( !empty( $_GET['klarna_order_id'] ) && !empty( $_GET['status'] ) ) {
288
+				$checkout_url  = !checked( $this->get_option( 'test_mode', 'no' ), '1', false ) ? Klarna_Checkout_Connector::BASE_URL : Klarna_Checkout_Connector::BASE_TEST_URL;
289 289
 				$shared_secret = $this->get_option( 'shared_secret', '' );
290 290
 
291 291
 				try {
Please login to merge, or discard this patch.