Completed
Branch FET-10586-integer-input (c3d121)
by
unknown
95:24 queued 84:35
created
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 3 patches
Doc Comments   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 
146 146
 	/**
147
-	 * @return null
147
+	 * @return EE_Line_Item_Display
148 148
 	 */
149 149
 	public function line_item_display() {
150 150
 		return $this->line_item_display;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 
155 155
 	/**
156
-	 * @param null $line_item_display
156
+	 * @param EE_Line_Item_Display $line_item_display
157 157
 	 */
158 158
 	public function set_line_item_display( $line_item_display ) {
159 159
 		$this->line_item_display = $line_item_display;
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
 	 *    _apply_registration_payments_to_amount_owing
840 840
 	 *
841 841
 	 * @access protected
842
-	 * @param array $registrations
842
+	 * @param EE_Base_Class[] $registrations
843 843
 	 */
844 844
 	protected function _apply_registration_payments_to_amount_owing( array $registrations ) {
845 845
 		$payments = array();
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 	 * get_billing_form_html_for_payment_method
1113 1113
 	 *
1114 1114
 	 * @access public
1115
-	 * @return string
1115
+	 * @return boolean
1116 1116
 	 * @throws \EE_Error
1117 1117
 	 */
1118 1118
 	public function get_billing_form_html_for_payment_method() {
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 	 *
1177 1177
 	 * @access private
1178 1178
 	 * @param EE_Payment_Method $payment_method
1179
-	 * @return \EE_Billing_Info_Form|\EE_Form_Section_HTML
1179
+	 * @return EE_Billing_Info_Form
1180 1180
 	 * @throws \EE_Error
1181 1181
 	 */
1182 1182
 	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
 	 * switch_payment_method
1281 1281
 	 *
1282 1282
 	 * @access public
1283
-	 * @return string
1283
+	 * @return boolean
1284 1284
 	 * @throws \EE_Error
1285 1285
 	 */
1286 1286
 	public function switch_payment_method() {
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 	/**
1488 1488
 	 * process_reg_step
1489 1489
 	 *
1490
-	 * @return boolean
1490
+	 * @return null|boolean
1491 1491
 	 * @throws \EE_Error
1492 1492
 	 */
1493 1493
 	public function process_reg_step() {
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
 	 *    update_reg_step
1614 1614
 	 *    this is the final step after a user  revisits the site to retry a payment
1615 1615
 	 *
1616
-	 * @return boolean
1616
+	 * @return null|boolean
1617 1617
 	 * @throws \EE_Error
1618 1618
 	 */
1619 1619
 	public function update_reg_step() {
@@ -1981,7 +1981,7 @@  discard block
 block discarded – undo
1981 1981
 	 *
1982 1982
 	 * @access    private
1983 1983
 	 * @type    EE_Payment_Method $payment_method
1984
-	 * @return    mixed    EE_Payment | boolean
1984
+	 * @return    EE_Payment|null    EE_Payment | boolean
1985 1985
 	 * @throws \EE_Error
1986 1986
 	 */
1987 1987
 	private function _attempt_payment( EE_Payment_Method $payment_method ) {
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
 	 * _post_payment_processing
2113 2113
 	 *
2114 2114
 	 * @access private
2115
-	 * @param EE_Payment|bool $payment
2115
+	 * @param EE_Payment $payment
2116 2116
 	 * @return bool
2117 2117
 	 * @throws \EE_Error
2118 2118
 	 */
@@ -2301,7 +2301,7 @@  discard block
 block discarded – undo
2301 2301
 	 *        or present the payment options again
2302 2302
 	 *
2303 2303
 	 * @access private
2304
-	 * @return EE_Payment | FALSE
2304
+	 * @return boolean | FALSE
2305 2305
 	 * @throws \EE_Error
2306 2306
 	 */
2307 2307
 	public function process_gateway_response() {
@@ -2434,8 +2434,8 @@  discard block
 block discarded – undo
2434 2434
 	 * _redirect_wayward_request
2435 2435
 	 *
2436 2436
 	 * @access private
2437
-	 * @param \EE_Registration|null $primary_registrant
2438
-	 * @return bool
2437
+	 * @param EE_Registration $primary_registrant
2438
+	 * @return false|null
2439 2439
 	 * @throws \EE_Error
2440 2440
 	 */
2441 2441
 	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
Please login to merge, or discard this patch.
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -286,41 +286,41 @@  discard block
 block discarded – undo
286 286
 			$this->checkout->revisit
287 287
 		);
288 288
 		foreach ( $registrations as $REG_ID => $registration ) {
289
-            /** @var $registration EE_Registration */
290
-            // has this registration lost it's space ?
289
+			/** @var $registration EE_Registration */
290
+			// has this registration lost it's space ?
291 291
 			if ( isset( $ejected_registrations[ $REG_ID ] ) ) {
292 292
 				$insufficient_spaces_available[ $registration->event()->ID() ] = $registration->event();
293 293
 				continue;
294 294
 			}
295
-            // event requires admin approval
296
-            if ($registration->status_ID() === EEM_Registration::status_id_not_approved) {
297
-                // add event to list of events with pre-approval reg status
298
-                $registrations_requiring_pre_approval[$REG_ID] = $registration;
299
-                do_action(
300
-                    'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
301
-                    $registration->event(),
302
-                    $this
303
-                );
304
-                continue;
305
-            }
306
-            if (
295
+			// event requires admin approval
296
+			if ($registration->status_ID() === EEM_Registration::status_id_not_approved) {
297
+				// add event to list of events with pre-approval reg status
298
+				$registrations_requiring_pre_approval[$REG_ID] = $registration;
299
+				do_action(
300
+					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
301
+					$registration->event(),
302
+					$this
303
+				);
304
+				continue;
305
+			}
306
+			if (
307 307
 				// returning registrant
308 308
 				$this->checkout->revisit
309 309
 				// anything other than Approved
310 310
 				&& $registration->status_ID() !== EEM_Registration::status_id_approved
311
-                && (
312
-                    $registration->event()->is_sold_out()
313
-                    || $registration->event()->is_sold_out( true )
314
-                )
315
-            ) {
316
-                // add event to list of events that are sold out
317
-                $sold_out_events[ $registration->event()->ID() ] = $registration->event();
318
-                do_action(
319
-                    'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
320
-                    $registration->event(),
321
-                    $this
322
-                );
323
-                continue;
311
+				&& (
312
+					$registration->event()->is_sold_out()
313
+					|| $registration->event()->is_sold_out( true )
314
+				)
315
+			) {
316
+				// add event to list of events that are sold out
317
+				$sold_out_events[ $registration->event()->ID() ] = $registration->event();
318
+				do_action(
319
+					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
320
+					$registration->event(),
321
+					$this
322
+				);
323
+				continue;
324 324
 			}
325 325
 			// are they allowed to pay now and is there monies owing?
326 326
 			if ( $registration->owes_monies_and_can_pay() ) {
@@ -428,11 +428,11 @@  discard block
 block discarded – undo
428 428
 			new EE_Billable_Line_Item_Filter(
429 429
 				EE_SPCO_Reg_Step_Payment_Options::remove_ejected_registrations(
430 430
 					EE_Registry::instance()->SSN->checkout()->transaction->registrations(
431
-                        EE_Registry::instance()->SSN->checkout()->reg_cache_where_params
432
-                    )
431
+						EE_Registry::instance()->SSN->checkout()->reg_cache_where_params
432
+					)
433 433
 				)
434 434
 			)
435
-        );
435
+		);
436 436
 		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
437 437
 		return $line_item_filter_collection;
438 438
 	}
@@ -481,46 +481,46 @@  discard block
 block discarded – undo
481 481
 	 * @throws \EE_Error
482 482
 	 */
483 483
 	public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) {
484
-        // registrations per event
484
+		// registrations per event
485 485
 		$event_reg_count = array();
486 486
 		// spaces left per event
487 487
 		$event_spaces_remaining = array();
488
-        // tickets left sorted by ID
489
-        $tickets_remaining = array();
490
-        // registrations that have lost their space
488
+		// tickets left sorted by ID
489
+		$tickets_remaining = array();
490
+		// registrations that have lost their space
491 491
 		$ejected_registrations = array();
492 492
 		foreach ( $registrations as $REG_ID => $registration ) {
493
-            if (
494
-                $registration->status_ID() === EEM_Registration::status_id_approved
495
-                || apply_filters(
496
-                    'FHEE__EE_SPCO_Reg_Step_Payment_Options__find_registrations_that_lost_their_space__allow_reg_payment',
497
-                    false,
498
-                    $registration,
499
-                    $revisit
500
-                )
501
-            ) {
502
-                continue;
493
+			if (
494
+				$registration->status_ID() === EEM_Registration::status_id_approved
495
+				|| apply_filters(
496
+					'FHEE__EE_SPCO_Reg_Step_Payment_Options__find_registrations_that_lost_their_space__allow_reg_payment',
497
+					false,
498
+					$registration,
499
+					$revisit
500
+				)
501
+			) {
502
+				continue;
503 503
 			}
504 504
 			$EVT_ID = $registration->event_ID();
505
-            $ticket = $registration->ticket();
506
-            if ( ! isset($tickets_remaining[$ticket->ID()])) {
507
-                $tickets_remaining[$ticket->ID()] = $ticket->remaining();
508
-            }
509
-            if ($tickets_remaining[$ticket->ID()] > 0) {
510
-                if ( ! isset($event_reg_count[$EVT_ID])) {
511
-                    $event_reg_count[$EVT_ID] = 0;
512
-                }
513
-                $event_reg_count[$EVT_ID]++;
514
-                if ( ! isset($event_spaces_remaining[$EVT_ID])) {
515
-                    $event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale();
516
-                }
517
-            }
505
+			$ticket = $registration->ticket();
506
+			if ( ! isset($tickets_remaining[$ticket->ID()])) {
507
+				$tickets_remaining[$ticket->ID()] = $ticket->remaining();
508
+			}
509
+			if ($tickets_remaining[$ticket->ID()] > 0) {
510
+				if ( ! isset($event_reg_count[$EVT_ID])) {
511
+					$event_reg_count[$EVT_ID] = 0;
512
+				}
513
+				$event_reg_count[$EVT_ID]++;
514
+				if ( ! isset($event_spaces_remaining[$EVT_ID])) {
515
+					$event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale();
516
+				}
517
+			}
518 518
 			if (
519 519
 				$revisit
520 520
 				&& (
521
-                    $tickets_remaining[$ticket->ID()] === 0
522
-				    || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
523
-                )
521
+					$tickets_remaining[$ticket->ID()] === 0
522
+					|| $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
523
+				)
524 524
 			) {
525 525
 				$ejected_registrations[ $REG_ID ] = $registration->event();
526 526
 				if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) {
@@ -589,9 +589,9 @@  discard block
 block discarded – undo
589 589
 				'layout_strategy'		=> new EE_Template_Layout(
590 590
 					array(
591 591
 						'layout_template_file' => SPCO_REG_STEPS_PATH
592
-						                          . $this->_slug
593
-						                          . DS
594
-						                          . 'sold_out_events.template.php',
592
+												  . $this->_slug
593
+												  . DS
594
+												  . 'sold_out_events.template.php',
595 595
 						'template_args'        => apply_filters(
596 596
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
597 597
 							array(
@@ -644,9 +644,9 @@  discard block
 block discarded – undo
644 644
 				'layout_strategy' => new EE_Template_Layout(
645 645
 					array(
646 646
 						'layout_template_file' => SPCO_REG_STEPS_PATH
647
-						                          . $this->_slug
648
-						                          . DS
649
-						                          . 'sold_out_events.template.php',
647
+												  . $this->_slug
648
+												  . DS
649
+												  . 'sold_out_events.template.php',
650 650
 						'template_args'        => apply_filters(
651 651
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___insufficient_spaces_available__template_args',
652 652
 							array(
@@ -694,9 +694,9 @@  discard block
 block discarded – undo
694 694
 				'layout_strategy'		=> new EE_Template_Layout(
695 695
 					array(
696 696
 						'layout_template_file' => SPCO_REG_STEPS_PATH
697
-						                          . $this->_slug
698
-						                          . DS
699
-						                          . 'events_requiring_pre_approval.template.php', // layout_template
697
+												  . $this->_slug
698
+												  . DS
699
+												  . 'events_requiring_pre_approval.template.php', // layout_template
700 700
 						'template_args'        => apply_filters(
701 701
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
702 702
 							array(
@@ -734,9 +734,9 @@  discard block
 block discarded – undo
734 734
 				'layout_strategy' 	=> new EE_Template_Layout(
735 735
 					array(
736 736
 						'layout_template_file' => SPCO_REG_STEPS_PATH
737
-						                          . $this->_slug
738
-						                          . DS
739
-						                          . 'no_payment_required.template.php', // layout_template
737
+												  . $this->_slug
738
+												  . DS
739
+												  . 'no_payment_required.template.php', // layout_template
740 740
 						'template_args'        => apply_filters(
741 741
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
742 742
 							array(
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 					$available_payment_method_options[ $payment_method->slug() ] = $payment_method_button;
965 965
 				}
966 966
 				$payment_methods_billing_info[ $payment_method->slug()
967
-				                               . '-info' ] = $this->_payment_method_billing_info(
967
+											   . '-info' ] = $this->_payment_method_billing_info(
968 968
 					$payment_method
969 969
 				);
970 970
 			}
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 		// fill form with attendee info if applicable
1153 1153
 		if (
1154 1154
 			$payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form
1155
-		    && $this->checkout->transaction_has_primary_registrant()
1155
+			&& $this->checkout->transaction_has_primary_registrant()
1156 1156
 		) {
1157 1157
 			$payment_method_billing_form->populate_from_attendee(
1158 1158
 				$this->checkout->transaction->primary_registration()->attendee()
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 		// and debug content
1162 1162
 		if (
1163 1163
 			$payment_method_billing_form instanceof EE_Billing_Info_Form
1164
-		    && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1164
+			&& $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1165 1165
 		) {
1166 1166
 			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
1167 1167
 				$payment_method_billing_form
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 		}
1337 1337
 		// and debug content
1338 1338
 		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form
1339
-		     && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1339
+			 && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1340 1340
 		) {
1341 1341
 			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
1342 1342
 				$this->checkout->billing_form
@@ -1506,8 +1506,8 @@  discard block
 block discarded – undo
1506 1506
 		}
1507 1507
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1508 1508
 		if ( ! empty( $attendee_data['ATT_fname'] )
1509
-		     && ! empty( $attendee_data['ATT_lname'] )
1510
-		     && ! empty( $attendee_data['ATT_email'] )
1509
+			 && ! empty( $attendee_data['ATT_lname'] )
1510
+			 && ! empty( $attendee_data['ATT_email'] )
1511 1511
 		) {
1512 1512
 			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(
1513 1513
 				array(
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
 			$payment_status = $payment->status();
1755 1755
 			if (
1756 1756
 				$payment_status === EEM_Payment::status_id_approved
1757
-			    || $payment_status === EEM_Payment::status_id_pending
1757
+				|| $payment_status === EEM_Payment::status_id_pending
1758 1758
 			) {
1759 1759
 				return true;
1760 1760
 			} else {
@@ -1980,8 +1980,8 @@  discard block
 block discarded – undo
1980 1980
 			return false;
1981 1981
 		}
1982 1982
 		if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' )
1983
-		       instanceof
1984
-		       EE_Attendee
1983
+			   instanceof
1984
+			   EE_Attendee
1985 1985
 		) {
1986 1986
 			EE_Error::add_error(
1987 1987
 				sprintf(
@@ -2699,19 +2699,19 @@  discard block
 block discarded – undo
2699 2699
 
2700 2700
 
2701 2701
 
2702
-    /**
2703
-     *    __sleep
2704
-     * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon serialization
2705
-     * EE_Checkout will handle the reimplementation of itself upon waking,
2706
-     * but we won't bother with the reg form, because if needed, it will be regenerated anyways
2707
-     *
2708
-     * @return array
2709
-     */
2710
-    public function __sleep()
2711
-    {
2712
-        // remove the reg form and the checkout
2713
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'reg_form', 'checkout', 'line_item_display' ) );
2714
-    }
2702
+	/**
2703
+	 *    __sleep
2704
+	 * to conserve db space, let's remove the reg_form and the EE_Checkout object from EE_SPCO_Reg_Step objects upon serialization
2705
+	 * EE_Checkout will handle the reimplementation of itself upon waking,
2706
+	 * but we won't bother with the reg form, because if needed, it will be regenerated anyways
2707
+	 *
2708
+	 * @return array
2709
+	 */
2710
+	public function __sleep()
2711
+	{
2712
+		// remove the reg form and the checkout
2713
+		return array_diff( array_keys( get_object_vars( $this ) ), array( 'reg_form', 'checkout', 'line_item_display' ) );
2714
+	}
2715 2715
 
2716 2716
 
2717 2717
 
Please login to merge, or discard this patch.
Spacing   +362 added lines, -362 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -38,32 +38,32 @@  discard block
 block discarded – undo
38 38
 	public static function set_hooks() {
39 39
 		add_filter(
40 40
 			'FHEE__SPCO__EE_Line_Item_Filter_Collection',
41
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' )
41
+			array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters')
42 42
 		);
43 43
 		add_action(
44 44
 			'wp_ajax_switch_spco_billing_form',
45
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )
45
+			array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')
46 46
 		);
47 47
 		add_action(
48 48
 			'wp_ajax_nopriv_switch_spco_billing_form',
49
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )
49
+			array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')
50 50
 		);
51
-		add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ) );
51
+		add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
52 52
 		add_action(
53 53
 			'wp_ajax_nopriv_save_payer_details',
54
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )
54
+			array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')
55 55
 		);
56 56
 		add_action(
57 57
 			'wp_ajax_get_transaction_details_for_gateways',
58
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
58
+			array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
59 59
 		);
60 60
 		add_action(
61 61
 			'wp_ajax_nopriv_get_transaction_details_for_gateways',
62
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
62
+			array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
63 63
 		);
64 64
 		add_filter(
65 65
 			'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array',
66
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ),
66
+			array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'),
67 67
 			10,
68 68
 			1
69 69
 		);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @throws \EE_Error
78 78
 	 */
79 79
 	public static function switch_spco_billing_form() {
80
-		EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' );
80
+		EED_Single_Page_Checkout::process_ajax_request('switch_payment_method');
81 81
 	}
82 82
 
83 83
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @throws \EE_Error
89 89
 	 */
90 90
 	public static function save_payer_details() {
91
-		EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' );
91
+		EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax');
92 92
 	}
93 93
 
94 94
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @throws \EE_Error
100 100
 	 */
101 101
 	public static function get_transaction_details() {
102
-		EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' );
102
+		EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways');
103 103
 	}
104 104
 
105 105
 
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
 	 * @access    public
127 127
 	 * @param    EE_Checkout $checkout
128 128
 	 */
129
-	public function __construct( EE_Checkout $checkout ) {
129
+	public function __construct(EE_Checkout $checkout) {
130 130
 		$this->_slug = 'payment_options';
131
-		$this->_name = __( 'Payment Options', 'event_espresso' );
132
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
131
+		$this->_name = __('Payment Options', 'event_espresso');
132
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
133 133
 		$this->checkout = $checkout;
134 134
 		$this->_reset_success_message();
135 135
 		$this->set_instructions(
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	/**
155 155
 	 * @param null $line_item_display
156 156
 	 */
157
-	public function set_line_item_display( $line_item_display ) {
157
+	public function set_line_item_display($line_item_display) {
158 158
 		$this->line_item_display = $line_item_display;
159 159
 	}
160 160
 
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	/**
173 173
 	 * @param boolean $handle_IPN_in_this_request
174 174
 	 */
175
-	public function set_handle_IPN_in_this_request( $handle_IPN_in_this_request ) {
176
-		$this->handle_IPN_in_this_request = filter_var( $handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN );
175
+	public function set_handle_IPN_in_this_request($handle_IPN_in_this_request) {
176
+		$this->handle_IPN_in_this_request = filter_var($handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN);
177 177
 	}
178 178
 
179 179
 
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
 	public function enqueue_styles_and_scripts() {
209 209
 		$transaction = $this->checkout->transaction;
210 210
 		//if the transaction isn't set or nothing is owed on it, don't enqueue any JS
211
-		if( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats( $transaction->remaining(), 0 ) ) {
211
+		if ( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats($transaction->remaining(), 0)) {
212 212
 			return;
213 213
 		}
214
-		foreach( EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ) as $payment_method ) {
214
+		foreach (EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart) as $payment_method) {
215 215
 			$type_obj = $payment_method->type_obj();
216
-			if( $type_obj instanceof EE_PMT_Base ) {
217
-				$billing_form = $type_obj->generate_new_billing_form( $transaction );
218
-				if( $billing_form instanceof EE_Form_Section_Proper ) {
216
+			if ($type_obj instanceof EE_PMT_Base) {
217
+				$billing_form = $type_obj->generate_new_billing_form($transaction);
218
+				if ($billing_form instanceof EE_Form_Section_Proper) {
219 219
 					$billing_form->enqueue_js();
220 220
 				}
221 221
 			}
@@ -240,20 +240,20 @@  discard block
 block discarded – undo
240 240
 			// 	$ 0.00 transactions (no payment required)
241 241
 			! $this->checkout->payment_required()
242 242
 			// but do NOT remove if current action being called belongs to this reg step
243
-			&& ! is_callable( array( $this, $this->checkout->action ) )
243
+			&& ! is_callable(array($this, $this->checkout->action))
244 244
 			&& ! $this->completed()
245 245
 		) {
246 246
 			// and if so, then we no longer need the Payment Options step
247
-			if ( $this->is_current_step() ) {
247
+			if ($this->is_current_step()) {
248 248
 				$this->checkout->generate_reg_form = false;
249 249
 			}
250
-			$this->checkout->remove_reg_step( $this->_slug );
250
+			$this->checkout->remove_reg_step($this->_slug);
251 251
 			// DEBUG LOG
252 252
 			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
253 253
 			return false;
254 254
 		}
255 255
 		// load EEM_Payment_Method
256
-		EE_Registry::instance()->load_model( 'Payment_Method' );
256
+		EE_Registry::instance()->load_model('Payment_Method');
257 257
 		// get all active payment methods
258 258
 		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
259 259
 			$this->checkout->transaction,
@@ -280,16 +280,16 @@  discard block
 block discarded – undo
280 280
 		$insufficient_spaces_available = array();
281 281
 		$no_payment_required = true;
282 282
 		// loop thru registrations to gather info
283
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
283
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
284 284
 		$ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space(
285 285
 			$registrations,
286 286
 			$this->checkout->revisit
287 287
 		);
288
-		foreach ( $registrations as $REG_ID => $registration ) {
288
+		foreach ($registrations as $REG_ID => $registration) {
289 289
             /** @var $registration EE_Registration */
290 290
             // has this registration lost it's space ?
291
-			if ( isset( $ejected_registrations[ $REG_ID ] ) ) {
292
-				$insufficient_spaces_available[ $registration->event()->ID() ] = $registration->event();
291
+			if (isset($ejected_registrations[$REG_ID])) {
292
+				$insufficient_spaces_available[$registration->event()->ID()] = $registration->event();
293 293
 				continue;
294 294
 			}
295 295
             // event requires admin approval
@@ -310,11 +310,11 @@  discard block
 block discarded – undo
310 310
 				&& $registration->status_ID() !== EEM_Registration::status_id_approved
311 311
                 && (
312 312
                     $registration->event()->is_sold_out()
313
-                    || $registration->event()->is_sold_out( true )
313
+                    || $registration->event()->is_sold_out(true)
314 314
                 )
315 315
             ) {
316 316
                 // add event to list of events that are sold out
317
-                $sold_out_events[ $registration->event()->ID() ] = $registration->event();
317
+                $sold_out_events[$registration->event()->ID()] = $registration->event();
318 318
                 do_action(
319 319
                     'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
320 320
                     $registration->event(),
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
                 continue;
324 324
 			}
325 325
 			// are they allowed to pay now and is there monies owing?
326
-			if ( $registration->owes_monies_and_can_pay() ) {
327
-				$registrations_requiring_payment[ $REG_ID ] = $registration;
326
+			if ($registration->owes_monies_and_can_pay()) {
327
+				$registrations_requiring_payment[$REG_ID] = $registration;
328 328
 				do_action(
329 329
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
330 330
 					$registration->event(),
@@ -335,29 +335,29 @@  discard block
 block discarded – undo
335 335
 				&& $registration->status_ID() !== EEM_Registration::status_id_not_approved
336 336
 				&& $registration->ticket()->is_free()
337 337
 			) {
338
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
338
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
339 339
 			}
340 340
 		}
341 341
 		$subsections = array();
342 342
 		// now decide which template to load
343
-		if ( ! empty( $sold_out_events ) ) {
344
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
343
+		if ( ! empty($sold_out_events)) {
344
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
345 345
 		}
346
-		if ( ! empty( $insufficient_spaces_available ) ) {
346
+		if ( ! empty($insufficient_spaces_available)) {
347 347
 			$subsections['insufficient_space'] = $this->_insufficient_spaces_available(
348 348
 				$insufficient_spaces_available
349 349
 			);
350 350
 		}
351
-		if ( ! empty( $registrations_requiring_pre_approval ) ) {
351
+		if ( ! empty($registrations_requiring_pre_approval)) {
352 352
 			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval(
353 353
 				$registrations_requiring_pre_approval
354 354
 			);
355 355
 		}
356
-		if ( ! empty( $registrations_for_free_events ) ) {
357
-			$subsections['no_payment_required'] = $this->_no_payment_required( $registrations_for_free_events );
356
+		if ( ! empty($registrations_for_free_events)) {
357
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
358 358
 		}
359
-		if ( ! empty( $registrations_requiring_payment ) ) {
360
-			if ( $this->checkout->amount_owing > 0 ) {
359
+		if ( ! empty($registrations_requiring_payment)) {
360
+			if ($this->checkout->amount_owing > 0) {
361 361
 				// autoload Line_Item_Display classes
362 362
 				EEH_Autoloader::register_line_item_filter_autoloaders();
363 363
 				$line_item_filter_processor = new EE_Line_Item_Filter_Processor(
@@ -370,15 +370,15 @@  discard block
 block discarded – undo
370 370
 				/** @var EE_Line_Item $filtered_line_item_tree */
371 371
 				$filtered_line_item_tree = $line_item_filter_processor->process();
372 372
 				EEH_Autoloader::register_line_item_display_autoloaders();
373
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
373
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
374 374
 				$subsections['payment_options'] = $this->_display_payment_options(
375 375
 					$this->line_item_display->display_line_item(
376 376
 						$filtered_line_item_tree,
377
-						array( 'registrations' => $registrations )
377
+						array('registrations' => $registrations)
378 378
 					)
379 379
 				);
380 380
 				$this->checkout->amount_owing = $filtered_line_item_tree->total();
381
-				$this->_apply_registration_payments_to_amount_owing( $registrations );
381
+				$this->_apply_registration_payments_to_amount_owing($registrations);
382 382
 			}
383 383
 			$no_payment_required = false;
384 384
 		} else {
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		$this->_save_selected_method_of_payment();
388 388
 
389 389
 		$subsections['default_hidden_inputs'] = $this->reg_step_hidden_inputs();
390
-		$subsections['extra_hidden_inputs' ] = $this->_extra_hidden_inputs( $no_payment_required );
390
+		$subsections['extra_hidden_inputs'] = $this->_extra_hidden_inputs($no_payment_required);
391 391
 
392 392
 		return new EE_Form_Section_Proper(
393 393
 			array(
@@ -414,14 +414,14 @@  discard block
 block discarded – undo
414 414
 	 * @return \EE_Line_Item_Filter_Collection
415 415
 	 * @throws \EE_Error
416 416
 	 */
417
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
418
-		if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) {
417
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
418
+		if ( ! EE_Registry::instance()->SSN instanceof EE_Session) {
419 419
 			return $line_item_filter_collection;
420 420
 		}
421
-		if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout ) {
421
+		if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout) {
422 422
 			return $line_item_filter_collection;
423 423
 		}
424
-		if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction ) {
424
+		if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction) {
425 425
 			return $line_item_filter_collection;
426 426
 		}
427 427
 		$line_item_filter_collection->add(
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 				)
434 434
 			)
435 435
         );
436
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
436
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
437 437
 		return $line_item_filter_collection;
438 438
 	}
439 439
 
@@ -449,15 +449,15 @@  discard block
 block discarded – undo
449 449
 	 * @return \EE_Registration[]
450 450
 	 * @throws \EE_Error
451 451
 	 */
452
-	public static function remove_ejected_registrations( array $registrations ) {
452
+	public static function remove_ejected_registrations(array $registrations) {
453 453
 		$ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space(
454 454
 			$registrations,
455 455
 			EE_Registry::instance()->SSN->checkout()->revisit
456 456
 		);
457
-		foreach ( $registrations as $REG_ID => $registration ) {
457
+		foreach ($registrations as $REG_ID => $registration) {
458 458
 			// has this registration lost it's space ?
459
-			if ( isset( $ejected_registrations[ $REG_ID ] ) ) {
460
-				unset( $registrations[ $REG_ID ] );
459
+			if (isset($ejected_registrations[$REG_ID])) {
460
+				unset($registrations[$REG_ID]);
461 461
 				continue;
462 462
 			}
463 463
 		}
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 	 * @return array
481 481
 	 * @throws \EE_Error
482 482
 	 */
483
-	public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) {
483
+	public static function find_registrations_that_lost_their_space(array $registrations, $revisit = false) {
484 484
         // registrations per event
485 485
 		$event_reg_count = array();
486 486
 		// spaces left per event
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
         $tickets_remaining = array();
490 490
         // registrations that have lost their space
491 491
 		$ejected_registrations = array();
492
-		foreach ( $registrations as $REG_ID => $registration ) {
492
+		foreach ($registrations as $REG_ID => $registration) {
493 493
             if (
494 494
                 $registration->status_ID() === EEM_Registration::status_id_approved
495 495
                 || apply_filters(
@@ -519,13 +519,13 @@  discard block
 block discarded – undo
519 519
 				$revisit
520 520
 				&& (
521 521
                     $tickets_remaining[$ticket->ID()] === 0
522
-				    || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
522
+				    || $event_reg_count[$EVT_ID] > $event_spaces_remaining[$EVT_ID]
523 523
                 )
524 524
 			) {
525
-				$ejected_registrations[ $REG_ID ] = $registration->event();
526
-				if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) {
525
+				$ejected_registrations[$REG_ID] = $registration->event();
526
+				if ($registration->status_ID() !== EEM_Registration::status_id_wait_list) {
527 527
 					/** @type EE_Registration_Processor $registration_processor */
528
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
528
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
529 529
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
530 530
 					$registration_processor->manually_update_registration_status(
531 531
 						$registration,
@@ -560,8 +560,8 @@  discard block
 block discarded – undo
560 560
 	 * @return void
561 561
 	 */
562 562
 	protected function _hide_reg_step_submit_button_if_revisit() {
563
-		if ( $this->checkout->revisit ) {
564
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
563
+		if ($this->checkout->revisit) {
564
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
565 565
 		}
566 566
 	}
567 567
 
@@ -575,13 +575,13 @@  discard block
 block discarded – undo
575 575
 	 * @return \EE_Form_Section_Proper
576 576
 	 * @throws \EE_Error
577 577
 	 */
578
-	private function _sold_out_events( $sold_out_events_array = array() ) {
578
+	private function _sold_out_events($sold_out_events_array = array()) {
579 579
 		// set some defaults
580 580
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
581 581
 		$sold_out_events = '';
582
-		foreach ( $sold_out_events_array as $sold_out_event ) {
582
+		foreach ($sold_out_events_array as $sold_out_event) {
583 583
 			$sold_out_events .= EEH_HTML::li(
584
-				EEH_HTML::span( '  ' .$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )
584
+				EEH_HTML::span('  '.$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')
585 585
 			);
586 586
 		}
587 587
 		return new EE_Form_Section_Proper(
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 								'sold_out_events_msg' => apply_filters(
600 600
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg',
601 601
 									sprintf(
602
-										__( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.%3$s%3$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%2$s', 'event_espresso' ),
602
+										__('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.%3$s%3$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%2$s', 'event_espresso'),
603 603
 										'<strong>',
604 604
 										'</strong>',
605 605
 										'<br />'
@@ -624,14 +624,14 @@  discard block
 block discarded – undo
624 624
 	 * @return \EE_Form_Section_Proper
625 625
 	 * @throws \EE_Error
626 626
 	 */
627
-	private function _insufficient_spaces_available( $insufficient_spaces_events_array = array() ) {
627
+	private function _insufficient_spaces_available($insufficient_spaces_events_array = array()) {
628 628
 		// set some defaults
629 629
 		$this->checkout->selected_method_of_payment = 'invoice';
630 630
 		$insufficient_space_events = '';
631
-		foreach ( $insufficient_spaces_events_array as $event ) {
632
-			if ( $event instanceof EE_Event ) {
631
+		foreach ($insufficient_spaces_events_array as $event) {
632
+			if ($event instanceof EE_Event) {
633 633
 				$insufficient_space_events .= EEH_HTML::li(
634
-					EEH_HTML::span( ' ' . $event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )
634
+					EEH_HTML::span(' '.$event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')
635 635
 				);
636 636
 			}
637 637
 		}
@@ -675,17 +675,17 @@  discard block
 block discarded – undo
675 675
 	 * @return \EE_Form_Section_Proper
676 676
 	 * @throws \EE_Error
677 677
 	 */
678
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array() ) {
678
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
679 679
 		$events_requiring_pre_approval = '';
680
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
681
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
682
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
680
+		foreach ($registrations_requiring_pre_approval as $registration) {
681
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
682
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
683 683
 					EEH_HTML::span(
684 684
 						'',
685 685
 						'',
686 686
 						'dashicons dashicons-marker ee-icon-size-16 orange-text'
687 687
 					)
688
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
688
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
689 689
 				);
690 690
 			}
691 691
 		}
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 						'template_args'        => apply_filters(
701 701
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
702 702
 							array(
703
-								'events_requiring_pre_approval'     => implode( '', $events_requiring_pre_approval ),
703
+								'events_requiring_pre_approval'     => implode('', $events_requiring_pre_approval),
704 704
 								'events_requiring_pre_approval_msg' => apply_filters(
705 705
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
706 706
 									__(
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 	 * @return \EE_Form_Section_Proper
726 726
 	 * @throws \EE_Error
727 727
 	 */
728
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
728
+	private function _no_payment_required($registrations_for_free_events = array()) {
729 729
 		// set some defaults
730 730
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
731 731
 		// generate no_payment_required form
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 								'ticket_count'                  => array(),
746 746
 								'registrations_for_free_events' => $registrations_for_free_events,
747 747
 								'no_payment_required_msg'       => EEH_HTML::p(
748
-									__( 'This is a free event, so no billing will occur.', 'event_espresso' )
748
+									__('This is a free event, so no billing will occur.', 'event_espresso')
749 749
 								)
750 750
 							)
751 751
 						),
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 	 * @return \EE_Form_Section_Proper
765 765
 	 * @throws \EE_Error
766 766
 	 */
767
-	private function _display_payment_options( $transaction_details = '' ) {
767
+	private function _display_payment_options($transaction_details = '') {
768 768
 		// has method_of_payment been set by no-js user?
769 769
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
770 770
 		// build payment options form
@@ -776,14 +776,14 @@  discard block
 block discarded – undo
776 776
 						'before_payment_options' => apply_filters(
777 777
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
778 778
 							new EE_Form_Section_Proper(
779
-								array( 'layout_strategy' => new EE_Div_Per_Section_Layout() )
779
+								array('layout_strategy' => new EE_Div_Per_Section_Layout())
780 780
 							)
781 781
 						),
782 782
 						'payment_options'        => $this->_setup_payment_options(),
783 783
 						'after_payment_options'  => apply_filters(
784 784
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
785 785
 							new EE_Form_Section_Proper(
786
-								array( 'layout_strategy' => new EE_Div_Per_Section_Layout() )
786
+								array('layout_strategy' => new EE_Div_Per_Section_Layout())
787 787
 							)
788 788
 						),
789 789
 					),
@@ -814,10 +814,10 @@  discard block
 block discarded – undo
814 814
 	 * @return \EE_Form_Section_Proper
815 815
 	 * @throws \EE_Error
816 816
 	 */
817
-	private function _extra_hidden_inputs( $no_payment_required = true ) {
817
+	private function _extra_hidden_inputs($no_payment_required = true) {
818 818
 		return new EE_Form_Section_Proper(
819 819
 			array(
820
-				'html_id'         => 'ee-' . $this->slug() . '-extra-hidden-inputs',
820
+				'html_id'         => 'ee-'.$this->slug().'-extra-hidden-inputs',
821 821
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
822 822
 				'subsections'     => array(
823 823
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -849,16 +849,16 @@  discard block
 block discarded – undo
849 849
 	 * @access protected
850 850
 	 * @param array $registrations
851 851
 	 */
852
-	protected function _apply_registration_payments_to_amount_owing( array $registrations ) {
852
+	protected function _apply_registration_payments_to_amount_owing(array $registrations) {
853 853
 		$payments = array();
854
-		foreach ( $registrations as $registration ) {
855
-			if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
854
+		foreach ($registrations as $registration) {
855
+			if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
856 856
 				$payments += $registration->registration_payments();
857 857
 			}
858 858
 		}
859
-		if ( ! empty( $payments ) ) {
860
-			foreach ( $payments as $payment ) {
861
-				if ( $payment instanceof EE_Registration_Payment ) {
859
+		if ( ! empty($payments)) {
860
+			foreach ($payments as $payment) {
861
+				if ($payment instanceof EE_Registration_Payment) {
862 862
 					$this->checkout->amount_owing -= $payment->amount();
863 863
 				}
864 864
 			}
@@ -874,11 +874,11 @@  discard block
 block discarded – undo
874 874
 	 * @param    bool $force_reset
875 875
 	 * @return    void
876 876
 	 */
877
-	private function _reset_selected_method_of_payment( $force_reset = false ) {
877
+	private function _reset_selected_method_of_payment($force_reset = false) {
878 878
 		$reset_payment_method = $force_reset
879 879
 			? true
880
-			: sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', false ) );
881
-		if ( $reset_payment_method ) {
880
+			: sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', false));
881
+		if ($reset_payment_method) {
882 882
 			$this->checkout->selected_method_of_payment = null;
883 883
 			$this->checkout->payment_method = null;
884 884
 			$this->checkout->billing_form = null;
@@ -897,12 +897,12 @@  discard block
 block discarded – undo
897 897
 	 * @param string $selected_method_of_payment
898 898
 	 * @return  void
899 899
 	 */
900
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
901
-		$selected_method_of_payment = ! empty( $selected_method_of_payment )
900
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
901
+		$selected_method_of_payment = ! empty($selected_method_of_payment)
902 902
 			? $selected_method_of_payment
903 903
 			: $this->checkout->selected_method_of_payment;
904 904
 		EE_Registry::instance()->SSN->set_session_data(
905
-			array( 'selected_method_of_payment' => $selected_method_of_payment )
905
+			array('selected_method_of_payment' => $selected_method_of_payment)
906 906
 		);
907 907
 	}
908 908
 
@@ -918,19 +918,19 @@  discard block
 block discarded – undo
918 918
 		// load payment method classes
919 919
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
920 920
 		// switch up header depending on number of available payment methods
921
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
921
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
922 922
 			? apply_filters(
923 923
 				'FHEE__registration_page_payment_options__method_of_payment_hdr',
924
-				__( 'Please Select Your Method of Payment', 'event_espresso' )
924
+				__('Please Select Your Method of Payment', 'event_espresso')
925 925
 			)
926 926
 			: apply_filters(
927 927
 				'FHEE__registration_page_payment_options__method_of_payment_hdr',
928
-				__( 'Method of Payment', 'event_espresso' )
928
+				__('Method of Payment', 'event_espresso')
929 929
 			);
930 930
 		$available_payment_methods = array(
931 931
 			// display the "Payment Method" header
932 932
 			'payment_method_header' => new EE_Form_Section_HTML(
933
-				EEH_HTML::h4( $payment_method_header, 'method-of-payment-hdr' )
933
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
934 934
 			)
935 935
 		);
936 936
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
@@ -939,32 +939,32 @@  discard block
 block discarded – undo
939 939
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
940 940
 		$payment_methods_billing_info = array(
941 941
 			new EE_Form_Section_HTML(
942
-				EEH_HTML::div( '<br />', '', '', 'clear:both;' )
942
+				EEH_HTML::div('<br />', '', '', 'clear:both;')
943 943
 			)
944 944
 		);
945 945
 		// loop through payment methods
946
-		foreach ( $this->checkout->available_payment_methods as $payment_method ) {
947
-			if ( $payment_method instanceof EE_Payment_Method ) {
946
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
947
+			if ($payment_method instanceof EE_Payment_Method) {
948 948
 				$payment_method_button = EEH_HTML::img(
949 949
 					$payment_method->button_url(),
950 950
 					$payment_method->name(),
951
-					'spco-payment-method-' . $payment_method->slug() . '-btn-img',
951
+					'spco-payment-method-'.$payment_method->slug().'-btn-img',
952 952
 					'spco-payment-method-btn-img'
953 953
 				);
954 954
 				// check if any payment methods are set as default
955 955
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
956 956
 				if (
957
-					( $this->checkout->selected_method_of_payment === $payment_method->slug() )
958
-					|| ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )
957
+					($this->checkout->selected_method_of_payment === $payment_method->slug())
958
+					|| ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())
959 959
 				) {
960 960
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
961 961
 					$this->_save_selected_method_of_payment();
962
-					$default_payment_method_option[ $payment_method->slug() ] = $payment_method_button;
962
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
963 963
 				} else {
964
-					$available_payment_method_options[ $payment_method->slug() ] = $payment_method_button;
964
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
965 965
 				}
966
-				$payment_methods_billing_info[ $payment_method->slug()
967
-				                               . '-info' ] = $this->_payment_method_billing_info(
966
+				$payment_methods_billing_info[$payment_method->slug()
967
+				                               . '-info'] = $this->_payment_method_billing_info(
968 968
 					$payment_method
969 969
 				);
970 970
 			}
@@ -994,12 +994,12 @@  discard block
 block discarded – undo
994 994
 	 * @return EE_Payment_Method[]
995 995
 	 */
996 996
 	protected function _get_available_payment_methods() {
997
-		if ( ! empty( $this->checkout->available_payment_methods ) ) {
997
+		if ( ! empty($this->checkout->available_payment_methods)) {
998 998
 			return $this->checkout->available_payment_methods;
999 999
 		}
1000 1000
 		$available_payment_methods = array();
1001 1001
 		// load EEM_Payment_Method
1002
-		EE_Registry::instance()->load_model( 'Payment_Method' );
1002
+		EE_Registry::instance()->load_model('Payment_Method');
1003 1003
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
1004 1004
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1005 1005
 		// get all active payment methods
@@ -1007,9 +1007,9 @@  discard block
 block discarded – undo
1007 1007
 			$this->checkout->transaction,
1008 1008
 			EEM_Payment_Method::scope_cart
1009 1009
 		);
1010
-		foreach ( $payment_methods as $payment_method ) {
1011
-			if ( $payment_method instanceof EE_Payment_Method ) {
1012
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
1010
+		foreach ($payment_methods as $payment_method) {
1011
+			if ($payment_method instanceof EE_Payment_Method) {
1012
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
1013 1013
 			}
1014 1014
 		}
1015 1015
 		return $available_payment_methods;
@@ -1024,14 +1024,14 @@  discard block
 block discarded – undo
1024 1024
 	 * @param    array $available_payment_method_options
1025 1025
 	 * @return    \EE_Form_Section_Proper
1026 1026
 	 */
1027
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
1027
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
1028 1028
 		// generate inputs
1029 1029
 		return new EE_Form_Section_Proper(
1030 1030
 			array(
1031 1031
 				'html_id'         => 'ee-available-payment-method-inputs',
1032 1032
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
1033 1033
 				'subsections'     => array(
1034
-					'' => new EE_Radio_Button_Input (
1034
+					'' => new EE_Radio_Button_Input(
1035 1035
 						$available_payment_method_options,
1036 1036
 						array(
1037 1037
 							'html_name'          => 'selected_method_of_payment',
@@ -1056,28 +1056,28 @@  discard block
 block discarded – undo
1056 1056
 	 * @return    \EE_Form_Section_Proper
1057 1057
 	 * @throws \EE_Error
1058 1058
 	 */
1059
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
1059
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
1060 1060
 		$currently_selected = $this->checkout->selected_method_of_payment === $payment_method->slug()
1061 1061
 			? true
1062 1062
 			: false;
1063 1063
 		// generate the billing form for payment method
1064 1064
 		$billing_form = $currently_selected
1065
-			? $this->_get_billing_form_for_payment_method( $payment_method )
1065
+			? $this->_get_billing_form_for_payment_method($payment_method)
1066 1066
 			: new EE_Form_Section_HTML();
1067 1067
 		$this->checkout->billing_form = $currently_selected
1068 1068
 			? $billing_form
1069 1069
 			: $this->checkout->billing_form;
1070 1070
 		// it's all in the details
1071 1071
 		$info_html = EEH_HTML::h3(
1072
-			__( 'Important information regarding your payment', 'event_espresso' ),
1072
+			__('Important information regarding your payment', 'event_espresso'),
1073 1073
 			'',
1074 1074
 			'spco-payment-method-hdr'
1075 1075
 		);
1076 1076
 		// add some info regarding the step, either from what's saved in the admin,
1077 1077
 		// or a default string depending on whether the PM has a billing form or not
1078
-		if ( $payment_method->description() ) {
1078
+		if ($payment_method->description()) {
1079 1079
 			$payment_method_info = $payment_method->description();
1080
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
1080
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
1081 1081
 			$payment_method_info = sprintf(
1082 1082
 				__(
1083 1083
 					'Please provide the following billing information, then click the "%1$s" button below in order to proceed.',
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 			);
1088 1088
 		} else {
1089 1089
 			$payment_method_info = sprintf(
1090
-				__( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ),
1090
+				__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'),
1091 1091
 				$this->submit_button_text()
1092 1092
 			);
1093 1093
 		}
@@ -1101,13 +1101,13 @@  discard block
 block discarded – undo
1101 1101
 		);
1102 1102
 		return new EE_Form_Section_Proper(
1103 1103
 			array(
1104
-				'html_id'         => 'spco-payment-method-info-' . $payment_method->slug(),
1104
+				'html_id'         => 'spco-payment-method-info-'.$payment_method->slug(),
1105 1105
 				'html_class'      => 'spco-payment-method-info-dv',
1106 1106
 				// only display the selected or default PM
1107 1107
 				'html_style'      => $currently_selected ? '' : 'display:none;',
1108 1108
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
1109 1109
 				'subsections'     => array(
1110
-					'info'         => new EE_Form_Section_HTML( $info_html ),
1110
+					'info'         => new EE_Form_Section_HTML($info_html),
1111 1111
 					'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML()
1112 1112
 				)
1113 1113
 			)
@@ -1125,15 +1125,15 @@  discard block
 block discarded – undo
1125 1125
 	 */
1126 1126
 	public function get_billing_form_html_for_payment_method() {
1127 1127
 		// how have they chosen to pay?
1128
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1128
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1129 1129
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
1130
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
1130
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
1131 1131
 			return false;
1132 1132
 		}
1133
-		if ( apply_filters(
1133
+		if (apply_filters(
1134 1134
 			'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1135 1135
 			false
1136
-		) ) {
1136
+		)) {
1137 1137
 			EE_Error::add_success(
1138 1138
 				apply_filters(
1139 1139
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 			);
1149 1149
 		}
1150 1150
 		// now generate billing form for selected method of payment
1151
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1151
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1152 1152
 		// fill form with attendee info if applicable
1153 1153
 		if (
1154 1154
 			$payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form
@@ -1170,10 +1170,10 @@  discard block
 block discarded – undo
1170 1170
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper
1171 1171
 			? $payment_method_billing_form->get_html()
1172 1172
 			: '';
1173
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ) );
1173
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
1174 1174
 		// localize validation rules for main form
1175 1175
 		$this->checkout->current_step->reg_form->localize_validation_rules();
1176
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
1176
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
1177 1177
 		return true;
1178 1178
 	}
1179 1179
 
@@ -1187,18 +1187,18 @@  discard block
 block discarded – undo
1187 1187
 	 * @return \EE_Billing_Info_Form|\EE_Form_Section_HTML
1188 1188
 	 * @throws \EE_Error
1189 1189
 	 */
1190
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
1190
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
1191 1191
 		$billing_form = $payment_method->type_obj()->billing_form(
1192 1192
 			$this->checkout->transaction,
1193
-			array( 'amount_owing' => $this->checkout->amount_owing )
1193
+			array('amount_owing' => $this->checkout->amount_owing)
1194 1194
 		);
1195
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
1195
+		if ($billing_form instanceof EE_Billing_Info_Form) {
1196 1196
 			if (
1197 1197
 				apply_filters(
1198 1198
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1199 1199
 					false
1200 1200
 				)
1201
-				&& EE_Registry::instance()->REQ->is_set( 'payment_method' )
1201
+				&& EE_Registry::instance()->REQ->is_set('payment_method')
1202 1202
 			) {
1203 1203
 				EE_Error::add_success(
1204 1204
 					apply_filters(
@@ -1240,15 +1240,15 @@  discard block
 block discarded – undo
1240 1240
 		$request_param = 'selected_method_of_payment'
1241 1241
 	) {
1242 1242
 		// is selected_method_of_payment set in the request ?
1243
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, false );
1244
-		if ( $selected_method_of_payment ) {
1243
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, false);
1244
+		if ($selected_method_of_payment) {
1245 1245
 			// sanitize it
1246
-			$selected_method_of_payment = is_array( $selected_method_of_payment )
1247
-				? array_shift( $selected_method_of_payment )
1246
+			$selected_method_of_payment = is_array($selected_method_of_payment)
1247
+				? array_shift($selected_method_of_payment)
1248 1248
 				: $selected_method_of_payment;
1249
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
1249
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
1250 1250
 			// store it in the session so that it's available for all subsequent requests including AJAX
1251
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
1251
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
1252 1252
 		} else {
1253 1253
 			// or is is set in the session ?
1254 1254
 			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data(
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
 			);
1257 1257
 		}
1258 1258
 		// do ya really really gotta have it?
1259
-		if ( empty( $selected_method_of_payment ) && $required ) {
1259
+		if (empty($selected_method_of_payment) && $required) {
1260 1260
 			EE_Error::add_error(
1261 1261
 				sprintf(
1262 1262
 					__(
@@ -1265,7 +1265,7 @@  discard block
 block discarded – undo
1265 1265
 					),
1266 1266
 					'<br/>',
1267 1267
 					'<br/>',
1268
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1268
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1269 1269
 				),
1270 1270
 				__FILE__,
1271 1271
 				__FUNCTION__,
@@ -1292,13 +1292,13 @@  discard block
 block discarded – undo
1292 1292
 	 * @throws \EE_Error
1293 1293
 	 */
1294 1294
 	public function switch_payment_method() {
1295
-		if ( ! $this->_verify_payment_method_is_set() ) {
1295
+		if ( ! $this->_verify_payment_method_is_set()) {
1296 1296
 			return false;
1297 1297
 		}
1298
-		if ( apply_filters(
1298
+		if (apply_filters(
1299 1299
 			'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1300 1300
 			false
1301
-		) ) {
1301
+		)) {
1302 1302
 			EE_Error::add_success(
1303 1303
 				apply_filters(
1304 1304
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -1313,7 +1313,7 @@  discard block
 block discarded – undo
1313 1313
 			);
1314 1314
 		}
1315 1315
 		// generate billing form for selected method of payment if it hasn't been done already
1316
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1316
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
1317 1317
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1318 1318
 				$this->checkout->payment_method
1319 1319
 			);
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 			);
1336 1336
 		}
1337 1337
 		// and debug content
1338
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form
1338
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form
1339 1339
 		     && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1340 1340
 		) {
1341 1341
 			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
@@ -1343,15 +1343,15 @@  discard block
 block discarded – undo
1343 1343
 			);
1344 1344
 		}
1345 1345
 		// get html and validation rules for form
1346
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
1346
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
1347 1347
 			$this->checkout->json_response->set_return_data(
1348
-				array( 'payment_method_info' => $this->checkout->billing_form->get_html() )
1348
+				array('payment_method_info' => $this->checkout->billing_form->get_html())
1349 1349
 			);
1350 1350
 			// localize validation rules for main form
1351
-			$this->checkout->billing_form->localize_validation_rules( true );
1352
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
1351
+			$this->checkout->billing_form->localize_validation_rules(true);
1352
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
1353 1353
 		} else {
1354
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ) );
1354
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
1355 1355
 		}
1356 1356
 		//prevents advancement to next step
1357 1357
 		$this->checkout->continue_reg = false;
@@ -1368,18 +1368,18 @@  discard block
 block discarded – undo
1368 1368
 	 */
1369 1369
 	protected function _verify_payment_method_is_set() {
1370 1370
 		// generate billing form for selected method of payment if it hasn't been done already
1371
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1371
+		if (empty($this->checkout->selected_method_of_payment)) {
1372 1372
 			// how have they chosen to pay?
1373
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1373
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1374 1374
 		} else {
1375 1375
 			// choose your own adventure based on method_of_payment
1376
-			switch ( $this->checkout->selected_method_of_payment ) {
1376
+			switch ($this->checkout->selected_method_of_payment) {
1377 1377
 				case 'events_sold_out' :
1378 1378
 					EE_Error::add_attention(
1379 1379
 						apply_filters(
1380 1380
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__sold_out_events_msg',
1381
-							__( 'It appears that the event you were about to make a payment for has sold out since this form first loaded. Please contact the event administrator if you believe this is an error.',
1382
-								'event_espresso' )
1381
+							__('It appears that the event you were about to make a payment for has sold out since this form first loaded. Please contact the event administrator if you believe this is an error.',
1382
+								'event_espresso')
1383 1383
 						),
1384 1384
 						__FILE__, __FUNCTION__, __LINE__
1385 1385
 					);
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 					EE_Error::add_attention(
1390 1390
 						apply_filters(
1391 1391
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__payments_closed_msg',
1392
-							__( 'It appears that the event you were about to make a payment for is not accepting payments at this time. Please contact the event administrator if you believe this is an error.', 'event_espresso' )
1392
+							__('It appears that the event you were about to make a payment for is not accepting payments at this time. Please contact the event administrator if you believe this is an error.', 'event_espresso')
1393 1393
 						),
1394 1394
 						__FILE__, __FUNCTION__, __LINE__
1395 1395
 					);
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 					EE_Error::add_attention(
1400 1400
 						apply_filters(
1401 1401
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__no_payment_required_msg',
1402
-							__( 'It appears that the event you were about to make a payment for does not require payment. Please contact the event administrator if you believe this is an error.', 'event_espresso' )
1402
+							__('It appears that the event you were about to make a payment for does not require payment. Please contact the event administrator if you believe this is an error.', 'event_espresso')
1403 1403
 						),
1404 1404
 						__FILE__, __FUNCTION__, __LINE__
1405 1405
 					);
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 			}
1410 1410
 		}
1411 1411
 		// verify payment method
1412
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
1412
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
1413 1413
 			// get payment method for selected method of payment
1414 1414
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
1415 1415
 		}
@@ -1428,25 +1428,25 @@  discard block
 block discarded – undo
1428 1428
 	 * @throws \EE_Error
1429 1429
 	 */
1430 1430
 	public function save_payer_details_via_ajax() {
1431
-		if ( ! $this->_verify_payment_method_is_set() ) {
1431
+		if ( ! $this->_verify_payment_method_is_set()) {
1432 1432
 			return;
1433 1433
 		}
1434 1434
 		// generate billing form for selected method of payment if it hasn't been done already
1435
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1435
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
1436 1436
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1437 1437
 				$this->checkout->payment_method
1438 1438
 			);
1439 1439
 		}
1440 1440
 		// generate primary attendee from payer info if applicable
1441
-		if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1441
+		if ( ! $this->checkout->transaction_has_primary_registrant()) {
1442 1442
 			$attendee = $this->_create_attendee_from_request_data();
1443
-			if ( $attendee instanceof EE_Attendee ) {
1444
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
1445
-					if ( $registration->is_primary_registrant() ) {
1443
+			if ($attendee instanceof EE_Attendee) {
1444
+				foreach ($this->checkout->transaction->registrations() as $registration) {
1445
+					if ($registration->is_primary_registrant()) {
1446 1446
 						$this->checkout->primary_attendee_obj = $attendee;
1447
-						$registration->_add_relation_to( $attendee, 'Attendee' );
1448
-						$registration->set_attendee_id( $attendee->ID() );
1449
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
1447
+						$registration->_add_relation_to($attendee, 'Attendee');
1448
+						$registration->set_attendee_id($attendee->ID());
1449
+						$registration->update_cache_after_object_save('Attendee', $attendee);
1450 1450
 					}
1451 1451
 				}
1452 1452
 			}
@@ -1464,50 +1464,50 @@  discard block
 block discarded – undo
1464 1464
 	 */
1465 1465
 	protected function _create_attendee_from_request_data() {
1466 1466
 		// get State ID
1467
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
1468
-		if ( ! empty( $STA_ID ) ) {
1467
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
1468
+		if ( ! empty($STA_ID)) {
1469 1469
 			// can we get state object from name ?
1470
-			EE_Registry::instance()->load_model( 'State' );
1471
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1 ), 'STA_ID' );
1472
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
1470
+			EE_Registry::instance()->load_model('State');
1471
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
1472
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
1473 1473
 		}
1474 1474
 		// get Country ISO
1475
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
1476
-		if ( ! empty( $CNT_ISO ) ) {
1475
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
1476
+		if ( ! empty($CNT_ISO)) {
1477 1477
 			// can we get country object from name ?
1478
-			EE_Registry::instance()->load_model( 'Country' );
1478
+			EE_Registry::instance()->load_model('Country');
1479 1479
 			$country = EEM_Country::instance()->get_col(
1480
-				array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1 ),
1480
+				array(array('CNT_name' => $CNT_ISO), 'limit' => 1),
1481 1481
 				'CNT_ISO'
1482 1482
 			);
1483
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
1483
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
1484 1484
 		}
1485 1485
 		// grab attendee data
1486 1486
 		$attendee_data = array(
1487
-			'ATT_fname'    => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
1488
-			'ATT_lname'    => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
1489
-			'ATT_email'    => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1490
-			'ATT_address'  => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1491
-			'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1492
-			'ATT_city'     => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
1487
+			'ATT_fname'    => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
1488
+			'ATT_lname'    => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
1489
+			'ATT_email'    => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1490
+			'ATT_address'  => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1491
+			'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1492
+			'ATT_city'     => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1493 1493
 			'STA_ID'       => $STA_ID,
1494 1494
 			'CNT_ISO'      => $CNT_ISO,
1495
-			'ATT_zip'      => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1496
-			'ATT_phone'    => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1495
+			'ATT_zip'      => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1496
+			'ATT_phone'    => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1497 1497
 		);
1498 1498
 		// validate the email address since it is the most important piece of info
1499
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] !== $_REQUEST['email'] ) {
1499
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] !== $_REQUEST['email']) {
1500 1500
 			EE_Error::add_error(
1501
-				__( 'An invalid email address was submitted.', 'event_espresso' ),
1501
+				__('An invalid email address was submitted.', 'event_espresso'),
1502 1502
 				__FILE__,
1503 1503
 				__FUNCTION__,
1504 1504
 				__LINE__
1505 1505
 			);
1506 1506
 		}
1507 1507
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1508
-		if ( ! empty( $attendee_data['ATT_fname'] )
1509
-		     && ! empty( $attendee_data['ATT_lname'] )
1510
-		     && ! empty( $attendee_data['ATT_email'] )
1508
+		if ( ! empty($attendee_data['ATT_fname'])
1509
+		     && ! empty($attendee_data['ATT_lname'])
1510
+		     && ! empty($attendee_data['ATT_email'])
1511 1511
 		) {
1512 1512
 			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(
1513 1513
 				array(
@@ -1516,19 +1516,19 @@  discard block
 block discarded – undo
1516 1516
 					'ATT_email' => $attendee_data['ATT_email']
1517 1517
 				)
1518 1518
 			);
1519
-			if ( $existing_attendee instanceof EE_Attendee ) {
1519
+			if ($existing_attendee instanceof EE_Attendee) {
1520 1520
 				return $existing_attendee;
1521 1521
 			}
1522 1522
 		}
1523 1523
 		// no existing attendee? kk let's create a new one
1524 1524
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1525
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] )
1525
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname'])
1526 1526
 			? $attendee_data['ATT_fname']
1527 1527
 			: $attendee_data['ATT_email'];
1528
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] )
1528
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname'])
1529 1529
 			? $attendee_data['ATT_lname']
1530 1530
 			: $attendee_data['ATT_email'];
1531
-		return EE_Attendee::new_instance( $attendee_data );
1531
+		return EE_Attendee::new_instance($attendee_data);
1532 1532
 	}
1533 1533
 
1534 1534
 
@@ -1546,26 +1546,26 @@  discard block
 block discarded – undo
1546 1546
 		// how have they chosen to pay?
1547 1547
 		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free()
1548 1548
 			? 'no_payment_required'
1549
-			: $this->_get_selected_method_of_payment( true );
1549
+			: $this->_get_selected_method_of_payment(true);
1550 1550
 		// choose your own adventure based on method_of_payment
1551
-		switch ( $this->checkout->selected_method_of_payment ) {
1551
+		switch ($this->checkout->selected_method_of_payment) {
1552 1552
 
1553 1553
 			case 'events_sold_out' :
1554 1554
 				$this->checkout->redirect = true;
1555 1555
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1556
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1556
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1557 1557
 				// mark this reg step as completed
1558 1558
 				$this->set_completed();
1559 1559
 				return false;
1560 1560
 				break;
1561 1561
 
1562 1562
 			case 'payments_closed' :
1563
-				if ( apply_filters(
1563
+				if (apply_filters(
1564 1564
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success',
1565 1565
 					false
1566
-				) ) {
1566
+				)) {
1567 1567
 					EE_Error::add_success(
1568
-						__( 'no payment required at this time.', 'event_espresso' ),
1568
+						__('no payment required at this time.', 'event_espresso'),
1569 1569
 						__FILE__,
1570 1570
 						__FUNCTION__,
1571 1571
 						__LINE__
@@ -1577,12 +1577,12 @@  discard block
 block discarded – undo
1577 1577
 				break;
1578 1578
 
1579 1579
 			case 'no_payment_required' :
1580
-				if ( apply_filters(
1580
+				if (apply_filters(
1581 1581
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success',
1582 1582
 					false
1583
-				) ) {
1583
+				)) {
1584 1584
 					EE_Error::add_success(
1585
-						__( 'no payment required.', 'event_espresso' ),
1585
+						__('no payment required.', 'event_espresso'),
1586 1586
 						__FILE__,
1587 1587
 						__FUNCTION__,
1588 1588
 						__LINE__
@@ -1602,15 +1602,15 @@  discard block
 block discarded – undo
1602 1602
 					EE_Registry::instance()->SSN->checkout()->revisit
1603 1603
 				);
1604 1604
 				// calculate difference between the two arrays
1605
-				$registrations = array_diff( $registrations, $ejected_registrations );
1606
-				if ( empty( $registrations ) ) {
1605
+				$registrations = array_diff($registrations, $ejected_registrations);
1606
+				if (empty($registrations)) {
1607 1607
 					$this->_redirect_because_event_sold_out();
1608 1608
 					return false;
1609 1609
 				}
1610 1610
 				$payment_successful = $this->_process_payment();
1611
-				if ( $payment_successful ) {
1611
+				if ($payment_successful) {
1612 1612
 					$this->checkout->continue_reg = true;
1613
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1613
+					$this->_maybe_set_completed($this->checkout->payment_method);
1614 1614
 				} else {
1615 1615
 					$this->checkout->continue_reg = false;
1616 1616
 				}
@@ -1631,10 +1631,10 @@  discard block
 block discarded – undo
1631 1631
 		$this->checkout->continue_reg = false;
1632 1632
 		// set redirect URL
1633 1633
 		$this->checkout->redirect_url = add_query_arg(
1634
-			array( 'e_reg_url_link' => $this->checkout->reg_url_link ),
1634
+			array('e_reg_url_link' => $this->checkout->reg_url_link),
1635 1635
 			$this->checkout->current_step->reg_step_url()
1636 1636
 		);
1637
-		$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1637
+		$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1638 1638
 	}
1639 1639
 
1640 1640
 
@@ -1647,8 +1647,8 @@  discard block
 block discarded – undo
1647 1647
 	 * @return void
1648 1648
 	 * @throws \EE_Error
1649 1649
 	 */
1650
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1651
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1650
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1651
+		switch ($payment_method->type_obj()->payment_occurs()) {
1652 1652
 			case EE_PMT_Base::offsite :
1653 1653
 				break;
1654 1654
 			case EE_PMT_Base::onsite :
@@ -1671,7 +1671,7 @@  discard block
 block discarded – undo
1671 1671
 	public function update_reg_step() {
1672 1672
 		$success = true;
1673 1673
 		// if payment required
1674
-		if ( $this->checkout->transaction->total() > 0 ) {
1674
+		if ($this->checkout->transaction->total() > 0) {
1675 1675
 			do_action(
1676 1676
 				'AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway',
1677 1677
 				$this->checkout->transaction
@@ -1679,13 +1679,13 @@  discard block
 block discarded – undo
1679 1679
 			// attempt payment via payment method
1680 1680
 			$success = $this->process_reg_step();
1681 1681
 		}
1682
-		if ( $success && ! $this->checkout->redirect ) {
1682
+		if ($success && ! $this->checkout->redirect) {
1683 1683
 			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn(
1684 1684
 				$this->checkout->transaction->ID()
1685 1685
 			);
1686 1686
 			// set return URL
1687 1687
 			$this->checkout->redirect_url = add_query_arg(
1688
-				array( 'e_reg_url_link' => $this->checkout->reg_url_link ),
1688
+				array('e_reg_url_link' => $this->checkout->reg_url_link),
1689 1689
 				$this->checkout->thank_you_page_url
1690 1690
 			);
1691 1691
 		}
@@ -1703,36 +1703,36 @@  discard block
 block discarded – undo
1703 1703
 	 */
1704 1704
 	private function _process_payment() {
1705 1705
 		// basically confirm that the event hasn't sold out since they hit the page
1706
-		if ( ! $this->_last_second_ticket_verifications() ) {
1706
+		if ( ! $this->_last_second_ticket_verifications()) {
1707 1707
 			return false;
1708 1708
 		}
1709 1709
 		// ya gotta make a choice man
1710
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1710
+		if (empty($this->checkout->selected_method_of_payment)) {
1711 1711
 			$this->checkout->json_response->set_plz_select_method_of_payment(
1712
-				__( 'Please select a method of payment before proceeding.', 'event_espresso' )
1712
+				__('Please select a method of payment before proceeding.', 'event_espresso')
1713 1713
 			);
1714 1714
 			return false;
1715 1715
 		}
1716 1716
 		// get EE_Payment_Method object
1717
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1717
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1718 1718
 			return false;
1719 1719
 		}
1720 1720
 		// setup billing form
1721
-		if ( $this->checkout->payment_method->is_on_site() ) {
1721
+		if ($this->checkout->payment_method->is_on_site()) {
1722 1722
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1723 1723
 				$this->checkout->payment_method
1724 1724
 			);
1725 1725
 			// bad billing form ?
1726
-			if ( ! $this->_billing_form_is_valid() ) {
1726
+			if ( ! $this->_billing_form_is_valid()) {
1727 1727
 				return false;
1728 1728
 			}
1729 1729
 		}
1730 1730
 		// ensure primary registrant has been fully processed
1731
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1731
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1732 1732
 			return false;
1733 1733
 		}
1734 1734
 		// if session is close to expiring (under 10 minutes by default)
1735
-		if ( ( time() - EE_Registry::instance()->SSN->expiration() ) < EE_Registry::instance()->SSN->extension() ) {
1735
+		if ((time() - EE_Registry::instance()->SSN->expiration()) < EE_Registry::instance()->SSN->extension()) {
1736 1736
 			// add some time to session expiration so that payment can be completed
1737 1737
 			EE_Registry::instance()->SSN->extend_expiration();
1738 1738
 		}
@@ -1741,12 +1741,12 @@  discard block
 block discarded – undo
1741 1741
 		// in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved
1742 1742
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1743 1743
 		// attempt payment
1744
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1744
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1745 1745
 		// process results
1746
-		$payment = $this->_validate_payment( $payment );
1747
-		$payment = $this->_post_payment_processing( $payment );
1746
+		$payment = $this->_validate_payment($payment);
1747
+		$payment = $this->_post_payment_processing($payment);
1748 1748
 		// verify payment
1749
-		if ( $payment instanceof EE_Payment ) {
1749
+		if ($payment instanceof EE_Payment) {
1750 1750
 			// store that for later
1751 1751
 			$this->checkout->payment = $payment;
1752 1752
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
@@ -1760,7 +1760,7 @@  discard block
 block discarded – undo
1760 1760
 			} else {
1761 1761
 				return false;
1762 1762
 			}
1763
-		} else if ( $payment === true ) {
1763
+		} else if ($payment === true) {
1764 1764
 			// please note that offline payment methods will NOT make a payment,
1765 1765
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1766 1766
 			$this->checkout->payment = $payment;
@@ -1780,22 +1780,22 @@  discard block
 block discarded – undo
1780 1780
 	 */
1781 1781
 	protected function _last_second_ticket_verifications() {
1782 1782
 		// don't bother re-validating if not a return visit
1783
-		if ( ! $this->checkout->revisit ) {
1783
+		if ( ! $this->checkout->revisit) {
1784 1784
 			return true;
1785 1785
 		}
1786 1786
 		$registrations = $this->checkout->transaction->registrations();
1787
-		if ( empty( $registrations ) ) {
1787
+		if (empty($registrations)) {
1788 1788
 			return false;
1789 1789
 		}
1790
-		foreach ( $registrations as $registration ) {
1791
-			if ( $registration instanceof EE_Registration ) {
1790
+		foreach ($registrations as $registration) {
1791
+			if ($registration instanceof EE_Registration) {
1792 1792
 				$event = $registration->event_obj();
1793
-				if ( $event instanceof EE_Event && $event->is_sold_out( true ) ) {
1793
+				if ($event instanceof EE_Event && $event->is_sold_out(true)) {
1794 1794
 					EE_Error::add_error(
1795 1795
 						apply_filters(
1796 1796
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___last_second_ticket_verifications__sold_out_events_msg',
1797 1797
 							sprintf(
1798
-								__( 'It appears that the %1$s event that you were about to make a payment for has sold out since you first registered and/or arrived at this page. Please refresh the page and try again. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' ),
1798
+								__('It appears that the %1$s event that you were about to make a payment for has sold out since you first registered and/or arrived at this page. Please refresh the page and try again. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso'),
1799 1799
 								$event->name()
1800 1800
 							)
1801 1801
 						),
@@ -1825,7 +1825,7 @@  discard block
 block discarded – undo
1825 1825
 		);
1826 1826
 		$html = $payment_method_billing_info->get_html();
1827 1827
 		$html .= $this->checkout->redirect_form;
1828
-		EE_Registry::instance()->REQ->add_output( $html );
1828
+		EE_Registry::instance()->REQ->add_output($html);
1829 1829
 		return true;
1830 1830
 	}
1831 1831
 
@@ -1839,28 +1839,28 @@  discard block
 block discarded – undo
1839 1839
 	 * @throws \EE_Error
1840 1840
 	 */
1841 1841
 	private function _billing_form_is_valid() {
1842
-		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1842
+		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) {
1843 1843
 			return true;
1844 1844
 		}
1845
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1846
-			if ( $this->checkout->billing_form->was_submitted() ) {
1845
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1846
+			if ($this->checkout->billing_form->was_submitted()) {
1847 1847
 				$this->checkout->billing_form->receive_form_submission();
1848
-				if ( $this->checkout->billing_form->is_valid() ) {
1848
+				if ($this->checkout->billing_form->is_valid()) {
1849 1849
 					return true;
1850 1850
 				}
1851 1851
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1852 1852
 				$error_strings = array();
1853
-				foreach ( $validation_errors as $validation_error ) {
1854
-					if ( $validation_error instanceof EE_Validation_Error ) {
1853
+				foreach ($validation_errors as $validation_error) {
1854
+					if ($validation_error instanceof EE_Validation_Error) {
1855 1855
 						$form_section = $validation_error->get_form_section();
1856
-						if ( $form_section instanceof EE_Form_Input_Base ) {
1856
+						if ($form_section instanceof EE_Form_Input_Base) {
1857 1857
 							$label = $form_section->html_label_text();
1858
-						} elseif ( $form_section instanceof EE_Form_Section_Base ) {
1858
+						} elseif ($form_section instanceof EE_Form_Section_Base) {
1859 1859
 							$label = $form_section->name();
1860 1860
 						} else {
1861
-							$label = __( 'Validation Error', 'event_espresso' );
1861
+							$label = __('Validation Error', 'event_espresso');
1862 1862
 						}
1863
-						$error_strings[] = sprintf( '%1$s: %2$s', $label, $validation_error->getMessage() );
1863
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1864 1864
 					}
1865 1865
 				}
1866 1866
 				EE_Error::add_error(
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
 							'event_espresso'
1871 1871
 						),
1872 1872
 						'<br/>',
1873
-						implode( '<br/>', $error_strings )
1873
+						implode('<br/>', $error_strings)
1874 1874
 					),
1875 1875
 					__FILE__,
1876 1876
 					__FUNCTION__,
@@ -1889,7 +1889,7 @@  discard block
 block discarded – undo
1889 1889
 			}
1890 1890
 		} else {
1891 1891
 			EE_Error::add_error(
1892
-				__( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ),
1892
+				__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'),
1893 1893
 				__FILE__,
1894 1894
 				__FUNCTION__,
1895 1895
 				__LINE__
@@ -1928,7 +1928,7 @@  discard block
 block discarded – undo
1928 1928
 		// save the TXN ( which clears cached copy of primary_registration)
1929 1929
 		$this->checkout->transaction->save();
1930 1930
 		// grab TXN ID and save it to the primary_registration
1931
-		$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1931
+		$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1932 1932
 		// save what we have so far
1933 1933
 		$primary_registration->save();
1934 1934
 		return true;
@@ -1946,7 +1946,7 @@  discard block
 block discarded – undo
1946 1946
 	private function _capture_primary_registration_data_from_billing_form() {
1947 1947
 		// convert billing form data into an attendee
1948 1948
 		$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1949
-		if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1949
+		if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1950 1950
 			EE_Error::add_error(
1951 1951
 				sprintf(
1952 1952
 					__(
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 						'event_espresso'
1955 1955
 					),
1956 1956
 					'<br/>',
1957
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1957
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1958 1958
 				),
1959 1959
 				__FILE__,
1960 1960
 				__FUNCTION__,
@@ -1963,7 +1963,7 @@  discard block
 block discarded – undo
1963 1963
 			return false;
1964 1964
 		}
1965 1965
 		$primary_registration = $this->checkout->transaction->primary_registration();
1966
-		if ( ! $primary_registration instanceof EE_Registration ) {
1966
+		if ( ! $primary_registration instanceof EE_Registration) {
1967 1967
 			EE_Error::add_error(
1968 1968
 				sprintf(
1969 1969
 					__(
@@ -1971,7 +1971,7 @@  discard block
 block discarded – undo
1971 1971
 						'event_espresso'
1972 1972
 					),
1973 1973
 					'<br/>',
1974
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1974
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1975 1975
 				),
1976 1976
 				__FILE__,
1977 1977
 				__FUNCTION__,
@@ -1979,7 +1979,7 @@  discard block
 block discarded – undo
1979 1979
 			);
1980 1980
 			return false;
1981 1981
 		}
1982
-		if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' )
1982
+		if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee')
1983 1983
 		       instanceof
1984 1984
 		       EE_Attendee
1985 1985
 		) {
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
 						'event_espresso'
1991 1991
 					),
1992 1992
 					'<br/>',
1993
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1993
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1994 1994
 				),
1995 1995
 				__FILE__,
1996 1996
 				__FUNCTION__,
@@ -1999,9 +1999,9 @@  discard block
 block discarded – undo
1999 1999
 			return false;
2000 2000
 		}
2001 2001
 		/** @type EE_Registration_Processor $registration_processor */
2002
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
2002
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
2003 2003
 		// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
2004
-		$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
2004
+		$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
2005 2005
 		return true;
2006 2006
 	}
2007 2007
 
@@ -2016,22 +2016,22 @@  discard block
 block discarded – undo
2016 2016
 	 * @throws \EE_Error
2017 2017
 	 */
2018 2018
 	private function _get_payment_method_for_selected_method_of_payment() {
2019
-		if ( $this->checkout->selected_method_of_payment === 'events_sold_out' ) {
2019
+		if ($this->checkout->selected_method_of_payment === 'events_sold_out') {
2020 2020
 			$this->_redirect_because_event_sold_out();
2021 2021
 			return null;
2022 2022
 		}
2023 2023
 		// get EE_Payment_Method object
2024
-		if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] ) ) {
2025
-			$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
2024
+		if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
2025
+			$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
2026 2026
 		} else {
2027 2027
 			// load EEM_Payment_Method
2028
-			EE_Registry::instance()->load_model( 'Payment_Method' );
2028
+			EE_Registry::instance()->load_model('Payment_Method');
2029 2029
 			/** @type EEM_Payment_Method $EEM_Payment_Method */
2030 2030
 			$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
2031
-			$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
2031
+			$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
2032 2032
 		}
2033 2033
 		// verify $payment_method
2034
-		if ( ! $payment_method instanceof EE_Payment_Method ) {
2034
+		if ( ! $payment_method instanceof EE_Payment_Method) {
2035 2035
 			// not a payment
2036 2036
 			EE_Error::add_error(
2037 2037
 				sprintf(
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
 						'event_espresso'
2041 2041
 					),
2042 2042
 					'<br/>',
2043
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2043
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2044 2044
 				),
2045 2045
 				__FILE__,
2046 2046
 				__FUNCTION__,
@@ -2049,7 +2049,7 @@  discard block
 block discarded – undo
2049 2049
 			return null;
2050 2050
 		}
2051 2051
 		// and verify it has a valid Payment_Method Type object
2052
-		if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
2052
+		if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
2053 2053
 			// not a payment
2054 2054
 			EE_Error::add_error(
2055 2055
 				sprintf(
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
 						'event_espresso'
2059 2059
 					),
2060 2060
 					'<br/>',
2061
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2061
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2062 2062
 				),
2063 2063
 				__FILE__,
2064 2064
 				__FUNCTION__,
@@ -2079,29 +2079,29 @@  discard block
 block discarded – undo
2079 2079
 	 * @return    mixed    EE_Payment | boolean
2080 2080
 	 * @throws \EE_Error
2081 2081
 	 */
2082
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
2082
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
2083 2083
 		$payment = null;
2084 2084
 		$this->checkout->transaction->save();
2085
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
2086
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
2085
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
2086
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
2087 2087
 			return false;
2088 2088
 		}
2089 2089
 		try {
2090
-			$payment_processor->set_revisit( $this->checkout->revisit );
2090
+			$payment_processor->set_revisit($this->checkout->revisit);
2091 2091
 			// generate payment object
2092 2092
 			$payment = $payment_processor->process_payment(
2093 2093
 				$payment_method,
2094 2094
 				$this->checkout->transaction,
2095 2095
 				$this->checkout->amount_owing,
2096 2096
 				$this->checkout->billing_form,
2097
-				$this->_get_return_url( $payment_method ),
2097
+				$this->_get_return_url($payment_method),
2098 2098
 				'CART',
2099 2099
 				$this->checkout->admin_request,
2100 2100
 				true,
2101 2101
 				$this->reg_step_url()
2102 2102
 			);
2103
-		} catch ( Exception $e ) {
2104
-			$this->_handle_payment_processor_exception( $e );
2103
+		} catch (Exception $e) {
2104
+			$this->_handle_payment_processor_exception($e);
2105 2105
 		}
2106 2106
 		return $payment;
2107 2107
 	}
@@ -2116,7 +2116,7 @@  discard block
 block discarded – undo
2116 2116
 	 * @return void
2117 2117
 	 * @throws \EE_Error
2118 2118
 	 */
2119
-	protected function _handle_payment_processor_exception( Exception $e ) {
2119
+	protected function _handle_payment_processor_exception(Exception $e) {
2120 2120
 		EE_Error::add_error(
2121 2121
 			sprintf(
2122 2122
 				__(
@@ -2124,7 +2124,7 @@  discard block
 block discarded – undo
2124 2124
 					'event_espresso'
2125 2125
 				),
2126 2126
 				'<br/>',
2127
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
2127
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
2128 2128
 				$e->getMessage(),
2129 2129
 				$e->getFile(),
2130 2130
 				$e->getLine()
@@ -2145,9 +2145,9 @@  discard block
 block discarded – undo
2145 2145
 	 * @return string
2146 2146
 	 * @throws \EE_Error
2147 2147
 	 */
2148
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
2148
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
2149 2149
 		$return_url = '';
2150
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
2150
+		switch ($payment_method->type_obj()->payment_occurs()) {
2151 2151
 			case EE_PMT_Base::offsite :
2152 2152
 				$return_url = add_query_arg(
2153 2153
 					array(
@@ -2176,12 +2176,12 @@  discard block
 block discarded – undo
2176 2176
 	 * @return EE_Payment | FALSE
2177 2177
 	 * @throws \EE_Error
2178 2178
 	 */
2179
-	private function _validate_payment( $payment = null ) {
2180
-		if ( $this->checkout->payment_method->is_off_line() ) {
2179
+	private function _validate_payment($payment = null) {
2180
+		if ($this->checkout->payment_method->is_off_line()) {
2181 2181
 			return true;
2182 2182
 		}
2183 2183
 		// verify payment object
2184
-		if ( ! $payment instanceof EE_Payment ) {
2184
+		if ( ! $payment instanceof EE_Payment) {
2185 2185
 			// not a payment
2186 2186
 			EE_Error::add_error(
2187 2187
 				sprintf(
@@ -2190,7 +2190,7 @@  discard block
 block discarded – undo
2190 2190
 						'event_espresso'
2191 2191
 					),
2192 2192
 					'<br/>',
2193
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2193
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2194 2194
 				),
2195 2195
 				__FILE__,
2196 2196
 				__FUNCTION__,
@@ -2211,27 +2211,27 @@  discard block
 block discarded – undo
2211 2211
 	 * @return bool
2212 2212
 	 * @throws \EE_Error
2213 2213
 	 */
2214
-	private function _post_payment_processing( $payment = null ) {
2214
+	private function _post_payment_processing($payment = null) {
2215 2215
 		// Off-Line payment?
2216
-		if ( $payment === true ) {
2216
+		if ($payment === true) {
2217 2217
 			//$this->_setup_redirect_for_next_step();
2218 2218
 			return true;
2219 2219
 		// On-Site payment?
2220
-		} else if ( $this->checkout->payment_method->is_on_site() ) {
2221
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite ) ) {
2220
+		} else if ($this->checkout->payment_method->is_on_site()) {
2221
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
2222 2222
 				//$this->_setup_redirect_for_next_step();
2223 2223
 				$this->checkout->continue_reg = false;
2224 2224
 			}
2225 2225
 		// Off-Site payment?
2226
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
2226
+		} else if ($this->checkout->payment_method->is_off_site()) {
2227 2227
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
2228
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ) {
2229
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
2228
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
2229
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
2230 2230
 				$this->checkout->redirect = true;
2231 2231
 				$this->checkout->redirect_form = $payment->redirect_form();
2232
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
2232
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
2233 2233
 				// set JSON response
2234
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
2234
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
2235 2235
 				// set cron job for finalizing the TXN
2236 2236
 				// in case the user does not return from the off-site gateway
2237 2237
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
 					$this->checkout->transaction->ID()
2240 2240
 				);
2241 2241
 				// and lastly, let's bump the payment status to pending
2242
-				$payment->set_status( EEM_Payment::status_id_pending );
2242
+				$payment->set_status(EEM_Payment::status_id_pending);
2243 2243
 				$payment->save();
2244 2244
 			} else {
2245 2245
 				// not a payment
@@ -2251,7 +2251,7 @@  discard block
 block discarded – undo
2251 2251
 							'event_espresso'
2252 2252
 						),
2253 2253
 						'<br/>',
2254
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2254
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
2255 2255
 					),
2256 2256
 					__FILE__,
2257 2257
 					__FUNCTION__,
@@ -2289,21 +2289,21 @@  discard block
 block discarded – undo
2289 2289
 	 * @return bool
2290 2290
 	 * @throws \EE_Error
2291 2291
 	 */
2292
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
2292
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
2293 2293
 		// off-line payment? carry on
2294
-		if ( $payment_occurs === EE_PMT_Base::offline ) {
2294
+		if ($payment_occurs === EE_PMT_Base::offline) {
2295 2295
 			return true;
2296 2296
 		}
2297 2297
 		// verify payment validity
2298
-		if ( $payment instanceof EE_Payment ) {
2299
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
2298
+		if ($payment instanceof EE_Payment) {
2299
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
2300 2300
 			$msg = $payment->gateway_response();
2301 2301
 			// check results
2302
-			switch ( $payment->status() ) {
2302
+			switch ($payment->status()) {
2303 2303
 				// good payment
2304 2304
 				case EEM_Payment::status_id_approved :
2305 2305
 					EE_Error::add_success(
2306
-						__( 'Your payment was processed successfully.', 'event_espresso' ),
2306
+						__('Your payment was processed successfully.', 'event_espresso'),
2307 2307
 						__FILE__,
2308 2308
 						__FUNCTION__,
2309 2309
 						__LINE__
@@ -2312,45 +2312,45 @@  discard block
 block discarded – undo
2312 2312
 					break;
2313 2313
 				// slow payment
2314 2314
 				case EEM_Payment::status_id_pending :
2315
-					if ( empty( $msg ) ) {
2315
+					if (empty($msg)) {
2316 2316
 						$msg = __(
2317 2317
 							'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.',
2318 2318
 							'event_espresso'
2319 2319
 						);
2320 2320
 					}
2321
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
2321
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
2322 2322
 					return true;
2323 2323
 					break;
2324 2324
 				// don't wanna payment
2325 2325
 				case EEM_Payment::status_id_cancelled :
2326
-					if ( empty( $msg ) ) {
2326
+					if (empty($msg)) {
2327 2327
 						$msg = _n(
2328 2328
 							'Payment cancelled. Please try again.',
2329 2329
 							'Payment cancelled. Please try again or select another method of payment.',
2330
-							count( $this->checkout->available_payment_methods ),
2330
+							count($this->checkout->available_payment_methods),
2331 2331
 							'event_espresso'
2332 2332
 						);
2333 2333
 					}
2334
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
2334
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
2335 2335
 					return false;
2336 2336
 					break;
2337 2337
 				// not enough payment
2338 2338
 				case EEM_Payment::status_id_declined :
2339
-					if ( empty( $msg ) ) {
2339
+					if (empty($msg)) {
2340 2340
 						$msg = _n(
2341 2341
 							'We\'re sorry but your payment was declined. Please try again.',
2342 2342
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
2343
-							count( $this->checkout->available_payment_methods ),
2343
+							count($this->checkout->available_payment_methods),
2344 2344
 							'event_espresso'
2345 2345
 						);
2346 2346
 					}
2347
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
2347
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
2348 2348
 					return false;
2349 2349
 					break;
2350 2350
 				// bad payment
2351 2351
 				case EEM_Payment::status_id_failed :
2352
-					if ( ! empty( $msg ) ) {
2353
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2352
+					if ( ! empty($msg)) {
2353
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2354 2354
 						return false;
2355 2355
 					}
2356 2356
 					// default to error below
@@ -2359,7 +2359,7 @@  discard block
 block discarded – undo
2359 2359
 		}
2360 2360
 		// off-site payment gateway responses are too unreliable, so let's just assume that
2361 2361
 		// the payment processing is just running slower than the registrant's request
2362
-		if ( $payment_occurs === EE_PMT_Base::offsite ) {
2362
+		if ($payment_occurs === EE_PMT_Base::offsite) {
2363 2363
 			return true;
2364 2364
 		}
2365 2365
 		EE_Error::add_error(
@@ -2369,7 +2369,7 @@  discard block
 block discarded – undo
2369 2369
 					'event_espresso'
2370 2370
 				),
2371 2371
 				'<br/>',
2372
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2372
+				EE_Registry::instance()->CFG->organization->get_pretty('email')
2373 2373
 			),
2374 2374
 			__FILE__,
2375 2375
 			__FUNCTION__,
@@ -2402,13 +2402,13 @@  discard block
 block discarded – undo
2402 2402
 	public function process_gateway_response() {
2403 2403
 		$payment = null;
2404 2404
 		// how have they chosen to pay?
2405
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
2405
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
2406 2406
 		// get EE_Payment_Method object
2407
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
2407
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
2408 2408
 			$this->checkout->continue_reg = false;
2409 2409
 			return false;
2410 2410
 		}
2411
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
2411
+		if ( ! $this->checkout->payment_method->is_off_site()) {
2412 2412
 			return false;
2413 2413
 		}
2414 2414
 		$this->_validate_offsite_return();
@@ -2422,23 +2422,23 @@  discard block
 block discarded – undo
2422 2422
 		//	true
2423 2423
 		//);
2424 2424
 		// verify TXN
2425
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
2425
+		if ($this->checkout->transaction instanceof EE_Transaction) {
2426 2426
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
2427
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
2427
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
2428 2428
 				$this->checkout->continue_reg = false;
2429 2429
 				return false;
2430 2430
 			}
2431
-			$payment = $this->_process_off_site_payment( $gateway );
2432
-			$payment = $this->_process_cancelled_payments( $payment );
2433
-			$payment = $this->_validate_payment( $payment );
2431
+			$payment = $this->_process_off_site_payment($gateway);
2432
+			$payment = $this->_process_cancelled_payments($payment);
2433
+			$payment = $this->_validate_payment($payment);
2434 2434
 			// if payment was not declined by the payment gateway or cancelled by the registrant
2435
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
2435
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
2436 2436
 				//$this->_setup_redirect_for_next_step();
2437 2437
 				// store that for later
2438 2438
 				$this->checkout->payment = $payment;
2439 2439
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
2440 2440
 				// because we will complete this step during the IPN processing then
2441
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request() ) {
2441
+				if ($gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request()) {
2442 2442
 					$this->set_completed();
2443 2443
 				}
2444 2444
 				return true;
@@ -2462,21 +2462,21 @@  discard block
 block discarded – undo
2462 2462
 	 * @throws \EE_Error
2463 2463
 	 */
2464 2464
 	private function _validate_offsite_return() {
2465
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
2466
-		if ( $TXN_ID !== $this->checkout->transaction->ID() ) {
2465
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
2466
+		if ($TXN_ID !== $this->checkout->transaction->ID()) {
2467 2467
 			// Houston... we might have a problem
2468 2468
 			$invalid_TXN = false;
2469 2469
 			// first gather some info
2470
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
2470
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
2471 2471
 			$primary_registrant = $valid_TXN instanceof EE_Transaction
2472 2472
 				? $valid_TXN->primary_registration()
2473 2473
 				: null;
2474 2474
 			// let's start by retrieving the cart for this TXN
2475
-			$cart = $this->checkout->get_cart_for_transaction( $this->checkout->transaction );
2476
-			if ( $cart instanceof EE_Cart ) {
2475
+			$cart = $this->checkout->get_cart_for_transaction($this->checkout->transaction);
2476
+			if ($cart instanceof EE_Cart) {
2477 2477
 				// verify that the current cart has tickets
2478 2478
 				$tickets = $cart->get_tickets();
2479
-				if ( empty( $tickets ) ) {
2479
+				if (empty($tickets)) {
2480 2480
 					$invalid_TXN = true;
2481 2481
 				}
2482 2482
 			} else {
@@ -2486,35 +2486,35 @@  discard block
 block discarded – undo
2486 2486
 				? $primary_registrant->session_ID()
2487 2487
 				: null;
2488 2488
 			// validate current Session ID and compare against valid TXN session ID
2489
-			if ( EE_Session::instance()->id() === null ) {
2489
+			if (EE_Session::instance()->id() === null) {
2490 2490
 				$invalid_TXN = true;
2491
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
2491
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
2492 2492
 				// WARNING !!!
2493 2493
 				// this could be PayPal sending back duplicate requests (ya they do that)
2494 2494
 				// or it **could** mean someone is simply registering AGAIN after having just done so
2495 2495
 				// so now we need to determine if this current TXN looks valid or not
2496 2496
 				// has this step even been started ?
2497
-				if ( $this->checkout->transaction->reg_step_completed( $this->slug() === false )
2497
+				if ($this->checkout->transaction->reg_step_completed($this->slug() === false)
2498 2498
 				) {
2499 2499
 					// really? you're half way through this reg step, but you never started it ?
2500 2500
 					$invalid_TXN = true;
2501 2501
 				}
2502 2502
 			}
2503
-			if ( $invalid_TXN ) {
2503
+			if ($invalid_TXN) {
2504 2504
 				// is the valid TXN completed ?
2505
-				if ( $valid_TXN instanceof EE_Transaction ) {
2505
+				if ($valid_TXN instanceof EE_Transaction) {
2506 2506
 					// has this step even been started ?
2507
-					$reg_step_completed = $valid_TXN->reg_step_completed( $this->slug() );
2508
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
2507
+					$reg_step_completed = $valid_TXN->reg_step_completed($this->slug());
2508
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
2509 2509
 						// so it **looks** like this is a double request from PayPal
2510 2510
 						// so let's try to pick up where we left off
2511 2511
 						$this->checkout->transaction = $valid_TXN;
2512
-						$this->checkout->refresh_all_entities( true );
2512
+						$this->checkout->refresh_all_entities(true);
2513 2513
 						return;
2514 2514
 					}
2515 2515
 				}
2516 2516
 				// you appear to be lost?
2517
-				$this->_redirect_wayward_request( $primary_registrant );
2517
+				$this->_redirect_wayward_request($primary_registrant);
2518 2518
 			}
2519 2519
 		}
2520 2520
 	}
@@ -2529,14 +2529,14 @@  discard block
 block discarded – undo
2529 2529
 	 * @return bool
2530 2530
 	 * @throws \EE_Error
2531 2531
 	 */
2532
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
2533
-		if ( ! $primary_registrant instanceof EE_Registration ) {
2532
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
2533
+		if ( ! $primary_registrant instanceof EE_Registration) {
2534 2534
 			// try redirecting based on the current TXN
2535 2535
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction
2536 2536
 				? $this->checkout->transaction->primary_registration()
2537 2537
 				: null;
2538 2538
 		}
2539
-		if ( ! $primary_registrant instanceof EE_Registration ) {
2539
+		if ( ! $primary_registrant instanceof EE_Registration) {
2540 2540
 			EE_Error::add_error(
2541 2541
 				sprintf(
2542 2542
 					__(
@@ -2544,7 +2544,7 @@  discard block
 block discarded – undo
2544 2544
 						'event_espresso'
2545 2545
 					),
2546 2546
 					'<br/>',
2547
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2547
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2548 2548
 				),
2549 2549
 				__FILE__,
2550 2550
 				__FUNCTION__,
@@ -2575,17 +2575,17 @@  discard block
 block discarded – undo
2575 2575
 	 * @return \EE_Payment
2576 2576
 	 * @throws \EE_Error
2577 2577
 	 */
2578
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
2578
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
2579 2579
 		try {
2580 2580
 			$request_data = \EE_Registry::instance()->REQ->params();
2581 2581
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
2582 2582
 			$this->set_handle_IPN_in_this_request(
2583
-				$gateway->handle_IPN_in_this_request( $request_data, false )
2583
+				$gateway->handle_IPN_in_this_request($request_data, false)
2584 2584
 			);
2585
-			if ( $this->handle_IPN_in_this_request() ) {
2585
+			if ($this->handle_IPN_in_this_request()) {
2586 2586
 				// get payment details and process results
2587 2587
 				/** @type EE_Payment_Processor $payment_processor */
2588
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
2588
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
2589 2589
 				$payment = $payment_processor->process_ipn(
2590 2590
 					$request_data,
2591 2591
 					$this->checkout->transaction,
@@ -2598,14 +2598,14 @@  discard block
 block discarded – undo
2598 2598
 				$payment = $this->checkout->transaction->last_payment();
2599 2599
 				//$payment_source = 'last_payment';
2600 2600
 			}
2601
-		} catch ( Exception $e ) {
2601
+		} catch (Exception $e) {
2602 2602
 			// let's just eat the exception and try to move on using any previously set payment info
2603 2603
 			$payment = $this->checkout->transaction->last_payment();
2604 2604
 			//$payment_source = 'last_payment after Exception';
2605 2605
 			// but if we STILL don't have a payment object
2606
-			if ( ! $payment instanceof EE_Payment ) {
2606
+			if ( ! $payment instanceof EE_Payment) {
2607 2607
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
2608
-				$this->_handle_payment_processor_exception( $e );
2608
+				$this->_handle_payment_processor_exception($e);
2609 2609
 			}
2610 2610
 		}
2611 2611
 		// DEBUG LOG
@@ -2630,13 +2630,13 @@  discard block
 block discarded – undo
2630 2630
 	 * @return EE_Payment | FALSE
2631 2631
 	 * @throws \EE_Error
2632 2632
 	 */
2633
-	private function _process_cancelled_payments( $payment = null ) {
2633
+	private function _process_cancelled_payments($payment = null) {
2634 2634
 		if (
2635 2635
 			$payment instanceof EE_Payment
2636
-			&& isset( $_REQUEST['ee_cancel_payment'] )
2636
+			&& isset($_REQUEST['ee_cancel_payment'])
2637 2637
 			&& $payment->status() === EEM_Payment::status_id_failed
2638 2638
 		) {
2639
-			$payment->set_status( EEM_Payment::status_id_cancelled );
2639
+			$payment->set_status(EEM_Payment::status_id_cancelled);
2640 2640
 		}
2641 2641
 		return $payment;
2642 2642
 	}
@@ -2653,14 +2653,14 @@  discard block
 block discarded – undo
2653 2653
 	public function get_transaction_details_for_gateways() {
2654 2654
 		$txn_details = array();
2655 2655
 		// ya gotta make a choice man
2656
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
2656
+		if (empty($this->checkout->selected_method_of_payment)) {
2657 2657
 			$txn_details = array(
2658
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
2658
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
2659 2659
 			);
2660 2660
 		}
2661 2661
 		// get EE_Payment_Method object
2662 2662
 		if (
2663
-			empty( $txn_details )
2663
+			empty($txn_details)
2664 2664
 			&&
2665 2665
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
2666 2666
 		) {
@@ -2672,8 +2672,8 @@  discard block
 block discarded – undo
2672 2672
 				)
2673 2673
 			);
2674 2674
 		}
2675
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
2676
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
2675
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
2676
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
2677 2677
 			$txn_details = array(
2678 2678
 				'TXN_ID'         => $this->checkout->transaction->ID(),
2679 2679
 				'TXN_timestamp'  => $this->checkout->transaction->datetime(),
@@ -2684,7 +2684,7 @@  discard block
 block discarded – undo
2684 2684
 				'PMD_ID'         => $this->checkout->transaction->payment_method_ID(),
2685 2685
 				'payment_amount' => $this->checkout->amount_owing,
2686 2686
 				'return_url'     => $return_url,
2687
-				'cancel_url'     => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
2687
+				'cancel_url'     => add_query_arg(array('ee_cancel_payment' => true), $return_url),
2688 2688
 				'notify_url'     => EE_Config::instance()->core->txn_page_url(
2689 2689
 					array(
2690 2690
 						'e_reg_url_link'    => $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -2693,7 +2693,7 @@  discard block
 block discarded – undo
2693 2693
 				)
2694 2694
 			);
2695 2695
 		}
2696
-		echo wp_json_encode( $txn_details );
2696
+		echo wp_json_encode($txn_details);
2697 2697
 		exit();
2698 2698
 	}
2699 2699
 
@@ -2710,7 +2710,7 @@  discard block
 block discarded – undo
2710 2710
     public function __sleep()
2711 2711
     {
2712 2712
         // remove the reg form and the checkout
2713
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'reg_form', 'checkout', 'line_item_display' ) );
2713
+        return array_diff(array_keys(get_object_vars($this)), array('reg_form', 'checkout', 'line_item_display'));
2714 2714
     }
2715 2715
 
2716 2716
 
Please login to merge, or discard this patch.
core/libraries/form_sections/form_handlers/SequentialStepFormManager.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
 
197 197
 	/**
198
-	 * @param $default_form_step
198
+	 * @param string $default_form_step
199 199
 	 * @throws InvalidDataTypeException
200 200
 	 */
201 201
 	protected function setDefaultFormStep( $default_form_step ) {
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 
505 505
 	/**
506 506
 	 * @param array $form_data
507
-	 * @return bool
507
+	 * @return boolean|null
508 508
 	 * @throws InvalidArgumentException
509 509
 	 * @throws InvalidDataTypeException
510 510
 	 */
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 use Exception;
17 17
 use InvalidArgumentException;
18 18
 
19
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
20
-	exit( 'No direct script access allowed' );
19
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
20
+	exit('No direct script access allowed');
21 21
 }
22 22
 
23 23
 
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 		$progress_step_style = 'number_bubbles',
116 116
 		EE_Request $request
117 117
 	) {
118
-		$this->setBaseUrl( $base_url );
119
-		$this->setDefaultFormStep( $default_form_step );
120
-		$this->setFormAction( $form_action );
121
-		$this->setFormConfig( $form_config );
122
-		$this->setProgressStepStyle( $progress_step_style );
118
+		$this->setBaseUrl($base_url);
119
+		$this->setDefaultFormStep($default_form_step);
120
+		$this->setFormAction($form_action);
121
+		$this->setFormConfig($form_config);
122
+		$this->setProgressStepStyle($progress_step_style);
123 123
 		$this->request = $request;
124 124
 	}
125 125
 
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
131 131
 	 */
132 132
 	public function baseUrl() {
133
-		if ( strpos( $this->base_url, $this->getCurrentStep()->slug() ) === false ) {
133
+		if (strpos($this->base_url, $this->getCurrentStep()->slug()) === false) {
134 134
 			add_query_arg(
135
-				array( $this->form_step_url_key => $this->getCurrentStep()->slug() ),
135
+				array($this->form_step_url_key => $this->getCurrentStep()->slug()),
136 136
 				$this->base_url
137 137
 			);
138 138
 		}
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 	 * @throws InvalidDataTypeException
147 147
 	 * @throws InvalidArgumentException
148 148
 	 */
149
-	protected function setBaseUrl( $base_url ) {
150
-		if ( ! is_string( $base_url ) ) {
151
-			throw new InvalidDataTypeException( '$base_url', $base_url, 'string' );
149
+	protected function setBaseUrl($base_url) {
150
+		if ( ! is_string($base_url)) {
151
+			throw new InvalidDataTypeException('$base_url', $base_url, 'string');
152 152
 		}
153
-		if ( empty( $base_url ) ) {
153
+		if (empty($base_url)) {
154 154
 			throw new InvalidArgumentException(
155
-				__( 'The base URL can not be an empty string.', 'event_espresso' )
155
+				__('The base URL can not be an empty string.', 'event_espresso')
156 156
 			);
157 157
 		}
158 158
 		$this->base_url = $base_url;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @throws InvalidDataTypeException
166 166
 	 */
167 167
 	public function formStepUrlKey() {
168
-		if ( empty( $this->form_step_url_key ) ) {
168
+		if (empty($this->form_step_url_key)) {
169 169
 			$this->setFormStepUrlKey();
170 170
 		}
171 171
 		return $this->form_step_url_key;
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 	 * @param string $form_step_url_key
178 178
 	 * @throws InvalidDataTypeException
179 179
 	 */
180
-	public function setFormStepUrlKey( $form_step_url_key = 'ee-form-step' ) {
181
-		if ( ! is_string( $form_step_url_key ) ) {
182
-			throw new InvalidDataTypeException( '$form_step_key', $form_step_url_key, 'string' );
180
+	public function setFormStepUrlKey($form_step_url_key = 'ee-form-step') {
181
+		if ( ! is_string($form_step_url_key)) {
182
+			throw new InvalidDataTypeException('$form_step_key', $form_step_url_key, 'string');
183 183
 		}
184
-		$this->form_step_url_key = ! empty( $form_step_url_key ) ? $form_step_url_key : 'ee-form-step';
184
+		$this->form_step_url_key = ! empty($form_step_url_key) ? $form_step_url_key : 'ee-form-step';
185 185
 	}
186 186
 
187 187
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 	 * @param $default_form_step
200 200
 	 * @throws InvalidDataTypeException
201 201
 	 */
202
-	protected function setDefaultFormStep( $default_form_step ) {
203
-		if ( ! is_string( $default_form_step ) ) {
204
-			throw new InvalidDataTypeException( '$default_form_step', $default_form_step, 'string' );
202
+	protected function setDefaultFormStep($default_form_step) {
203
+		if ( ! is_string($default_form_step)) {
204
+			throw new InvalidDataTypeException('$default_form_step', $default_form_step, 'string');
205 205
 		}
206 206
 		$this->default_form_step = $default_form_step;
207 207
 	}
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 * @throws InvalidDataTypeException
215 215
 	 */
216 216
 	protected function setCurrentStepFromRequest() {
217
-		$current_step_slug = $this->request()->get( $this->formStepUrlKey(), $this->defaultFormStep() );
218
-		if ( ! $this->form_steps->setCurrent( $current_step_slug ) ) {
217
+		$current_step_slug = $this->request()->get($this->formStepUrlKey(), $this->defaultFormStep());
218
+		if ( ! $this->form_steps->setCurrent($current_step_slug)) {
219 219
 			throw new InvalidIdentifierException(
220 220
 				$current_step_slug,
221 221
 				$this->defaultFormStep(),
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
238 238
 	 */
239 239
 	public function getCurrentStep() {
240
-		if ( ! $this->form_steps->current() instanceof SequentialStepForm ) {
241
-			throw new InvalidFormHandlerException( $this->form_steps->current() );
240
+		if ( ! $this->form_steps->current() instanceof SequentialStepForm) {
241
+			throw new InvalidFormHandlerException($this->form_steps->current());
242 242
 		}
243 243
 		return $this->form_steps->current();
244 244
 	}
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
251 251
 	 */
252 252
 	public function formAction() {
253
-		if ( ! is_string( $this->form_action ) || empty( $this->form_action ) ) {
253
+		if ( ! is_string($this->form_action) || empty($this->form_action)) {
254 254
 			$this->form_action = $this->baseUrl();
255 255
 		}
256 256
 		return $this->form_action;
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 	 * @param string $form_action
263 263
 	 * @throws InvalidDataTypeException
264 264
 	 */
265
-	public function setFormAction( $form_action ) {
266
-		if ( ! is_string( $form_action ) ) {
267
-			throw new InvalidDataTypeException( '$form_action', $form_action, 'string' );
265
+	public function setFormAction($form_action) {
266
+		if ( ! is_string($form_action)) {
267
+			throw new InvalidDataTypeException('$form_action', $form_action, 'string');
268 268
 		}
269 269
 		$this->form_action = $form_action;
270 270
 	}
@@ -275,15 +275,15 @@  discard block
 block discarded – undo
275 275
 	 * @param array $form_action_args
276 276
 	 * @throws InvalidDataTypeException
277 277
 	 */
278
-	public function addFormActionArgs( $form_action_args = array() ) {
279
-		if ( ! is_array( $form_action_args ) ) {
280
-			throw new InvalidDataTypeException( '$form_action_args', $form_action_args, 'array' );
278
+	public function addFormActionArgs($form_action_args = array()) {
279
+		if ( ! is_array($form_action_args)) {
280
+			throw new InvalidDataTypeException('$form_action_args', $form_action_args, 'array');
281 281
 		}
282
-		$form_action_args = ! empty( $form_action_args )
282
+		$form_action_args = ! empty($form_action_args)
283 283
 			? $form_action_args
284
-			: array( $this->formStepUrlKey() => $this->form_steps->current()->slug() );
284
+			: array($this->formStepUrlKey() => $this->form_steps->current()->slug());
285 285
 		$this->getCurrentStep()->setFormAction(
286
-			add_query_arg( $form_action_args, $this->formAction() )
286
+			add_query_arg($form_action_args, $this->formAction())
287 287
 		);
288 288
 		$this->form_action = $this->getCurrentStep()->formAction();
289 289
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	/**
303 303
 	 * @param string $form_config
304 304
 	 */
305
-	public function setFormConfig( $form_config ) {
305
+	public function setFormConfig($form_config) {
306 306
 		$this->form_config = $form_config;
307 307
 	}
308 308
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	/**
321 321
 	 * @param string $progress_step_style
322 322
 	 */
323
-	public function setProgressStepStyle( $progress_step_style ) {
323
+	public function setProgressStepStyle($progress_step_style) {
324 324
 		$this->progress_step_style = $progress_step_style;
325 325
 	}
326 326
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	protected function getProgressStepsCollection() {
342 342
 		static $collection = null;
343
-		if ( ! $collection instanceof ProgressStepCollection ) {
343
+		if ( ! $collection instanceof ProgressStepCollection) {
344 344
 			$collection = new ProgressStepCollection();
345 345
 		}
346 346
 		return $collection;
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
 	 * @throws InvalidClassException
357 357
 	 * @throws InvalidInterfaceException
358 358
 	 */
359
-	protected function generateProgressSteps( Collection $progress_steps_collection ) {
359
+	protected function generateProgressSteps(Collection $progress_steps_collection) {
360 360
 		$current_step = $this->getCurrentStep();
361 361
 		/** @var SequentialStepForm $form_step */
362
-		foreach ( $this->form_steps as $form_step ) {
362
+		foreach ($this->form_steps as $form_step) {
363 363
 			// is this step active ?
364
-			if ( ! $form_step->initialize() ) {
364
+			if ( ! $form_step->initialize()) {
365 365
 				continue;
366 366
 			}
367 367
 			$progress_steps_collection->add(
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 			);
376 376
 		}
377 377
 		// set collection pointer back to current step
378
-		$this->form_steps->setCurrentUsingObject( $current_step );
378
+		$this->form_steps->setCurrentUsingObject($current_step);
379 379
 		return new ProgressStepManager(
380 380
 			$this->progressStepStyle(),
381 381
 			$this->defaultFormStep(),
@@ -409,9 +409,9 @@  discard block
 block discarded – undo
409 409
 	 * @throws InvalidInterfaceException
410 410
 	 * @throws InvalidArgumentException
411 411
 	 */
412
-	public function processForm( $form_data = array() ) {
412
+	public function processForm($form_data = array()) {
413 413
 		$this->buildCurrentStepFormForProcessing();
414
-		$this->processCurrentStepForm( $form_data );
414
+		$this->processCurrentStepForm($form_data);
415 415
 	}
416 416
 
417 417
 
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 	public function buildCurrentStepFormForDisplay() {
428 428
 		$form_step = $this->buildCurrentStepForm();
429 429
 		// no displayable content ? then skip straight to processing
430
-		if ( ! $form_step->displayable() ) {
430
+		if ( ! $form_step->displayable()) {
431 431
 			$this->addFormActionArgs();
432
-			$form_step->setFormAction( $this->formAction() );
433
-			wp_safe_redirect( $form_step->formAction() );
432
+			$form_step->setFormAction($this->formAction());
433
+			wp_safe_redirect($form_step->formAction());
434 434
 		}
435 435
 	}
436 436
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 * @throws InvalidArgumentException
446 446
 	 */
447 447
 	public function buildCurrentStepFormForProcessing() {
448
-		$this->buildCurrentStepForm( false );
448
+		$this->buildCurrentStepForm(false);
449 449
 	}
450 450
 
451 451
 
@@ -460,14 +460,14 @@  discard block
 block discarded – undo
460 460
 	 * @throws InvalidInterfaceException
461 461
 	 * @throws InvalidArgumentException
462 462
 	 */
463
-	private function buildCurrentStepForm( $for_display = true ) {
463
+	private function buildCurrentStepForm($for_display = true) {
464 464
 		$this->form_steps = $this->getFormStepsCollection();
465 465
 		$this->setCurrentStepFromRequest();
466 466
 		$form_step = $this->getCurrentStep();
467
-		if ( $form_step->submitBtnText() === __( 'Submit', 'event_espresso' ) ) {
468
-			$form_step->setSubmitBtnText( __( 'Next Step', 'event_espresso' ) );
467
+		if ($form_step->submitBtnText() === __('Submit', 'event_espresso')) {
468
+			$form_step->setSubmitBtnText(__('Next Step', 'event_espresso'));
469 469
 		}
470
-		if ( $for_display && $form_step->displayable() ) {
470
+		if ($for_display && $form_step->displayable()) {
471 471
 			$this->progress_step_manager = $this->generateProgressSteps(
472 472
 				$this->getProgressStepsCollection()
473 473
 			);
@@ -478,16 +478,16 @@  discard block
 block discarded – undo
478 478
 			$this->progress_step_manager->setPreviousStepsCompleted();
479 479
 			$this->progress_step_manager->enqueueStylesAndScripts();
480 480
 			$this->addFormActionArgs();
481
-			$form_step->setFormAction( $this->formAction() );
481
+			$form_step->setFormAction($this->formAction());
482 482
 
483 483
 		} else {
484
-			$form_step->setRedirectUrl( $this->baseUrl() );
484
+			$form_step->setRedirectUrl($this->baseUrl());
485 485
 			$form_step->addRedirectArgs(
486
-				array( $this->formStepUrlKey() => $this->form_steps->current()->slug() )
486
+				array($this->formStepUrlKey() => $this->form_steps->current()->slug())
487 487
 			);
488 488
 		}
489 489
 		$form_step->generate();
490
-		if ( $for_display ) {
490
+		if ($for_display) {
491 491
 			$form_step->enqueueStylesAndScripts();
492 492
 		}
493 493
 		return $form_step;
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	 * @param bool $return_as_string
500 500
 	 * @return string
501 501
 	 */
502
-	public function displayProgressSteps( $return_as_string = true ) {
502
+	public function displayProgressSteps($return_as_string = true) {
503 503
 		$progress_steps = apply_filters(
504 504
 			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_SequentialStepFormManager__displayProgressSteps__before_steps',
505 505
 			''
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_SequentialStepFormManager__displayProgressSteps__after_steps',
510 510
 			''
511 511
 		);
512
-		if ( $return_as_string ) {
512
+		if ($return_as_string) {
513 513
 			return $progress_steps;
514 514
 		}
515 515
 		echo $progress_steps;
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 	 * @return string
524 524
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
525 525
 	 */
526
-	public function displayCurrentStepForm( $return_as_string = true ) {
527
-		if ( $return_as_string ) {
526
+	public function displayCurrentStepForm($return_as_string = true) {
527
+		if ($return_as_string) {
528 528
 			return $this->getCurrentStep()->display();
529 529
 		}
530 530
 		echo $this->getCurrentStep()->display();
@@ -539,32 +539,32 @@  discard block
 block discarded – undo
539 539
 	 * @throws InvalidArgumentException
540 540
 	 * @throws InvalidDataTypeException
541 541
 	 */
542
-	public function processCurrentStepForm( $form_data = array() ) {
542
+	public function processCurrentStepForm($form_data = array()) {
543 543
 		// grab instance of current step because after calling next() below,
544 544
 		// any calls to getCurrentStep() will return the "next" step because we advanced
545 545
 		$current_step = $this->getCurrentStep();
546 546
 		try {
547 547
 			// form processing should either throw exceptions or return true
548
-			$current_step->process( $form_data );
549
-		} catch ( Exception $e ) {
548
+			$current_step->process($form_data);
549
+		} catch (Exception $e) {
550 550
 			// something went wrong, so...
551 551
 			// if WP_DEBUG === true, display the Exception and stack trace right now
552
-			new ExceptionStackTraceDisplay( $e );
552
+			new ExceptionStackTraceDisplay($e);
553 553
 			// else convert the Exception to an EE_Error
554
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
554
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
555 555
 			// prevent redirect to next step or other if exception was thrown
556 556
 			if (
557 557
 				$current_step->redirectTo() === SequentialStepForm::REDIRECT_TO_NEXT_STEP
558 558
 				|| $current_step->redirectTo() === SequentialStepForm::REDIRECT_TO_OTHER
559 559
 			) {
560
-				$current_step->setRedirectTo( SequentialStepForm::REDIRECT_TO_CURRENT_STEP );
560
+				$current_step->setRedirectTo(SequentialStepForm::REDIRECT_TO_CURRENT_STEP);
561 561
 			}
562 562
 		}
563 563
 		// save notices to a transient so that when we redirect back
564 564
 		// to the display portion for this step
565 565
 		// those notices can be displayed
566
-		EE_Error::get_notices( false, true );
567
-		$this->redirectForm( $current_step );
566
+		EE_Error::get_notices(false, true);
567
+		$this->redirectForm($current_step);
568 568
 	}
569 569
 
570 570
 
@@ -574,13 +574,13 @@  discard block
 block discarded – undo
574 574
 	 *
575 575
 	 * @param \EventEspresso\core\libraries\form_sections\form_handlers\SequentialStepFormInterface $current_step
576 576
 	 */
577
-	public function redirectForm( SequentialStepFormInterface $current_step ) {
577
+	public function redirectForm(SequentialStepFormInterface $current_step) {
578 578
 		$redirect_step = $current_step;
579
-		switch( $current_step->redirectTo() ) {
579
+		switch ($current_step->redirectTo()) {
580 580
 
581 581
 			case SequentialStepForm::REDIRECT_TO_OTHER :
582 582
 				// going somewhere else, so just check out now
583
-				wp_safe_redirect( $redirect_step->redirectUrl() );
583
+				wp_safe_redirect($redirect_step->redirectUrl());
584 584
 				exit();
585 585
 				break;
586 586
 
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 
591 591
 			case SequentialStepForm::REDIRECT_TO_NEXT_STEP :
592 592
 				$this->form_steps->next();
593
-				if ( $this->form_steps->valid() ) {
593
+				if ($this->form_steps->valid()) {
594 594
 					$redirect_step = $this->form_steps->current();
595 595
 				}
596 596
 				break;
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
 				// $redirect_step is already set
601 601
 
602 602
 		}
603
-		$current_step->setRedirectUrl( $this->baseUrl() );
603
+		$current_step->setRedirectUrl($this->baseUrl());
604 604
 		$current_step->addRedirectArgs(
605 605
 			// use the slug for whatever step we are redirecting too
606
-			array( $this->formStepUrlKey() => $redirect_step->slug() )
606
+			array($this->formStepUrlKey() => $redirect_step->slug())
607 607
 		);
608
-		wp_safe_redirect( $current_step->redirectUrl() );
608
+		wp_safe_redirect($current_step->redirectUrl());
609 609
 		exit();
610 610
 	}
611 611
 
Please login to merge, or discard this patch.
core/services/container/CoffeeShop.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      * Adds instructions on how to brew objects
237 237
      *
238 238
      * @param RecipeInterface $recipe
239
-     * @return mixed
239
+     * @return boolean
240 240
      */
241 241
     public function addRecipe(RecipeInterface $recipe)
242 242
     {
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     /**
313 313
      * Adds a service to one of the internal collections
314 314
      *
315
-     * @param        $identifier
315
+     * @param        string $identifier
316 316
      * @param array  $arguments
317 317
      * @param string $type
318 318
      * @return mixed
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         // array for storing class aliases
80 80
         $this->filters = array();
81 81
         // create collection for storing shared services
82
-        $this->carafe = new LooseCollection( '' );
82
+        $this->carafe = new LooseCollection('');
83 83
         // create collection for storing recipes that tell how to build services and entities
84 84
         $this->recipes = new Collection('EventEspresso\core\services\container\RecipeInterface');
85 85
         // create collection for storing closures for constructing new entities
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
             return;
303 303
         }
304 304
         $identifier = $this->processIdentifier($identifier);
305
-        foreach ((array)$aliases as $alias) {
305
+        foreach ((array) $aliases as $alias) {
306 306
             $this->filters[$this->processIdentifier($alias)] = $identifier;
307 307
         }
308 308
     }
Please login to merge, or discard this patch.
Indentation   +497 added lines, -497 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use OutOfBoundsException;
14 14
 
15 15
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
16
-    exit('No direct script access allowed');
16
+	exit('No direct script access allowed');
17 17
 }
18 18
 
19 19
 
@@ -32,502 +32,502 @@  discard block
 block discarded – undo
32 32
 {
33 33
 
34 34
 
35
-    /**
36
-     * This was the best coffee related name I could think of to represent class name "aliases"
37
-     * So classes can be found via an alias identifier,
38
-     * that is revealed when it is run through... the filters... eh? get it?
39
-     *
40
-     * @var array $filters
41
-     */
42
-    private $filters = array();
43
-
44
-    /**
45
-     * These are the classes that will actually build the objects (to order of course)
46
-     *
47
-     * @var array $coffee_makers
48
-     */
49
-    private $coffee_makers = array();
50
-
51
-    /**
52
-     * where the instantiated "singleton" objects are stored
53
-     *
54
-     * @var CollectionInterface $carafe
55
-     */
56
-    private $carafe;
57
-
58
-    /**
59
-     * collection of Recipes that instruct us how to brew objects
60
-     *
61
-     * @var CollectionInterface $recipes
62
-     */
63
-    private $recipes;
64
-
65
-    /**
66
-     * collection of closures for brewing objects
67
-     *
68
-     * @var CollectionInterface $reservoir
69
-     */
70
-    private $reservoir;
71
-
72
-
73
-
74
-    /**
75
-     * CoffeeShop constructor
76
-     */
77
-    public function __construct()
78
-    {
79
-        // array for storing class aliases
80
-        $this->filters = array();
81
-        // create collection for storing shared services
82
-        $this->carafe = new LooseCollection( '' );
83
-        // create collection for storing recipes that tell how to build services and entities
84
-        $this->recipes = new Collection('EventEspresso\core\services\container\RecipeInterface');
85
-        // create collection for storing closures for constructing new entities
86
-        $this->reservoir = new Collection('Closure');
87
-        // create collection for storing the generators that build our services and entity closures
88
-        $this->coffee_makers = new Collection('EventEspresso\core\services\container\CoffeeMakerInterface');
89
-    }
90
-
91
-
92
-
93
-    /**
94
-     * Returns true if the container can return an entry for the given identifier.
95
-     * Returns false otherwise.
96
-     * `has($identifier)` returning true does not mean that `get($identifier)` will not throw an exception.
97
-     * It does however mean that `get($identifier)` will not throw a `ServiceNotFoundException`.
98
-     *
99
-     * @param string $identifier  Identifier of the entry to look for.
100
-     *                            Typically a Fully Qualified Class Name
101
-     * @return boolean
102
-     */
103
-    public function has($identifier)
104
-    {
105
-        $identifier = $this->filterIdentifier($identifier);
106
-        return $this->carafe->has($identifier);
107
-    }
108
-
109
-
110
-
111
-    /**
112
-     * finds a previously brewed (SHARED) service and returns it
113
-     *
114
-     * @param  string $identifier Identifier for the entity class to be constructed.
115
-     *                            Typically a Fully Qualified Class Name
116
-     * @return mixed
117
-     * @throws ServiceNotFoundException No service was found for this identifier.
118
-     */
119
-    public function get($identifier)
120
-    {
121
-        $identifier = $this->filterIdentifier($identifier);
122
-        if ($this->carafe->has($identifier)) {
123
-            return $this->carafe->get($identifier);
124
-        }
125
-        throw new ServiceNotFoundException($identifier);
126
-    }
127
-
128
-
129
-
130
-    /**
131
-     * returns an instance of the requested entity type using the supplied arguments.
132
-     * If a shared service is requested and an instance is already in the carafe, then it will be returned.
133
-     * If it is not already in the carafe, then the service will be constructed, added to the carafe, and returned
134
-     * If the request is for a new entity and a closure exists in the reservoir for creating it,
135
-     * then a new entity will be instantiated from the closure and returned.
136
-     * If a closure does not exist, then one will be built and added to the reservoir
137
-     * before instantiating the requested entity.
138
-     *
139
-     * @param  string $identifier Identifier for the entity class to be constructed.
140
-     *                            Typically a Fully Qualified Class Name
141
-     * @param array   $arguments  an array of arguments to be passed to the entity constructor
142
-     * @param string  $type
143
-     * @return mixed
144
-     * @throws ServiceNotFoundException No service was found for this identifier.
145
-     */
146
-    public function brew($identifier, $arguments = array(), $type = '')
147
-    {
148
-        // resolve any class aliases that may exist
149
-        $identifier = $this->filterIdentifier($identifier);
150
-        try {
151
-            // is a shared service being requested?
152
-            if (empty($type) || $type === CoffeeMaker::BREW_SHARED) {
153
-                // if a shared service was requested and an instance is in the carafe, then return it
154
-                return $this->get($identifier);
155
-            }
156
-        } catch (ServiceNotFoundException $e) {
157
-            // if not then we'll just catch the ServiceNotFoundException but not do anything just yet,
158
-            // and instead, attempt to build whatever was requested
159
-        }
160
-        $brewed = false;
161
-        // if the reservoir doesn't have a closure already for the requested identifier,
162
-        // then neither a shared service nor a closure for making entities has been built yet
163
-        if ( ! $this->reservoir->has($identifier)) {
164
-            // so let's brew something up and add it to the proper collection
165
-            $brewed = $this->makeCoffee($identifier, $arguments, $type);
166
-        }
167
-        // was the brewed item a callable factory function ?
168
-        if (is_callable($brewed)) {
169
-            // then instantiate a new entity from the cached closure
170
-            $entity = $brewed($arguments);
171
-        } else if ($brewed) {
172
-            // requested object was a shared entity, so attempt to get it from the carafe again
173
-            // because if it wasn't there before, then it should have just been brewed and added,
174
-            // but if it still isn't there, then this time
175
-            // the thrown ServiceNotFoundException will not be caught
176
-            $entity = $this->get($identifier);
177
-        } else {
178
-            // if identifier is for a non-shared entity,
179
-            // then either a cached closure already existed, or was just brewed
180
-            $closure = $this->reservoir->get($identifier);
181
-            $entity = $closure($arguments);
182
-        }
183
-        return $entity;
184
-    }
185
-
186
-
187
-
188
-    /**
189
-     * @param CoffeeMakerInterface $coffee_maker
190
-     * @param string               $type
191
-     * @return bool
192
-     */
193
-    public function addCoffeeMaker(CoffeeMakerInterface $coffee_maker, $type)
194
-    {
195
-        $type = CoffeeMaker::validateType($type);
196
-        return $this->coffee_makers->add($coffee_maker, $type);
197
-    }
198
-
199
-
200
-
201
-    /**
202
-     * @param string   $identifier
203
-     * @param callable $closure
204
-     * @return callable|null
205
-     */
206
-    public function addClosure($identifier, $closure)
207
-    {
208
-        if ( ! is_callable($closure)) {
209
-            throw new InvalidDataTypeException('$closure', $closure, 'Closure');
210
-        }
211
-        $identifier = $this->processIdentifier($identifier);
212
-        if ($this->reservoir->add($closure, $identifier)) {
213
-            return $closure;
214
-        }
215
-        return null;
216
-    }
217
-
218
-
219
-
220
-    /**
221
-     * @param string   $identifier
222
-     * @return boolean
223
-     */
224
-    public function removeClosure($identifier)
225
-    {
226
-        $identifier = $this->processIdentifier($identifier);
227
-        if ($this->reservoir->has($identifier)) {
228
-            $this->reservoir->remove($this->reservoir->get($identifier));
229
-            if ( ! $this->reservoir->has($identifier)) {
230
-                return true;
231
-            }
232
-        }
233
-        return false;
234
-    }
235
-
236
-
237
-
238
-    /**
239
-     * @param  string $identifier Identifier for the entity class that the service applies to
240
-     *                            Typically a Fully Qualified Class Name
241
-     * @param mixed  $service
242
-     * @return bool
243
-     */
244
-    public function addService($identifier, $service)
245
-    {
246
-        $identifier = $this->processIdentifier($identifier);
247
-        $service = $this->validateService($identifier, $service);
248
-        return $this->carafe->add($service, $identifier);
249
-    }
250
-
251
-
252
-
253
-    /**
254
-     * @param string $identifier
255
-     * @return boolean
256
-     */
257
-    public function removeService($identifier)
258
-    {
259
-        $identifier = $this->processIdentifier($identifier);
260
-        if ($this->carafe->has($identifier)) {
261
-            $this->carafe->remove($this->carafe->get($identifier));
262
-            if ( ! $this->carafe->has($identifier)) {
263
-                return true;
264
-            }
265
-        }
266
-        return false;
267
-    }
268
-
269
-
270
-
271
-    /**
272
-     * Adds instructions on how to brew objects
273
-     *
274
-     * @param RecipeInterface $recipe
275
-     * @return mixed
276
-     */
277
-    public function addRecipe(RecipeInterface $recipe)
278
-    {
279
-        $this->addAliases($recipe->identifier(), $recipe->filters());
280
-        $identifier = $this->processIdentifier($recipe->identifier());
281
-        return $this->recipes->add($recipe, $identifier);
282
-    }
283
-
284
-
285
-
286
-    /**
287
-     * @param string $identifier The Recipe's identifier
288
-     * @return boolean
289
-     */
290
-    public function removeRecipe($identifier)
291
-    {
292
-        $identifier = $this->processIdentifier($identifier);
293
-        if ($this->recipes->has($identifier)) {
294
-            $this->recipes->remove(
295
-                $this->recipes->get($identifier)
296
-            );
297
-            if ( ! $this->recipes->has($identifier)) {
298
-                return true;
299
-            }
300
-        }
301
-        return false;
302
-    }
303
-
304
-
305
-
306
-    /**
307
-     * Get instructions on how to brew objects
308
-     *
309
-     * @param  string $identifier Identifier for the entity class that the recipe applies to
310
-     *                            Typically a Fully Qualified Class Name
311
-     * @param string $type
312
-     * @return RecipeInterface
313
-     */
314
-    public function getRecipe($identifier, $type = '')
315
-    {
316
-        $identifier = $this->processIdentifier($identifier);
317
-        if ($this->recipes->has($identifier)) {
318
-            return $this->recipes->get($identifier);
319
-        }
320
-        $default_recipes = $this->getDefaultRecipes();
321
-        $matches = array();
322
-        foreach ($default_recipes as $wildcard => $default_recipe) {
323
-            // is the wildcard recipe prefix in the identifier ?
324
-            if (strpos($identifier, $wildcard) !== false) {
325
-                // track matches and use the number of wildcard characters matched for the key
326
-                $matches[strlen($wildcard)] = $default_recipe;
327
-            }
328
-        }
329
-        if (count($matches) > 0) {
330
-            // sort our recipes by the number of wildcard characters matched
331
-            ksort($matches);
332
-            // then grab the last recipe form the list, since it had the most matching characters
333
-            $match = array_pop($matches);
334
-            // since we are using a default recipe, we need to set it's identifier and fqcn
335
-            return $this->copyDefaultRecipe($match, $identifier, $type);
336
-        }
337
-        if ($this->recipes->has(Recipe::DEFAULT_ID)) {
338
-            // since we are using a default recipe, we need to set it's identifier and fqcn
339
-            return $this->copyDefaultRecipe($this->recipes->get(Recipe::DEFAULT_ID), $identifier, $type);
340
-        }
341
-        throw new OutOfBoundsException(
342
-            sprintf(
343
-                __('Could not brew coffee because no recipes were found for class "%1$s".', 'event_espresso'),
344
-                $identifier
345
-            )
346
-        );
347
-    }
348
-
349
-
350
-
351
-    /**
352
-     * adds class name aliases to list of filters
353
-     *
354
-     * @param  string $identifier Identifier for the entity class that the alias applies to
355
-     *                            Typically a Fully Qualified Class Name
356
-     * @param  array  $aliases
357
-     * @return void
358
-     * @throws InvalidIdentifierException
359
-     */
360
-    public function addAliases($identifier, $aliases)
361
-    {
362
-        if (empty($aliases)) {
363
-            return;
364
-        }
365
-        $identifier = $this->processIdentifier($identifier);
366
-        foreach ((array)$aliases as $alias) {
367
-            $this->filters[$this->processIdentifier($alias)] = $identifier;
368
-        }
369
-    }
370
-
371
-
372
-
373
-    /**
374
-     * Adds a service to one of the internal collections
375
-     *
376
-     * @param        $identifier
377
-     * @param array  $arguments
378
-     * @param string $type
379
-     * @return mixed
380
-     * @throws ServiceExistsException
381
-     */
382
-    private function makeCoffee($identifier, $arguments = array(), $type = '')
383
-    {
384
-        if ((empty($type) || $type === CoffeeMaker::BREW_SHARED) && $this->has($identifier)) {
385
-            throw new ServiceExistsException($identifier);
386
-        }
387
-        $identifier = $this->filterIdentifier($identifier);
388
-        $recipe = $this->getRecipe($identifier, $type);
389
-        $type = ! empty($type) ? $type : $recipe->type();
390
-        $coffee_maker = $this->getCoffeeMaker($type);
391
-        return $coffee_maker->brew($recipe, $arguments);
392
-    }
393
-
394
-
395
-
396
-    /**
397
-     * filters alias identifiers to find the real class name
398
-     *
399
-     * @param  string $identifier Identifier for the entity class that the filter applies to
400
-     *                            Typically a Fully Qualified Class Name
401
-     * @return string
402
-     * @throws InvalidIdentifierException
403
-     */
404
-    private function filterIdentifier($identifier)
405
-    {
406
-        $identifier = $this->processIdentifier($identifier);
407
-        return isset($this->filters[$identifier]) && ! empty($this->filters[$identifier])
408
-            ? $this->filters[$identifier]
409
-            : $identifier;
410
-    }
411
-
412
-
413
-
414
-    /**
415
-     * verifies and standardizes identifiers
416
-     *
417
-     * @param  string $identifier Identifier for the entity class
418
-     *                            Typically a Fully Qualified Class Name
419
-     * @return string
420
-     * @throws InvalidIdentifierException
421
-     */
422
-    private function processIdentifier($identifier)
423
-    {
424
-        if ( ! is_string($identifier)) {
425
-            throw new InvalidIdentifierException(
426
-                is_object($identifier) ? get_class($identifier) : gettype($identifier),
427
-                '\Fully\Qualified\ClassName'
428
-            );
429
-        }
430
-        return ltrim($identifier, '\\');
431
-    }
432
-
433
-
434
-
435
-    /**
436
-     * @param string $type
437
-     * @return CoffeeMakerInterface
438
-     * @throws InvalidDataTypeException
439
-     * @throws InvalidClassException
440
-     */
441
-    private function getCoffeeMaker($type)
442
-    {
443
-        if ( ! $this->coffee_makers->has($type)) {
444
-            throw new OutOfBoundsException(
445
-                __('The requested coffee maker is either missing or invalid.', 'event_espresso')
446
-            );
447
-        }
448
-        return $this->coffee_makers->get($type);
449
-    }
450
-
451
-
452
-
453
-    /**
454
-     * Retrieves all recipes that use a wildcard "*" in their identifier
455
-     * This allows recipes to be set up for handling
456
-     * legacy classes that do not support PSR-4 autoloading.
457
-     * for example:
458
-     * using "EEM_*" for a recipe identifier would target all legacy models like EEM_Attendee
459
-     *
460
-     * @return array
461
-     */
462
-    private function getDefaultRecipes()
463
-    {
464
-        $default_recipes = array();
465
-        $this->recipes->rewind();
466
-        while ($this->recipes->valid()) {
467
-            $identifier = $this->recipes->getInfo();
468
-            // does this recipe use a wildcard ? (but is NOT the global default)
469
-            if ($identifier !== Recipe::DEFAULT_ID && strpos($identifier, '*') !== false) {
470
-                // strip the wildcard and use identifier as key
471
-                $default_recipes[str_replace('*', '', $identifier)] = $this->recipes->current();
472
-            }
473
-            $this->recipes->next();
474
-        }
475
-        return $default_recipes;
476
-    }
477
-
478
-
479
-
480
-    /**
481
-     * clones a default recipe and then copies details
482
-     * from the incoming request to it so that it can be used
483
-     *
484
-     * @param RecipeInterface $default_recipe
485
-     * @param string          $identifier
486
-     * @param string          $type
487
-     * @return RecipeInterface
488
-     */
489
-    private function copyDefaultRecipe(RecipeInterface $default_recipe, $identifier, $type = '')
490
-    {
491
-        $recipe = clone $default_recipe;
492
-        if ( ! empty($type)) {
493
-            $recipe->setType($type);
494
-        }
495
-        // is this the base default recipe ?
496
-        if ($default_recipe->identifier() === Recipe::DEFAULT_ID) {
497
-            $recipe->setIdentifier($identifier);
498
-            $recipe->setFqcn($identifier);
499
-            return $recipe;
500
-        }
501
-        $recipe->setIdentifier($identifier);
502
-        foreach ($default_recipe->paths() as $path) {
503
-            $path = str_replace('*', $identifier, $path);
504
-            if (is_readable($path)) {
505
-                $recipe->setPaths($path);
506
-            }
507
-        }
508
-        $recipe->setFqcn($identifier);
509
-        return $recipe;
510
-    }
511
-
512
-
513
-
514
-    /**
515
-     * @param  string $identifier Identifier for the entity class that the service applies to
516
-     *                            Typically a Fully Qualified Class Name
517
-     * @param mixed  $service
518
-     * @return object
519
-     * @throws InvalidServiceException
520
-     */
521
-    private function validateService($identifier, $service)
522
-    {
523
-        if ( ! is_object($service)) {
524
-            throw new InvalidServiceException(
525
-                $identifier,
526
-                $service
527
-            );
528
-        }
529
-        return $service;
530
-    }
35
+	/**
36
+	 * This was the best coffee related name I could think of to represent class name "aliases"
37
+	 * So classes can be found via an alias identifier,
38
+	 * that is revealed when it is run through... the filters... eh? get it?
39
+	 *
40
+	 * @var array $filters
41
+	 */
42
+	private $filters = array();
43
+
44
+	/**
45
+	 * These are the classes that will actually build the objects (to order of course)
46
+	 *
47
+	 * @var array $coffee_makers
48
+	 */
49
+	private $coffee_makers = array();
50
+
51
+	/**
52
+	 * where the instantiated "singleton" objects are stored
53
+	 *
54
+	 * @var CollectionInterface $carafe
55
+	 */
56
+	private $carafe;
57
+
58
+	/**
59
+	 * collection of Recipes that instruct us how to brew objects
60
+	 *
61
+	 * @var CollectionInterface $recipes
62
+	 */
63
+	private $recipes;
64
+
65
+	/**
66
+	 * collection of closures for brewing objects
67
+	 *
68
+	 * @var CollectionInterface $reservoir
69
+	 */
70
+	private $reservoir;
71
+
72
+
73
+
74
+	/**
75
+	 * CoffeeShop constructor
76
+	 */
77
+	public function __construct()
78
+	{
79
+		// array for storing class aliases
80
+		$this->filters = array();
81
+		// create collection for storing shared services
82
+		$this->carafe = new LooseCollection( '' );
83
+		// create collection for storing recipes that tell how to build services and entities
84
+		$this->recipes = new Collection('EventEspresso\core\services\container\RecipeInterface');
85
+		// create collection for storing closures for constructing new entities
86
+		$this->reservoir = new Collection('Closure');
87
+		// create collection for storing the generators that build our services and entity closures
88
+		$this->coffee_makers = new Collection('EventEspresso\core\services\container\CoffeeMakerInterface');
89
+	}
90
+
91
+
92
+
93
+	/**
94
+	 * Returns true if the container can return an entry for the given identifier.
95
+	 * Returns false otherwise.
96
+	 * `has($identifier)` returning true does not mean that `get($identifier)` will not throw an exception.
97
+	 * It does however mean that `get($identifier)` will not throw a `ServiceNotFoundException`.
98
+	 *
99
+	 * @param string $identifier  Identifier of the entry to look for.
100
+	 *                            Typically a Fully Qualified Class Name
101
+	 * @return boolean
102
+	 */
103
+	public function has($identifier)
104
+	{
105
+		$identifier = $this->filterIdentifier($identifier);
106
+		return $this->carafe->has($identifier);
107
+	}
108
+
109
+
110
+
111
+	/**
112
+	 * finds a previously brewed (SHARED) service and returns it
113
+	 *
114
+	 * @param  string $identifier Identifier for the entity class to be constructed.
115
+	 *                            Typically a Fully Qualified Class Name
116
+	 * @return mixed
117
+	 * @throws ServiceNotFoundException No service was found for this identifier.
118
+	 */
119
+	public function get($identifier)
120
+	{
121
+		$identifier = $this->filterIdentifier($identifier);
122
+		if ($this->carafe->has($identifier)) {
123
+			return $this->carafe->get($identifier);
124
+		}
125
+		throw new ServiceNotFoundException($identifier);
126
+	}
127
+
128
+
129
+
130
+	/**
131
+	 * returns an instance of the requested entity type using the supplied arguments.
132
+	 * If a shared service is requested and an instance is already in the carafe, then it will be returned.
133
+	 * If it is not already in the carafe, then the service will be constructed, added to the carafe, and returned
134
+	 * If the request is for a new entity and a closure exists in the reservoir for creating it,
135
+	 * then a new entity will be instantiated from the closure and returned.
136
+	 * If a closure does not exist, then one will be built and added to the reservoir
137
+	 * before instantiating the requested entity.
138
+	 *
139
+	 * @param  string $identifier Identifier for the entity class to be constructed.
140
+	 *                            Typically a Fully Qualified Class Name
141
+	 * @param array   $arguments  an array of arguments to be passed to the entity constructor
142
+	 * @param string  $type
143
+	 * @return mixed
144
+	 * @throws ServiceNotFoundException No service was found for this identifier.
145
+	 */
146
+	public function brew($identifier, $arguments = array(), $type = '')
147
+	{
148
+		// resolve any class aliases that may exist
149
+		$identifier = $this->filterIdentifier($identifier);
150
+		try {
151
+			// is a shared service being requested?
152
+			if (empty($type) || $type === CoffeeMaker::BREW_SHARED) {
153
+				// if a shared service was requested and an instance is in the carafe, then return it
154
+				return $this->get($identifier);
155
+			}
156
+		} catch (ServiceNotFoundException $e) {
157
+			// if not then we'll just catch the ServiceNotFoundException but not do anything just yet,
158
+			// and instead, attempt to build whatever was requested
159
+		}
160
+		$brewed = false;
161
+		// if the reservoir doesn't have a closure already for the requested identifier,
162
+		// then neither a shared service nor a closure for making entities has been built yet
163
+		if ( ! $this->reservoir->has($identifier)) {
164
+			// so let's brew something up and add it to the proper collection
165
+			$brewed = $this->makeCoffee($identifier, $arguments, $type);
166
+		}
167
+		// was the brewed item a callable factory function ?
168
+		if (is_callable($brewed)) {
169
+			// then instantiate a new entity from the cached closure
170
+			$entity = $brewed($arguments);
171
+		} else if ($brewed) {
172
+			// requested object was a shared entity, so attempt to get it from the carafe again
173
+			// because if it wasn't there before, then it should have just been brewed and added,
174
+			// but if it still isn't there, then this time
175
+			// the thrown ServiceNotFoundException will not be caught
176
+			$entity = $this->get($identifier);
177
+		} else {
178
+			// if identifier is for a non-shared entity,
179
+			// then either a cached closure already existed, or was just brewed
180
+			$closure = $this->reservoir->get($identifier);
181
+			$entity = $closure($arguments);
182
+		}
183
+		return $entity;
184
+	}
185
+
186
+
187
+
188
+	/**
189
+	 * @param CoffeeMakerInterface $coffee_maker
190
+	 * @param string               $type
191
+	 * @return bool
192
+	 */
193
+	public function addCoffeeMaker(CoffeeMakerInterface $coffee_maker, $type)
194
+	{
195
+		$type = CoffeeMaker::validateType($type);
196
+		return $this->coffee_makers->add($coffee_maker, $type);
197
+	}
198
+
199
+
200
+
201
+	/**
202
+	 * @param string   $identifier
203
+	 * @param callable $closure
204
+	 * @return callable|null
205
+	 */
206
+	public function addClosure($identifier, $closure)
207
+	{
208
+		if ( ! is_callable($closure)) {
209
+			throw new InvalidDataTypeException('$closure', $closure, 'Closure');
210
+		}
211
+		$identifier = $this->processIdentifier($identifier);
212
+		if ($this->reservoir->add($closure, $identifier)) {
213
+			return $closure;
214
+		}
215
+		return null;
216
+	}
217
+
218
+
219
+
220
+	/**
221
+	 * @param string   $identifier
222
+	 * @return boolean
223
+	 */
224
+	public function removeClosure($identifier)
225
+	{
226
+		$identifier = $this->processIdentifier($identifier);
227
+		if ($this->reservoir->has($identifier)) {
228
+			$this->reservoir->remove($this->reservoir->get($identifier));
229
+			if ( ! $this->reservoir->has($identifier)) {
230
+				return true;
231
+			}
232
+		}
233
+		return false;
234
+	}
235
+
236
+
237
+
238
+	/**
239
+	 * @param  string $identifier Identifier for the entity class that the service applies to
240
+	 *                            Typically a Fully Qualified Class Name
241
+	 * @param mixed  $service
242
+	 * @return bool
243
+	 */
244
+	public function addService($identifier, $service)
245
+	{
246
+		$identifier = $this->processIdentifier($identifier);
247
+		$service = $this->validateService($identifier, $service);
248
+		return $this->carafe->add($service, $identifier);
249
+	}
250
+
251
+
252
+
253
+	/**
254
+	 * @param string $identifier
255
+	 * @return boolean
256
+	 */
257
+	public function removeService($identifier)
258
+	{
259
+		$identifier = $this->processIdentifier($identifier);
260
+		if ($this->carafe->has($identifier)) {
261
+			$this->carafe->remove($this->carafe->get($identifier));
262
+			if ( ! $this->carafe->has($identifier)) {
263
+				return true;
264
+			}
265
+		}
266
+		return false;
267
+	}
268
+
269
+
270
+
271
+	/**
272
+	 * Adds instructions on how to brew objects
273
+	 *
274
+	 * @param RecipeInterface $recipe
275
+	 * @return mixed
276
+	 */
277
+	public function addRecipe(RecipeInterface $recipe)
278
+	{
279
+		$this->addAliases($recipe->identifier(), $recipe->filters());
280
+		$identifier = $this->processIdentifier($recipe->identifier());
281
+		return $this->recipes->add($recipe, $identifier);
282
+	}
283
+
284
+
285
+
286
+	/**
287
+	 * @param string $identifier The Recipe's identifier
288
+	 * @return boolean
289
+	 */
290
+	public function removeRecipe($identifier)
291
+	{
292
+		$identifier = $this->processIdentifier($identifier);
293
+		if ($this->recipes->has($identifier)) {
294
+			$this->recipes->remove(
295
+				$this->recipes->get($identifier)
296
+			);
297
+			if ( ! $this->recipes->has($identifier)) {
298
+				return true;
299
+			}
300
+		}
301
+		return false;
302
+	}
303
+
304
+
305
+
306
+	/**
307
+	 * Get instructions on how to brew objects
308
+	 *
309
+	 * @param  string $identifier Identifier for the entity class that the recipe applies to
310
+	 *                            Typically a Fully Qualified Class Name
311
+	 * @param string $type
312
+	 * @return RecipeInterface
313
+	 */
314
+	public function getRecipe($identifier, $type = '')
315
+	{
316
+		$identifier = $this->processIdentifier($identifier);
317
+		if ($this->recipes->has($identifier)) {
318
+			return $this->recipes->get($identifier);
319
+		}
320
+		$default_recipes = $this->getDefaultRecipes();
321
+		$matches = array();
322
+		foreach ($default_recipes as $wildcard => $default_recipe) {
323
+			// is the wildcard recipe prefix in the identifier ?
324
+			if (strpos($identifier, $wildcard) !== false) {
325
+				// track matches and use the number of wildcard characters matched for the key
326
+				$matches[strlen($wildcard)] = $default_recipe;
327
+			}
328
+		}
329
+		if (count($matches) > 0) {
330
+			// sort our recipes by the number of wildcard characters matched
331
+			ksort($matches);
332
+			// then grab the last recipe form the list, since it had the most matching characters
333
+			$match = array_pop($matches);
334
+			// since we are using a default recipe, we need to set it's identifier and fqcn
335
+			return $this->copyDefaultRecipe($match, $identifier, $type);
336
+		}
337
+		if ($this->recipes->has(Recipe::DEFAULT_ID)) {
338
+			// since we are using a default recipe, we need to set it's identifier and fqcn
339
+			return $this->copyDefaultRecipe($this->recipes->get(Recipe::DEFAULT_ID), $identifier, $type);
340
+		}
341
+		throw new OutOfBoundsException(
342
+			sprintf(
343
+				__('Could not brew coffee because no recipes were found for class "%1$s".', 'event_espresso'),
344
+				$identifier
345
+			)
346
+		);
347
+	}
348
+
349
+
350
+
351
+	/**
352
+	 * adds class name aliases to list of filters
353
+	 *
354
+	 * @param  string $identifier Identifier for the entity class that the alias applies to
355
+	 *                            Typically a Fully Qualified Class Name
356
+	 * @param  array  $aliases
357
+	 * @return void
358
+	 * @throws InvalidIdentifierException
359
+	 */
360
+	public function addAliases($identifier, $aliases)
361
+	{
362
+		if (empty($aliases)) {
363
+			return;
364
+		}
365
+		$identifier = $this->processIdentifier($identifier);
366
+		foreach ((array)$aliases as $alias) {
367
+			$this->filters[$this->processIdentifier($alias)] = $identifier;
368
+		}
369
+	}
370
+
371
+
372
+
373
+	/**
374
+	 * Adds a service to one of the internal collections
375
+	 *
376
+	 * @param        $identifier
377
+	 * @param array  $arguments
378
+	 * @param string $type
379
+	 * @return mixed
380
+	 * @throws ServiceExistsException
381
+	 */
382
+	private function makeCoffee($identifier, $arguments = array(), $type = '')
383
+	{
384
+		if ((empty($type) || $type === CoffeeMaker::BREW_SHARED) && $this->has($identifier)) {
385
+			throw new ServiceExistsException($identifier);
386
+		}
387
+		$identifier = $this->filterIdentifier($identifier);
388
+		$recipe = $this->getRecipe($identifier, $type);
389
+		$type = ! empty($type) ? $type : $recipe->type();
390
+		$coffee_maker = $this->getCoffeeMaker($type);
391
+		return $coffee_maker->brew($recipe, $arguments);
392
+	}
393
+
394
+
395
+
396
+	/**
397
+	 * filters alias identifiers to find the real class name
398
+	 *
399
+	 * @param  string $identifier Identifier for the entity class that the filter applies to
400
+	 *                            Typically a Fully Qualified Class Name
401
+	 * @return string
402
+	 * @throws InvalidIdentifierException
403
+	 */
404
+	private function filterIdentifier($identifier)
405
+	{
406
+		$identifier = $this->processIdentifier($identifier);
407
+		return isset($this->filters[$identifier]) && ! empty($this->filters[$identifier])
408
+			? $this->filters[$identifier]
409
+			: $identifier;
410
+	}
411
+
412
+
413
+
414
+	/**
415
+	 * verifies and standardizes identifiers
416
+	 *
417
+	 * @param  string $identifier Identifier for the entity class
418
+	 *                            Typically a Fully Qualified Class Name
419
+	 * @return string
420
+	 * @throws InvalidIdentifierException
421
+	 */
422
+	private function processIdentifier($identifier)
423
+	{
424
+		if ( ! is_string($identifier)) {
425
+			throw new InvalidIdentifierException(
426
+				is_object($identifier) ? get_class($identifier) : gettype($identifier),
427
+				'\Fully\Qualified\ClassName'
428
+			);
429
+		}
430
+		return ltrim($identifier, '\\');
431
+	}
432
+
433
+
434
+
435
+	/**
436
+	 * @param string $type
437
+	 * @return CoffeeMakerInterface
438
+	 * @throws InvalidDataTypeException
439
+	 * @throws InvalidClassException
440
+	 */
441
+	private function getCoffeeMaker($type)
442
+	{
443
+		if ( ! $this->coffee_makers->has($type)) {
444
+			throw new OutOfBoundsException(
445
+				__('The requested coffee maker is either missing or invalid.', 'event_espresso')
446
+			);
447
+		}
448
+		return $this->coffee_makers->get($type);
449
+	}
450
+
451
+
452
+
453
+	/**
454
+	 * Retrieves all recipes that use a wildcard "*" in their identifier
455
+	 * This allows recipes to be set up for handling
456
+	 * legacy classes that do not support PSR-4 autoloading.
457
+	 * for example:
458
+	 * using "EEM_*" for a recipe identifier would target all legacy models like EEM_Attendee
459
+	 *
460
+	 * @return array
461
+	 */
462
+	private function getDefaultRecipes()
463
+	{
464
+		$default_recipes = array();
465
+		$this->recipes->rewind();
466
+		while ($this->recipes->valid()) {
467
+			$identifier = $this->recipes->getInfo();
468
+			// does this recipe use a wildcard ? (but is NOT the global default)
469
+			if ($identifier !== Recipe::DEFAULT_ID && strpos($identifier, '*') !== false) {
470
+				// strip the wildcard and use identifier as key
471
+				$default_recipes[str_replace('*', '', $identifier)] = $this->recipes->current();
472
+			}
473
+			$this->recipes->next();
474
+		}
475
+		return $default_recipes;
476
+	}
477
+
478
+
479
+
480
+	/**
481
+	 * clones a default recipe and then copies details
482
+	 * from the incoming request to it so that it can be used
483
+	 *
484
+	 * @param RecipeInterface $default_recipe
485
+	 * @param string          $identifier
486
+	 * @param string          $type
487
+	 * @return RecipeInterface
488
+	 */
489
+	private function copyDefaultRecipe(RecipeInterface $default_recipe, $identifier, $type = '')
490
+	{
491
+		$recipe = clone $default_recipe;
492
+		if ( ! empty($type)) {
493
+			$recipe->setType($type);
494
+		}
495
+		// is this the base default recipe ?
496
+		if ($default_recipe->identifier() === Recipe::DEFAULT_ID) {
497
+			$recipe->setIdentifier($identifier);
498
+			$recipe->setFqcn($identifier);
499
+			return $recipe;
500
+		}
501
+		$recipe->setIdentifier($identifier);
502
+		foreach ($default_recipe->paths() as $path) {
503
+			$path = str_replace('*', $identifier, $path);
504
+			if (is_readable($path)) {
505
+				$recipe->setPaths($path);
506
+			}
507
+		}
508
+		$recipe->setFqcn($identifier);
509
+		return $recipe;
510
+	}
511
+
512
+
513
+
514
+	/**
515
+	 * @param  string $identifier Identifier for the entity class that the service applies to
516
+	 *                            Typically a Fully Qualified Class Name
517
+	 * @param mixed  $service
518
+	 * @return object
519
+	 * @throws InvalidServiceException
520
+	 */
521
+	private function validateService($identifier, $service)
522
+	{
523
+		if ( ! is_object($service)) {
524
+			throw new InvalidServiceException(
525
+				$identifier,
526
+				$service
527
+			);
528
+		}
529
+		return $service;
530
+	}
531 531
 
532 532
 }
533 533
 // End of file CoffeeShop.php
Please login to merge, or discard this patch.
core/services/container/exceptions/ServiceNotFoundException.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container\exceptions;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -18,28 +18,28 @@  discard block
 block discarded – undo
18 18
 class ServiceNotFoundException extends \RuntimeException
19 19
 {
20 20
 
21
-    /**
22
-     * ServiceNotFoundException constructor
23
-     *
24
-     * @param string     $service_name the name of the requested service
25
-     * @param string     $message
26
-     * @param int        $code
27
-     * @param \Exception $previous
28
-     */
29
-    public function __construct(
30
-        $service_name,
31
-        $message = '',
32
-        $code = 0,
33
-        \Exception $previous = null
34
-    ) {
35
-        if (empty($message)) {
36
-            $message = sprintf(
37
-                __('The requested service "%1$s" could not found be found in the CoffeeShop.', 'event_espresso'),
38
-                $service_name
39
-            );
40
-        }
41
-        parent::__construct($message, $code, $previous);
42
-    }
21
+	/**
22
+	 * ServiceNotFoundException constructor
23
+	 *
24
+	 * @param string     $service_name the name of the requested service
25
+	 * @param string     $message
26
+	 * @param int        $code
27
+	 * @param \Exception $previous
28
+	 */
29
+	public function __construct(
30
+		$service_name,
31
+		$message = '',
32
+		$code = 0,
33
+		\Exception $previous = null
34
+	) {
35
+		if (empty($message)) {
36
+			$message = sprintf(
37
+				__('The requested service "%1$s" could not found be found in the CoffeeShop.', 'event_espresso'),
38
+				$service_name
39
+			);
40
+		}
41
+		parent::__construct($message, $code, $previous);
42
+	}
43 43
 }
44 44
 // End of file ServiceNotFoundException.php
45 45
 // Location: /ServiceNotFoundException.php
46 46
\ No newline at end of file
Please login to merge, or discard this patch.
core/services/container/exceptions/ServiceExistsException.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container\exceptions;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -19,28 +19,28 @@  discard block
 block discarded – undo
19 19
 {
20 20
 
21 21
 
22
-    /**
23
-     * ServiceExistsException constructor
24
-     *
25
-     * @param string     $service_name the name of the requested service
26
-     * @param string     $message
27
-     * @param int        $code
28
-     * @param \Exception $previous
29
-     */
30
-    public function __construct(
31
-        $service_name,
32
-        $message = '',
33
-        $code = 0,
34
-        \Exception $previous = null
35
-    ) {
36
-        if (empty($message)) {
37
-            $message = sprintf(
38
-                __('The "%1$s" service already exists in the CoffeeShop and can not be added again.', 'event_espresso'),
39
-                $service_name
40
-            );
41
-        }
42
-        parent::__construct($message, $code, $previous);
43
-    }
22
+	/**
23
+	 * ServiceExistsException constructor
24
+	 *
25
+	 * @param string     $service_name the name of the requested service
26
+	 * @param string     $message
27
+	 * @param int        $code
28
+	 * @param \Exception $previous
29
+	 */
30
+	public function __construct(
31
+		$service_name,
32
+		$message = '',
33
+		$code = 0,
34
+		\Exception $previous = null
35
+	) {
36
+		if (empty($message)) {
37
+			$message = sprintf(
38
+				__('The "%1$s" service already exists in the CoffeeShop and can not be added again.', 'event_espresso'),
39
+				$service_name
40
+			);
41
+		}
42
+		parent::__construct($message, $code, $previous);
43
+	}
44 44
 
45 45
 
46 46
 }
Please login to merge, or discard this patch.
core/services/container/exceptions/InvalidServiceException.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container\exceptions;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -18,29 +18,29 @@  discard block
 block discarded – undo
18 18
 class InvalidServiceException extends \UnexpectedValueException
19 19
 {
20 20
 
21
-    /**
22
-     * InvalidServiceException constructor.
23
-     *
24
-     * @param string     $service_name the name of the requested service
25
-     * @param string     $actual       classname of what we got
26
-     * @param string     $message
27
-     * @param int        $code
28
-     * @param \Exception $previous
29
-     */
30
-    public function __construct($service_name, $actual, $message = '', $code = 0, \Exception $previous = null)
31
-    {
32
-        if (empty($message)) {
33
-            $message = sprintf(
34
-                __(
35
-                    'The "%1$s" service could not be retrieved from the CoffeeShop, but "%2$s" was received.',
36
-                    'event_espresso'
37
-                ),
38
-                $service_name,
39
-                print_r($actual, true)
40
-            );
41
-        }
42
-        parent::__construct($message, $code, $previous);
43
-    }
21
+	/**
22
+	 * InvalidServiceException constructor.
23
+	 *
24
+	 * @param string     $service_name the name of the requested service
25
+	 * @param string     $actual       classname of what we got
26
+	 * @param string     $message
27
+	 * @param int        $code
28
+	 * @param \Exception $previous
29
+	 */
30
+	public function __construct($service_name, $actual, $message = '', $code = 0, \Exception $previous = null)
31
+	{
32
+		if (empty($message)) {
33
+			$message = sprintf(
34
+				__(
35
+					'The "%1$s" service could not be retrieved from the CoffeeShop, but "%2$s" was received.',
36
+					'event_espresso'
37
+				),
38
+				$service_name,
39
+				print_r($actual, true)
40
+			);
41
+		}
42
+		parent::__construct($message, $code, $previous);
43
+	}
44 44
 
45 45
 }
46 46
 // End of file InvalidServiceException.php
Please login to merge, or discard this patch.
templates/support_admin_details_shortcodes_event_listings.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <div class="padding">
2 2
 	<p>
3
-        <?php esc_html_e('Displays a list of events based on a set of criteria on a WordPress page or post. Unless otherwise specified, events are sorted by start date.', 'event_espresso'); ?> <?php echo sprintf( esc_html__('For a full list of available shortcodes, please view the %sshortcode documentation%s on our website.', 'event_espresso'), '<a href="https://eventespresso.com/wiki/ee4-shortcodes-template-variables/">', '</a>' ); ?>
3
+        <?php esc_html_e('Displays a list of events based on a set of criteria on a WordPress page or post. Unless otherwise specified, events are sorted by start date.', 'event_espresso'); ?> <?php echo sprintf(esc_html__('For a full list of available shortcodes, please view the %sshortcode documentation%s on our website.', 'event_espresso'), '<a href="https://eventespresso.com/wiki/ee4-shortcodes-template-variables/">', '</a>'); ?>
4 4
     </p>
5 5
 		<ul>
6 6
 			<li><strong><?php esc_html_e('Show a list of all of your events', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS]</li>
7 7
 			<li><strong><?php esc_html_e('Set a custom title for the event list', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS title="My Super Event List"]</li>
8 8
 			<li><strong><?php esc_html_e('Limit (paginate) the number of events that are shown in the event list on a page or post', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS limit=5]</li>
9 9
 			<li><strong><?php esc_html_e('Add a custom CSS class to each event post/article', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS css_class=my-custom-class]</li>
10
-			<li><strong><?php esc_html_e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date( 'F Y' ); ?>"]</li>
10
+			<li><strong><?php esc_html_e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date('F Y'); ?>"]</li>
11 11
 			<li><strong><?php esc_html_e('Show expired events in the event list', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS show_expired=true]</li>
12 12
 			<li><strong><?php esc_html_e('Sorts the event list in ascending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort=ASC]</li>
13 13
 			<li><strong><?php esc_html_e('Sorts the event list in descending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort=DESC]</li>
Please login to merge, or discard this patch.
general_settings/templates/your_organization_settings.template.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <div class="padding">
2 2
 	<?php
3 3
 		//we'll only show site-license keys if this is main_site() (which works for both multi-site and single-site wp installations)
4
-		if ( is_main_site() ) { ?>
4
+		if (is_main_site()) { ?>
5 5
 		<h2 class="ee-admin-settings-hdr" style="width:300px;">
6 6
 			<?php _e('Your Event Espresso License Key', 'event_espresso'); ?>
7 7
 		</h2>
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 				<tr <?php echo isset($_REQUEST['license_key']) && $_REQUEST['license_key'] == true ? 'class="yellow_alert"' : '' ?>>
12 12
 					<th>
13 13
 						<label for="site_license_key">
14
-							<?php _e('Support License Key', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('site_license_key_info');?>
14
+							<?php _e('Support License Key', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('site_license_key_info'); ?>
15 15
 						</label>
16 16
 					</th>
17 17
 					<td>
18 18
 						<input name="site_license_key" id="site_license_key" size="10" class="regular-text" type="text" value="<?php echo $site_license_key; ?>" /><?php echo $site_license_key_verified; ?><br/>
19 19
 						<p class="description">
20
-							<?php printf( __('Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.', 'event_espresso'), '<strong>', '</strong>' ); ?>
20
+							<?php printf(__('Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.', 'event_espresso'), '<strong>', '</strong>'); ?>
21 21
 						</p>
22 22
 					</td>
23 23
 				</tr>
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 
32 32
 	<h2 id="contact_info_h4" class="ee-admin-settings-hdr">
33
-		<?php _e('Contact Information', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('contact_info_info');?>
33
+		<?php _e('Contact Information', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('contact_info_info'); ?>
34 34
 	</h2>
35 35
 
36 36
 	<table class="form-table">
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 					<input id="organization_city" class="regular-text" type="text" name="organization_city" value="<?php echo $organization_city; ?>" />
79 79
 				</td>
80 80
 			</tr>
81
-			<?php echo EEH_Form_Fields::generate_form_input( $states ); ?>
82
-			<?php echo EEH_Form_Fields::generate_form_input( $countries ); ?>
81
+			<?php echo EEH_Form_Fields::generate_form_input($states); ?>
82
+			<?php echo EEH_Form_Fields::generate_form_input($countries); ?>
83 83
 			<tr>
84 84
 				<th>
85 85
 					<label for="organization_zip">
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 				<td>
100 100
 					<input class="regular-text" type="text" name="organization_email" value="<?php echo $organization_email; ?>" />
101 101
 					<p class="description">
102
-						<?php echo sprintf( esc_html__('This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.', 'event_espresso'), '<code>[CO_FORMATTED_EMAIL]</code>', '<code>[CO_EMAIL]</code>' ); ?>
102
+						<?php echo sprintf(esc_html__('This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.', 'event_espresso'), '<code>[CO_FORMATTED_EMAIL]</code>', '<code>[CO_EMAIL]</code>'); ?>
103 103
 					</p>
104 104
 				</td>
105 105
 			</tr>
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	</table>
134 134
 
135 135
 	<h2 class="ee-admin-settings-hdr">
136
-		<?php _e('Company Logo', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('organization_logo_info');?>
136
+		<?php _e('Company Logo', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('organization_logo_info'); ?>
137 137
 	</h2>
138 138
 
139 139
 	<table class="form-table">
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 				</th>
162 162
 				<td>
163 163
 					<?php
164
-					if ( $organization_logo_url ) {
164
+					if ($organization_logo_url) {
165 165
 						?>
166 166
 						<p id="default-logo-thumb">
167 167
 							<img id="current-image-thumb" src="<?php echo $organization_logo_url ?>" alt="" /><br />
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	<br/><br/>
180 180
 
181 181
 	<h2 class="ee-admin-settings-hdr">
182
-		<?php _e('Social Links', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('social_links_info');?>
182
+		<?php _e('Social Links', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('social_links_info'); ?>
183 183
 	</h2>
184 184
 	<p class="description"><?php _e('Enter any links to social accounts for your organization here', 'event_espresso'); ?></p>
185 185
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 	<br/><br/>
257 257
 
258 258
 
259
-	<?php if ( is_main_site() ) : ?>
259
+	<?php if (is_main_site()) : ?>
260 260
 		<p>
261
-			<?php echo  EE_PUE::espresso_data_collection_optin_text( FALSE ); ?>
261
+			<?php echo  EE_PUE::espresso_data_collection_optin_text(FALSE); ?>
262 262
 		</p>
263 263
 
264 264
 		<table class="form-table">
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 					</th>
273 273
 					<td>
274 274
 						<?php
275
-							$values=array(
276
-								array('id'=>'yes','text'=> __('Yes! I want to help improve Event Espresso!','event_espresso')),
277
-								array('id'=>'no','text'=> __('Not at this time. Maybe later.','event_espresso'))
275
+							$values = array(
276
+								array('id'=>'yes', 'text'=> __('Yes! I want to help improve Event Espresso!', 'event_espresso')),
277
+								array('id'=>'no', 'text'=> __('Not at this time. Maybe later.', 'event_espresso'))
278 278
 							);
279
-							echo EEH_Form_Fields::select_input('ueip_optin', $values, !empty($ee_ueip_optin) ? $ee_ueip_optin : 'yes');
279
+							echo EEH_Form_Fields::select_input('ueip_optin', $values, ! empty($ee_ueip_optin) ? $ee_ueip_optin : 'yes');
280 280
 						?>
281 281
 					</td>
282 282
 				</tr>
Please login to merge, or discard this patch.
pricing/templates/event_tickets_datetime_attached_tickets_row.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 				</table>
52 52
 				<div class="ee-editor-footer-container">
53 53
 					<div class="ee-editor-id-container">
54
-						<span class="ee-item-id"><?php echo $DTT_ID ? sprintf( esc_html__( 'Datetime ID: %d', 'event_espresso' ), $DTT_ID ) : ''; ?></span>
54
+						<span class="ee-item-id"><?php echo $DTT_ID ? sprintf(esc_html__('Datetime ID: %d', 'event_espresso'), $DTT_ID) : ''; ?></span>
55 55
 					</div>
56 56
 					<div class="save-cancel-button-container">
57 57
 						<button data-context="short-ticket" data-datetime-row="<?php echo $dtt_row; ?>" class="button-primary ee-create-button">
Please login to merge, or discard this patch.