Completed
Branch FET-9795-new-interfaces (ea072c)
by
unknown
51:56 queued 35:16
created
commands/registration/CancelRegistrationAndTicketLineItemCommandHandler.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use EventEspresso\core\services\commands\CommandInterface;
8 8
 
9 9
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10
-    exit('No direct script access allowed');
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 
13 13
 
@@ -24,42 +24,42 @@  discard block
 block discarded – undo
24 24
 {
25 25
 
26 26
 
27
-    /**
28
-     * @var CancelTicketLineItemService $cancel_ticket_line_item_service
29
-     */
30
-    private $cancel_ticket_line_item_service;
31
-
32
-
33
-
34
-    /**
35
-     * Command constructor
36
-     *
37
-     * @param CancelTicketLineItemService $cancel_ticket_line_item_service
38
-     */
39
-    public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service)
40
-    {
41
-        $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service;
42
-    }
43
-
44
-
45
-
46
-    /**
47
-     * @param \EventEspresso\core\services\commands\CommandInterface $command
48
-     * @return boolean
49
-     */
50
-    public function handle(CommandInterface $command)
51
-    {
52
-        /** @var CancelRegistrationAndTicketLineItemCommand $command */
53
-        if ( ! $command instanceof CancelRegistrationAndTicketLineItemCommand) {
54
-            throw new InvalidEntityException(get_class($command), 'CancelRegistrationAndTicketLineItemCommand');
55
-        }
56
-        $registration = $command->registration();
57
-        $this->cancel_ticket_line_item_service->forRegistration($registration);
58
-        // cancel original registration
59
-        $registration->set_status(\EEM_Registration::status_id_cancelled);
60
-        $registration->save();
61
-        return true;
62
-    }
27
+	/**
28
+	 * @var CancelTicketLineItemService $cancel_ticket_line_item_service
29
+	 */
30
+	private $cancel_ticket_line_item_service;
31
+
32
+
33
+
34
+	/**
35
+	 * Command constructor
36
+	 *
37
+	 * @param CancelTicketLineItemService $cancel_ticket_line_item_service
38
+	 */
39
+	public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service)
40
+	{
41
+		$this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service;
42
+	}
43
+
44
+
45
+
46
+	/**
47
+	 * @param \EventEspresso\core\services\commands\CommandInterface $command
48
+	 * @return boolean
49
+	 */
50
+	public function handle(CommandInterface $command)
51
+	{
52
+		/** @var CancelRegistrationAndTicketLineItemCommand $command */
53
+		if ( ! $command instanceof CancelRegistrationAndTicketLineItemCommand) {
54
+			throw new InvalidEntityException(get_class($command), 'CancelRegistrationAndTicketLineItemCommand');
55
+		}
56
+		$registration = $command->registration();
57
+		$this->cancel_ticket_line_item_service->forRegistration($registration);
58
+		// cancel original registration
59
+		$registration->set_status(\EEM_Registration::status_id_cancelled);
60
+		$registration->save();
61
+		return true;
62
+	}
63 63
 
64 64
 
65 65
 
Please login to merge, or discard this patch.
core/services/commands/registration/CreateRegistrationCommandHandler.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use EventEspresso\core\services\commands\CommandInterface;
8 8
 
9 9
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10
-    exit('No direct script access allowed');
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 
13 13
 
@@ -23,45 +23,45 @@  discard block
 block discarded – undo
23 23
 class CreateRegistrationCommandHandler extends CommandHandler
24 24
 {
25 25
 
26
-    /**
27
-     * @var CreateRegistrationService $registration_service
28
-     */
29
-    private $registration_service;
26
+	/**
27
+	 * @var CreateRegistrationService $registration_service
28
+	 */
29
+	private $registration_service;
30 30
 
31 31
 
32 32
 
33
-    /**
34
-     * Command constructor
35
-     *
36
-     * @param CreateRegistrationService $registration_service
37
-     */
38
-    public function __construct(CreateRegistrationService $registration_service)
39
-    {
40
-        $this->registration_service = $registration_service;
41
-    }
33
+	/**
34
+	 * Command constructor
35
+	 *
36
+	 * @param CreateRegistrationService $registration_service
37
+	 */
38
+	public function __construct(CreateRegistrationService $registration_service)
39
+	{
40
+		$this->registration_service = $registration_service;
41
+	}
42 42
 
43 43
 
44 44
 
45
-    /**
46
-     * @param  CommandInterface $command
47
-     * @return mixed
48
-     */
49
-    public function handle(CommandInterface $command)
50
-    {
51
-        /** @var CreateRegistrationCommand $command */
52
-        if ( ! $command instanceof CreateRegistrationCommand) {
53
-            throw new InvalidEntityException(get_class($command), 'CreateRegistrationCommand');
54
-        }
55
-        // now create a new registration for the ticket
56
-        return $this->registration_service->create(
57
-            $command->ticket()->get_related_event(),
58
-            $command->transaction(),
59
-            $command->ticket(),
60
-            $command->ticketLineItem(),
61
-            $command->regCount(),
62
-            $command->regGroupSize()
63
-        );
64
-    }
45
+	/**
46
+	 * @param  CommandInterface $command
47
+	 * @return mixed
48
+	 */
49
+	public function handle(CommandInterface $command)
50
+	{
51
+		/** @var CreateRegistrationCommand $command */
52
+		if ( ! $command instanceof CreateRegistrationCommand) {
53
+			throw new InvalidEntityException(get_class($command), 'CreateRegistrationCommand');
54
+		}
55
+		// now create a new registration for the ticket
56
+		return $this->registration_service->create(
57
+			$command->ticket()->get_related_event(),
58
+			$command->transaction(),
59
+			$command->ticket(),
60
+			$command->ticketLineItem(),
61
+			$command->regCount(),
62
+			$command->regGroupSize()
63
+		);
64
+	}
65 65
 
66 66
 
67 67
 
Please login to merge, or discard this patch.
services/commands/registration/CopyRegistrationPaymentsCommandHandler.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use EventEspresso\core\services\commands\CommandInterface;
8 8
 
9 9
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10
-    exit('No direct script access allowed');
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 
13 13
 
@@ -26,40 +26,40 @@  discard block
 block discarded – undo
26 26
 {
27 27
 
28 28
 
29
-    /**
30
-     * @var CopyRegistrationService $copy_registration_service
31
-     */
32
-    private $copy_registration_service;
33
-
34
-
35
-
36
-    /**
37
-     * Command constructor
38
-     *
39
-     * @param CopyRegistrationService $copy_registration_service
40
-     */
41
-    public function __construct(CopyRegistrationService $copy_registration_service)
42
-    {
43
-        $this->copy_registration_service = $copy_registration_service;
44
-    }
45
-
46
-
47
-
48
-    /**
49
-     * @param \EventEspresso\core\services\commands\CommandInterface $command
50
-     * @return boolean
51
-     */
52
-    public function handle(CommandInterface $command)
53
-    {
54
-        /** @var CopyRegistrationPaymentsCommand $command */
55
-        if ( ! $command instanceof CopyRegistrationPaymentsCommand) {
56
-            throw new InvalidEntityException(get_class($command), 'CopyRegistrationPaymentsCommand');
57
-        }
58
-        return $this->copy_registration_service->copyPaymentDetails(
59
-            $command->targetRegistration(),
60
-            $command->registrationToCopy()
61
-        );
62
-    }
29
+	/**
30
+	 * @var CopyRegistrationService $copy_registration_service
31
+	 */
32
+	private $copy_registration_service;
33
+
34
+
35
+
36
+	/**
37
+	 * Command constructor
38
+	 *
39
+	 * @param CopyRegistrationService $copy_registration_service
40
+	 */
41
+	public function __construct(CopyRegistrationService $copy_registration_service)
42
+	{
43
+		$this->copy_registration_service = $copy_registration_service;
44
+	}
45
+
46
+
47
+
48
+	/**
49
+	 * @param \EventEspresso\core\services\commands\CommandInterface $command
50
+	 * @return boolean
51
+	 */
52
+	public function handle(CommandInterface $command)
53
+	{
54
+		/** @var CopyRegistrationPaymentsCommand $command */
55
+		if ( ! $command instanceof CopyRegistrationPaymentsCommand) {
56
+			throw new InvalidEntityException(get_class($command), 'CopyRegistrationPaymentsCommand');
57
+		}
58
+		return $this->copy_registration_service->copyPaymentDetails(
59
+			$command->targetRegistration(),
60
+			$command->registrationToCopy()
61
+		);
62
+	}
63 63
 
64 64
 
65 65
 
Please login to merge, or discard this patch.
registration/UpdateRegistrationAndTransactionAfterChangeCommandHandler.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 use EventEspresso\core\services\commands\CommandHandler;
7 7
 use EventEspresso\core\services\commands\CommandInterface;
8 8
 
9
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
10
-	exit( 'No direct script access allowed' );
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 
13 13
 
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 	 * @param \EventEspresso\core\services\commands\CommandInterface $command
49 49
 	 * @return boolean
50 50
 	 */
51
-	public function handle( CommandInterface $command )
51
+	public function handle(CommandInterface $command)
52 52
 	{
53 53
 		/** @var UpdateRegistrationAndTransactionAfterChangeCommand $command */
54
-		if ( ! $command instanceof UpdateRegistrationAndTransactionAfterChangeCommand ) {
54
+		if ( ! $command instanceof UpdateRegistrationAndTransactionAfterChangeCommand) {
55 55
 			throw new InvalidEntityException(
56 56
 				get_class($command),
57 57
 				'UpdateRegistrationAndTransactionAfterChangeCommand'
Please login to merge, or discard this patch.
core/exceptions/ExceptionLogger.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\exceptions;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param \Exception $exception
26 26
 	 */
27
-	public function __construct( \Exception $exception ) {
28
-		$this->log( $exception );
27
+	public function __construct(\Exception $exception) {
28
+		$this->log($exception);
29 29
 	}
30 30
 
31 31
 
@@ -36,22 +36,22 @@  discard block
 block discarded – undo
36 36
 	 * @param \Exception $exception
37 37
 	 * @param int        $time
38 38
 	 */
39
-	public function log( \Exception $exception, $time = 0 ) {
40
-		if ( ! $time ) {
39
+	public function log(\Exception $exception, $time = 0) {
40
+		if ( ! $time) {
41 41
 			$time = time();
42 42
 		}
43 43
 		$exception_log = '----------------------------------------------------------------------------------------';
44 44
 		$exception_log .= PHP_EOL;
45
-		$exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . ']  Exception Details' . PHP_EOL;
46
-		$exception_log .= 'Message: ' . $exception->getMessage() . PHP_EOL;
47
-		$exception_log .= 'Code: ' . $exception->getCode() . PHP_EOL;
48
-		$exception_log .= 'File: ' . $exception->getFile() . PHP_EOL;
49
-		$exception_log .= 'Line No: ' . $exception->getLine() . PHP_EOL;
50
-		$exception_log .= 'Stack trace: ' . PHP_EOL;
51
-		$exception_log .= $exception->getTraceAsString() . PHP_EOL;
45
+		$exception_log .= '['.date('Y-m-d H:i:s', $time).']  Exception Details'.PHP_EOL;
46
+		$exception_log .= 'Message: '.$exception->getMessage().PHP_EOL;
47
+		$exception_log .= 'Code: '.$exception->getCode().PHP_EOL;
48
+		$exception_log .= 'File: '.$exception->getFile().PHP_EOL;
49
+		$exception_log .= 'Line No: '.$exception->getLine().PHP_EOL;
50
+		$exception_log .= 'Stack trace: '.PHP_EOL;
51
+		$exception_log .= $exception->getTraceAsString().PHP_EOL;
52 52
 		$exception_log .= '----------------------------------------------------------------------------------------';
53
-		$exception_log .=  PHP_EOL;
54
-		error_log( $exception_log );
53
+		$exception_log .= PHP_EOL;
54
+		error_log($exception_log);
55 55
 	}
56 56
 
57 57
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Ticket.class.php 1 patch
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\exceptions\UnexpectedEntityException;
2 2
 
3
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 /**
7 7
  * Event Espresso
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 	 *                             		    date_format and the second value is the time format
69 69
 	 * @return EE_Ticket
70 70
 	 */
71
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
72
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
73
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
71
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
72
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
73
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
74 74
 	}
75 75
 
76 76
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 *                          		the website will be used.
82 82
 	 * @return EE_Ticket
83 83
 	 */
84
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
85
-		return new self( $props_n_values, TRUE, $timezone );
84
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
85
+		return new self($props_n_values, TRUE, $timezone);
86 86
 	}
87 87
 
88 88
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @return bool
92 92
 	 */
93 93
 	public function parent() {
94
-		return $this->get( 'TKT_parent' );
94
+		return $this->get('TKT_parent');
95 95
 	}
96 96
 
97 97
 
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
 	 * @param  int $DTT_ID the primary key for a particular datetime
102 102
 	 * @return boolean
103 103
 	 */
104
-	public function available( $DTT_ID = 0 ) {
104
+	public function available($DTT_ID = 0) {
105 105
 		// are we checking availability for a particular datetime ?
106
-		if ( $DTT_ID ) {
106
+		if ($DTT_ID) {
107 107
 			// get that datetime object
108
-			$datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) );
108
+			$datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID)));
109 109
 			// if  ticket sales for this datetime have exceeded the reg limit...
110
-			if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) {
110
+			if ($datetime instanceof EE_Datetime && $datetime->sold_out()) {
111 111
 				return FALSE;
112 112
 			}
113 113
 		}
@@ -122,21 +122,21 @@  discard block
 block discarded – undo
122 122
 	 * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const
123 123
 	 * @return mixed(int|string) status int if the display string isn't requested
124 124
 	 */
125
-	public function ticket_status( $display = FALSE ) {
126
-		if ( ! $this->is_remaining() ) {
127
-			return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out;
125
+	public function ticket_status($display = FALSE) {
126
+		if ( ! $this->is_remaining()) {
127
+			return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out;
128 128
 		}
129
-		if ( $this->get( 'TKT_deleted' ) ) {
130
-			return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived;
129
+		if ($this->get('TKT_deleted')) {
130
+			return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived;
131 131
 		}
132
-		if ( $this->is_expired() ) {
133
-			return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired;
132
+		if ($this->is_expired()) {
133
+			return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired;
134 134
 		}
135
-		if ( $this->is_pending() ) {
136
-			return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending;
135
+		if ($this->is_pending()) {
136
+			return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending;
137 137
 		}
138
-		if ( $this->is_on_sale() ) {
139
-			return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale;
138
+		if ($this->is_on_sale()) {
139
+			return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale;
140 140
 		}
141 141
 		return '';
142 142
 	}
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 	 * @param  int $DTT_ID if an int above 0 is included here then we get a specific dtt.
151 151
 	 * @return boolean         true = tickets remaining, false not.
152 152
 	 */
153
-	public function is_remaining( $DTT_ID = 0 ) {
154
-		$num_remaining = $this->remaining( $DTT_ID );
155
-		if ( $num_remaining === 0 ) {
153
+	public function is_remaining($DTT_ID = 0) {
154
+		$num_remaining = $this->remaining($DTT_ID);
155
+		if ($num_remaining === 0) {
156 156
 			return FALSE;
157 157
 		}
158
-		if ( $num_remaining > 0 && $num_remaining < $this->min() ) {
158
+		if ($num_remaining > 0 && $num_remaining < $this->min()) {
159 159
 			return FALSE;
160 160
 		}
161 161
 		return TRUE;
@@ -169,25 +169,25 @@  discard block
 block discarded – undo
169 169
 	 *                     all related datetimes
170 170
 	 * @return int
171 171
 	 */
172
-	public function remaining( $DTT_ID = 0 ) {
172
+	public function remaining($DTT_ID = 0) {
173 173
 		// are we checking availability for a particular datetime ?
174
-		if ( $DTT_ID ) {
174
+		if ($DTT_ID) {
175 175
 			// get array with the one requested datetime
176
-			$datetimes = $this->get_many_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) );
176
+			$datetimes = $this->get_many_related('Datetime', array(array('DTT_ID' => $DTT_ID)));
177 177
 		} else {
178 178
 			// we need to check availability of ALL datetimes
179
-			$datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) );
179
+			$datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC')));
180 180
 		}
181 181
 		//		d( $datetimes );
182 182
 		// if datetime reg limit is not unlimited
183
-		if ( ! empty( $datetimes ) ) {
183
+		if ( ! empty($datetimes)) {
184 184
 			// although TKT_qty and $datetime->spaces_remaining() could both be EE_INF
185 185
 			// we only need to check for EE_INF explicitly if we want to optimize.
186 186
 			// because EE_INF - x = EE_INF; and min(x,EE_INF) = x;
187 187
 			$tickets_remaining = $this->qty() - $this->sold();
188
-			foreach ( $datetimes as $datetime ) {
189
-				if ( $datetime instanceof EE_Datetime ) {
190
-					$tickets_remaining = min( $tickets_remaining, $datetime->spaces_remaining() );
188
+			foreach ($datetimes as $datetime) {
189
+				if ($datetime instanceof EE_Datetime) {
190
+					$tickets_remaining = min($tickets_remaining, $datetime->spaces_remaining());
191 191
 				}
192 192
 			}
193 193
 			return $tickets_remaining;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * @return int
203 203
 	 */
204 204
 	function min() {
205
-		return $this->get( 'TKT_min' );
205
+		return $this->get('TKT_min');
206 206
 	}
207 207
 
208 208
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 * @return boolean
213 213
 	 */
214 214
 	public function is_expired() {
215
-		return ( $this->get_raw( 'TKT_end_date' ) < time() );
215
+		return ($this->get_raw('TKT_end_date') < time());
216 216
 	}
217 217
 
218 218
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * @return boolean
223 223
 	 */
224 224
 	public function is_pending() {
225
-		return ( $this->get_raw( 'TKT_start_date' ) > time() );
225
+		return ($this->get_raw('TKT_start_date') > time());
226 226
 	}
227 227
 
228 228
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @return boolean
233 233
 	 */
234 234
 	public function is_on_sale() {
235
-		return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() );
235
+		return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time());
236 236
 	}
237 237
 
238 238
 
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
 	 * @param string 	$conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
244 244
 	 * @return array
245 245
 	 */
246
-	public function date_range( $dt_frmt = '', $conjunction = ' - ' ) {
247
-		$first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : '';
248
-		$last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : '';
246
+	public function date_range($dt_frmt = '', $conjunction = ' - ') {
247
+		$first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : '';
248
+		$last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : '';
249 249
 
250
-		return $first_date && $last_date ? $first_date . $conjunction  . $last_date : '';
250
+		return $first_date && $last_date ? $first_date.$conjunction.$last_date : '';
251 251
 	}
252 252
 
253 253
 
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 	 * @return EE_Datetime
258 258
 	 */
259 259
 	public function first_datetime() {
260
-		$datetimes = $this->datetimes( array( 'limit' => 1 ) );
261
-		return reset( $datetimes );
260
+		$datetimes = $this->datetimes(array('limit' => 1));
261
+		return reset($datetimes);
262 262
 	}
263 263
 
264 264
 
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
 	 * @param array $query_params see EEM_Base::get_all()
270 270
 	 * @return EE_Datetime[]
271 271
 	 */
272
-	public function datetimes( $query_params = array() ) {
273
-		if ( ! isset( $query_params[ 'order_by' ] ) ) {
274
-			$query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC';
272
+	public function datetimes($query_params = array()) {
273
+		if ( ! isset($query_params['order_by'])) {
274
+			$query_params['order_by']['DTT_order'] = 'ASC';
275 275
 		}
276
-		return $this->get_many_related( 'Datetime', $query_params );
276
+		return $this->get_many_related('Datetime', $query_params);
277 277
 	}
278 278
 
279 279
 
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
 	 * @return EE_Datetime
284 284
 	 */
285 285
 	public function last_datetime() {
286
-		$datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) );
287
-		return end( $datetimes );
286
+		$datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC')));
287
+		return end($datetimes);
288 288
 	}
289 289
 
290 290
 
@@ -298,22 +298,22 @@  discard block
 block discarded – undo
298 298
 	 * @param  int    $dtt_id [optional] include the dtt_id with $what = 'datetime'.
299 299
 	 * @return mixed (array|int)          how many tickets have sold
300 300
 	 */
301
-	public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) {
301
+	public function tickets_sold($what = 'ticket', $dtt_id = NULL) {
302 302
 		$total = 0;
303 303
 		$tickets_sold = $this->_all_tickets_sold();
304
-		switch ( $what ) {
304
+		switch ($what) {
305 305
 			case 'ticket' :
306
-				return $tickets_sold[ 'ticket' ];
306
+				return $tickets_sold['ticket'];
307 307
 				break;
308 308
 			case 'datetime' :
309
-				if ( empty( $tickets_sold[ 'datetime' ] ) ) {
309
+				if (empty($tickets_sold['datetime'])) {
310 310
 					return $total;
311 311
 				}
312
-				if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) {
313
-					EE_Error::add_error( __( "You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
312
+				if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) {
313
+					EE_Error::add_error(__("You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
314 314
 					return $total;
315 315
 				}
316
-				return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ];
316
+				return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id];
317 317
 				break;
318 318
 			default:
319 319
 				return $total;
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
 	 * @return EE_Ticket[]
328 328
 	 */
329 329
 	protected function _all_tickets_sold() {
330
-		$datetimes = $this->get_many_related( 'Datetime' );
330
+		$datetimes = $this->get_many_related('Datetime');
331 331
 		$tickets_sold = array();
332
-		if ( ! empty( $datetimes ) ) {
333
-			foreach ( $datetimes as $datetime ) {
334
-				$tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' );
332
+		if ( ! empty($datetimes)) {
333
+			foreach ($datetimes as $datetime) {
334
+				$tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold');
335 335
 			}
336 336
 		}
337 337
 		//Tickets sold
338
-		$tickets_sold[ 'ticket' ] = $this->sold();
338
+		$tickets_sold['ticket'] = $this->sold();
339 339
 		return $tickets_sold;
340 340
 	}
341 341
 
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 	 * @param  bool $return_array whether to return as an array indexed by price id or just the object.
349 349
 	 * @return EE_Price
350 350
 	 */
351
-	public function base_price( $return_array = FALSE ) {
352
-		$_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price );
353
-		return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) );
351
+	public function base_price($return_array = FALSE) {
352
+		$_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price);
353
+		return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where));
354 354
 	}
355 355
 
356 356
 
@@ -362,8 +362,8 @@  discard block
 block discarded – undo
362 362
 	 * @return EE_Price[]
363 363
 	 */
364 364
 	public function price_modifiers() {
365
-		$query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) );
366
-		return $this->prices( $query_params );
365
+		$query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax))));
366
+		return $this->prices($query_params);
367 367
 	}
368 368
 
369 369
 
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
 	 * @param array $query_params like EEM_Base::get_all
374 374
 	 * @return EE_Price[]
375 375
 	 */
376
-	public function prices( $query_params = array() ) {
377
-		return $this->get_many_related( 'Price', $query_params );
376
+	public function prices($query_params = array()) {
377
+		return $this->get_many_related('Price', $query_params);
378 378
 	}
379 379
 
380 380
 
@@ -384,8 +384,8 @@  discard block
 block discarded – undo
384 384
 	 * @param array $query_params see EEM_Base::get_all()
385 385
 	 * @return EE_Datetime_Ticket
386 386
 	 */
387
-	public function datetime_tickets( $query_params = array() ) {
388
-		return $this->get_many_related( 'Datetime_Ticket', $query_params );
387
+	public function datetime_tickets($query_params = array()) {
388
+		return $this->get_many_related('Datetime_Ticket', $query_params);
389 389
 	}
390 390
 
391 391
 
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
 	 * @param boolean $show_deleted
397 397
 	 * @return EE_Datetime[]
398 398
 	 */
399
-	public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) {
400
-		return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted );
399
+	public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) {
400
+		return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted);
401 401
 	}
402 402
 
403 403
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	 * @return string
408 408
 	 */
409 409
 	function ID() {
410
-		return $this->get( 'TKT_ID' );
410
+		return $this->get('TKT_ID');
411 411
 	}
412 412
 
413 413
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	 * @return EE_Ticket_Template
432 432
 	 */
433 433
 	public function template() {
434
-		return $this->get_first_related( 'Ticket_Template' );
434
+		return $this->get_first_related('Ticket_Template');
435 435
 	}
436 436
 
437 437
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 	 * @return bool
451 451
 	 */
452 452
 	public function ticket_price() {
453
-		return $this->get( 'TKT_price' );
453
+		return $this->get('TKT_price');
454 454
 	}
455 455
 
456 456
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	 * @return mixed
460 460
 	 */
461 461
 	public function pretty_price() {
462
-		return $this->get_pretty( 'TKT_price' );
462
+		return $this->get_pretty('TKT_price');
463 463
 	}
464 464
 
465 465
 
@@ -478,17 +478,17 @@  discard block
 block discarded – undo
478 478
 	 * @param bool $no_cache
479 479
 	 * @return float
480 480
 	 */
481
-	public function get_ticket_total_with_taxes( $no_cache = FALSE ) {
482
-		if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) {
481
+	public function get_ticket_total_with_taxes($no_cache = FALSE) {
482
+		if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) {
483 483
 			$this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin();
484 484
 		}
485
-		return (float)$this->_ticket_total_with_taxes;
485
+		return (float) $this->_ticket_total_with_taxes;
486 486
 	}
487 487
 
488 488
 
489 489
 
490 490
 	public function ensure_TKT_Price_correct() {
491
-		$this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) );
491
+		$this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this));
492 492
 		$this->save();
493 493
 	}
494 494
 
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 	 * @return float
499 499
 	 */
500 500
 	public function get_ticket_subtotal() {
501
-		return EE_Taxes::get_subtotal_for_admin( $this );
501
+		return EE_Taxes::get_subtotal_for_admin($this);
502 502
 	}
503 503
 
504 504
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	 * @return float
509 509
 	 */
510 510
 	public function get_ticket_taxes_total_for_admin() {
511
-		return EE_Taxes::get_total_taxes_for_admin( $this );
511
+		return EE_Taxes::get_total_taxes_for_admin($this);
512 512
 	}
513 513
 
514 514
 
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
 	 * @param string $name
519 519
 	 * @return boolean
520 520
 	 */
521
-	function set_name( $name ) {
522
-		$this->set( 'TKT_name', $name );
521
+	function set_name($name) {
522
+		$this->set('TKT_name', $name);
523 523
 	}
524 524
 
525 525
 
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 	 * @return string
530 530
 	 */
531 531
 	function description() {
532
-		return $this->get( 'TKT_description' );
532
+		return $this->get('TKT_description');
533 533
 	}
534 534
 
535 535
 
@@ -539,8 +539,8 @@  discard block
 block discarded – undo
539 539
 	 * @param string $description
540 540
 	 * @return boolean
541 541
 	 */
542
-	function set_description( $description ) {
543
-		$this->set( 'TKT_description', $description );
542
+	function set_description($description) {
543
+		$this->set('TKT_description', $description);
544 544
 	}
545 545
 
546 546
 
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
 	 * @param string $tm_frmt
552 552
 	 * @return string
553 553
 	 */
554
-	function start_date( $dt_frmt = '', $tm_frmt = '' ) {
555
-		return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt );
554
+	function start_date($dt_frmt = '', $tm_frmt = '') {
555
+		return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt);
556 556
 	}
557 557
 
558 558
 
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 	 * @param string $start_date
563 563
 	 * @return void
564 564
 	 */
565
-	function set_start_date( $start_date ) {
566
-		$this->_set_date_time( 'B', $start_date, 'TKT_start_date' );
565
+	function set_start_date($start_date) {
566
+		$this->_set_date_time('B', $start_date, 'TKT_start_date');
567 567
 	}
568 568
 
569 569
 
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
 	 * @param string $tm_frmt
575 575
 	 * @return string
576 576
 	 */
577
-	function end_date( $dt_frmt = '', $tm_frmt = '' ) {
578
-		return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt );
577
+	function end_date($dt_frmt = '', $tm_frmt = '') {
578
+		return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt);
579 579
 	}
580 580
 
581 581
 
@@ -585,8 +585,8 @@  discard block
 block discarded – undo
585 585
 	 * @param string $end_date
586 586
 	 * @return void
587 587
 	 */
588
-	function set_end_date( $end_date ) {
589
-		$this->_set_date_time( 'B', $end_date, 'TKT_end_date' );
588
+	function set_end_date($end_date) {
589
+		$this->_set_date_time('B', $end_date, 'TKT_end_date');
590 590
 	}
591 591
 
592 592
 
@@ -598,8 +598,8 @@  discard block
 block discarded – undo
598 598
 	 *
599 599
 	 * @param string $time a string representation of the sell until time (ex 9am or 7:30pm)
600 600
 	 */
601
-	function set_end_time( $time ) {
602
-		$this->_set_time_for( $time, 'TKT_end_date' );
601
+	function set_end_time($time) {
602
+		$this->_set_time_for($time, 'TKT_end_date');
603 603
 	}
604 604
 
605 605
 
@@ -609,8 +609,8 @@  discard block
 block discarded – undo
609 609
 	 * @param int $min
610 610
 	 * @return boolean
611 611
 	 */
612
-	function set_min( $min ) {
613
-		$this->set( 'TKT_min', $min );
612
+	function set_min($min) {
613
+		$this->set('TKT_min', $min);
614 614
 	}
615 615
 
616 616
 
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 	 * @return int
621 621
 	 */
622 622
 	function max() {
623
-		return $this->get( 'TKT_max' );
623
+		return $this->get('TKT_max');
624 624
 	}
625 625
 
626 626
 
@@ -630,8 +630,8 @@  discard block
 block discarded – undo
630 630
 	 * @param int $max
631 631
 	 * @return boolean
632 632
 	 */
633
-	function set_max( $max ) {
634
-		$this->set( 'TKT_max', $max );
633
+	function set_max($max) {
634
+		$this->set('TKT_max', $max);
635 635
 	}
636 636
 
637 637
 
@@ -641,8 +641,8 @@  discard block
 block discarded – undo
641 641
 	 * @param float $price
642 642
 	 * @return boolean
643 643
 	 */
644
-	function set_price( $price ) {
645
-		$this->set( 'TKT_price', $price );
644
+	function set_price($price) {
645
+		$this->set('TKT_price', $price);
646 646
 	}
647 647
 
648 648
 
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 	 * @return int
653 653
 	 */
654 654
 	function sold() {
655
-		return $this->get_raw( 'TKT_sold' );
655
+		return $this->get_raw('TKT_sold');
656 656
 	}
657 657
 
658 658
 
@@ -662,10 +662,10 @@  discard block
 block discarded – undo
662 662
 	 * @param int $qty
663 663
 	 * @return boolean
664 664
 	 */
665
-	function increase_sold( $qty = 1 ) {
665
+	function increase_sold($qty = 1) {
666 666
 		$sold = $this->sold() + $qty;
667
-		$this->_increase_sold_for_datetimes( $qty );
668
-		return $this->set_sold( $sold );
667
+		$this->_increase_sold_for_datetimes($qty);
668
+		return $this->set_sold($sold);
669 669
 	}
670 670
 
671 671
 
@@ -675,12 +675,12 @@  discard block
 block discarded – undo
675 675
 	 * @param int $qty
676 676
 	 * @return boolean
677 677
 	 */
678
-	protected function _increase_sold_for_datetimes( $qty = 1 ) {
678
+	protected function _increase_sold_for_datetimes($qty = 1) {
679 679
 		$datetimes = $this->datetimes();
680
-		if ( is_array( $datetimes ) ) {
681
-			foreach ( $datetimes as $datetime ) {
682
-				if ( $datetime instanceof EE_Datetime ) {
683
-					$datetime->increase_sold( $qty );
680
+		if (is_array($datetimes)) {
681
+			foreach ($datetimes as $datetime) {
682
+				if ($datetime instanceof EE_Datetime) {
683
+					$datetime->increase_sold($qty);
684 684
 					$datetime->save();
685 685
 				}
686 686
 			}
@@ -694,10 +694,10 @@  discard block
 block discarded – undo
694 694
 	 * @param int $sold
695 695
 	 * @return boolean
696 696
 	 */
697
-	function set_sold( $sold ) {
697
+	function set_sold($sold) {
698 698
 		// sold can not go below zero
699
-		$sold = max( 0, $sold );
700
-		$this->set( 'TKT_sold', $sold );
699
+		$sold = max(0, $sold);
700
+		$this->set('TKT_sold', $sold);
701 701
 	}
702 702
 
703 703
 
@@ -707,10 +707,10 @@  discard block
 block discarded – undo
707 707
 	 * @param int $qty
708 708
 	 * @return boolean
709 709
 	 */
710
-	function decrease_sold( $qty = 1 ) {
710
+	function decrease_sold($qty = 1) {
711 711
 		$sold = $this->sold() - $qty;
712
-		$this->_decrease_sold_for_datetimes( $qty );
713
-		return $this->set_sold( $sold );
712
+		$this->_decrease_sold_for_datetimes($qty);
713
+		return $this->set_sold($sold);
714 714
 	}
715 715
 
716 716
 
@@ -721,12 +721,12 @@  discard block
 block discarded – undo
721 721
 	* @param int $qty
722 722
 	* @return boolean
723 723
 	*/
724
-	protected function _decrease_sold_for_datetimes( $qty = 1 ) {
724
+	protected function _decrease_sold_for_datetimes($qty = 1) {
725 725
 		$datetimes = $this->datetimes();
726
-		if ( is_array( $datetimes ) ) {
727
-			foreach ( $datetimes as $datetime ) {
728
-				if ( $datetime instanceof EE_Datetime ) {
729
-					$datetime->decrease_sold( $qty );
726
+		if (is_array($datetimes)) {
727
+			foreach ($datetimes as $datetime) {
728
+				if ($datetime instanceof EE_Datetime) {
729
+					$datetime->decrease_sold($qty);
730 730
 					$datetime->save();
731 731
 				}
732 732
 			}
@@ -747,14 +747,14 @@  discard block
 block discarded – undo
747 747
 	 *
748 748
 	 * @return int
749 749
 	 */
750
-	function qty( $context = '' ) {
751
-		switch ( $context ) {
750
+	function qty($context = '') {
751
+		switch ($context) {
752 752
 			case 'reg_limit' :
753 753
 				return $this->real_quantity_on_ticket();
754 754
 			case 'saleable' :
755
-				return $this->real_quantity_on_ticket( 'saleable' );
755
+				return $this->real_quantity_on_ticket('saleable');
756 756
 			default:
757
-				return $this->get_raw( 'TKT_qty' );
757
+				return $this->get_raw('TKT_qty');
758 758
 		}
759 759
 	}
760 760
 
@@ -771,38 +771,38 @@  discard block
 block discarded – undo
771 771
 	 *
772 772
 	 * @return int
773 773
 	 */
774
-	function real_quantity_on_ticket( $context = 'reg_limit' ) {
774
+	function real_quantity_on_ticket($context = 'reg_limit') {
775 775
 		// start with the original db value for ticket quantity
776
-		$raw = $this->get_raw( 'TKT_qty' );
776
+		$raw = $this->get_raw('TKT_qty');
777 777
 		// return immediately if it's zero
778
-		if ( $raw === 0 ) {
778
+		if ($raw === 0) {
779 779
 			return $raw;
780 780
 		}
781 781
 		// ensure qty doesn't exceed raw value for THIS ticket
782
-		$qty = min( EE_INF, $raw );
782
+		$qty = min(EE_INF, $raw);
783 783
 		// NOW that we know the  maximum number of tickets available for the ticket
784 784
 		// we need to calculate the maximum number of tickets available for the datetime
785 785
 		// without really factoring this ticket into the calculations
786 786
 		$datetimes = $this->datetimes();
787
-		foreach ( $datetimes as $datetime ) {
788
-			if ( $datetime instanceof EE_Datetime ) {
787
+		foreach ($datetimes as $datetime) {
788
+			if ($datetime instanceof EE_Datetime) {
789 789
 				// initialize with no restrictions for each datetime
790 790
 				// but adjust datetime qty based on datetime reg limit
791
-				$datetime_qty = min( EE_INF, $datetime->reg_limit() );
791
+				$datetime_qty = min(EE_INF, $datetime->reg_limit());
792 792
 				// if we want the actual saleable amount, then we need to consider OTHER ticket sales
793 793
 				// for this datetime, that do NOT include sales for this ticket (so we add THIS ticket's sales back in)
794
-				if ( $context == 'saleable' ) {
795
-					$datetime_qty = max( $datetime_qty - $datetime->sold() + $this->sold(), 0 );
794
+				if ($context == 'saleable') {
795
+					$datetime_qty = max($datetime_qty - $datetime->sold() + $this->sold(), 0);
796 796
 					$datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0;
797 797
 				}
798
-				$qty = min( $datetime_qty, $qty );
798
+				$qty = min($datetime_qty, $qty);
799 799
 			}
800 800
 
801 801
 		}
802 802
 		// we need to factor in the details for this specific ticket
803
-		if ( $qty > 0 && $context == 'saleable' ) {
803
+		if ($qty > 0 && $context == 'saleable') {
804 804
 			// and subtract the sales for THIS ticket
805
-			$qty = max( $qty - $this->sold(), 0 );
805
+			$qty = max($qty - $this->sold(), 0);
806 806
 			//echo '&nbsp; $qty: ' . $qty . "<br />";
807 807
 		}
808 808
 		//echo '$qty: ' . $qty . "<br />";
@@ -818,14 +818,14 @@  discard block
 block discarded – undo
818 818
 	 * @return bool
819 819
 	 * @throws \EE_Error
820 820
 	 */
821
-	function set_qty( $qty ) {
821
+	function set_qty($qty) {
822 822
 		$datetimes = $this->datetimes();
823
-		foreach ( $datetimes as $datetime ) {
824
-			if ( $datetime instanceof EE_Datetime ) {
825
-				$qty = min( $qty, $datetime->reg_limit() );
823
+		foreach ($datetimes as $datetime) {
824
+			if ($datetime instanceof EE_Datetime) {
825
+				$qty = min($qty, $datetime->reg_limit());
826 826
 			}
827 827
 		}
828
-		$this->set( 'TKT_qty', $qty );
828
+		$this->set('TKT_qty', $qty);
829 829
 	}
830 830
 
831 831
 
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 	 * @return int
836 836
 	 */
837 837
 	function uses() {
838
-		return $this->get( 'TKT_uses' );
838
+		return $this->get('TKT_uses');
839 839
 	}
840 840
 
841 841
 
@@ -845,8 +845,8 @@  discard block
 block discarded – undo
845 845
 	 * @param int $uses
846 846
 	 * @return boolean
847 847
 	 */
848
-	function set_uses( $uses ) {
849
-		$this->set( 'TKT_uses', $uses );
848
+	function set_uses($uses) {
849
+		$this->set('TKT_uses', $uses);
850 850
 	}
851 851
 
852 852
 
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 	 * @return boolean
857 857
 	 */
858 858
 	public function required() {
859
-		return $this->get( 'TKT_required' );
859
+		return $this->get('TKT_required');
860 860
 	}
861 861
 
862 862
 
@@ -866,8 +866,8 @@  discard block
 block discarded – undo
866 866
 	 * @param boolean $required
867 867
 	 * @return boolean
868 868
 	 */
869
-	public function set_required( $required ) {
870
-		$this->set( 'TKT_required', $required );
869
+	public function set_required($required) {
870
+		$this->set('TKT_required', $required);
871 871
 	}
872 872
 
873 873
 
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
 	 * @return boolean
878 878
 	 */
879 879
 	function taxable() {
880
-		return $this->get( 'TKT_taxable' );
880
+		return $this->get('TKT_taxable');
881 881
 	}
882 882
 
883 883
 
@@ -887,8 +887,8 @@  discard block
 block discarded – undo
887 887
 	 * @param boolean $taxable
888 888
 	 * @return boolean
889 889
 	 */
890
-	function set_taxable( $taxable ) {
891
-		$this->set( 'TKT_taxable', $taxable );
890
+	function set_taxable($taxable) {
891
+		$this->set('TKT_taxable', $taxable);
892 892
 	}
893 893
 
894 894
 
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
 	 * @return boolean
899 899
 	 */
900 900
 	function is_default() {
901
-		return $this->get( 'TKT_is_default' );
901
+		return $this->get('TKT_is_default');
902 902
 	}
903 903
 
904 904
 
@@ -908,8 +908,8 @@  discard block
 block discarded – undo
908 908
 	 * @param boolean $is_default
909 909
 	 * @return boolean
910 910
 	 */
911
-	function set_is_default( $is_default ) {
912
-		$this->set( 'TKT_is_default', $is_default );
911
+	function set_is_default($is_default) {
912
+		$this->set('TKT_is_default', $is_default);
913 913
 	}
914 914
 
915 915
 
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 	 * @return int
920 920
 	 */
921 921
 	function order() {
922
-		return $this->get( 'TKT_order' );
922
+		return $this->get('TKT_order');
923 923
 	}
924 924
 
925 925
 
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
 	 * @param int $order
930 930
 	 * @return boolean
931 931
 	 */
932
-	function set_order( $order ) {
933
-		$this->set( 'TKT_order', $order );
932
+	function set_order($order) {
933
+		$this->set('TKT_order', $order);
934 934
 	}
935 935
 
936 936
 
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 	 * @return int
941 941
 	 */
942 942
 	function row() {
943
-		return $this->get( 'TKT_row' );
943
+		return $this->get('TKT_row');
944 944
 	}
945 945
 
946 946
 
@@ -950,8 +950,8 @@  discard block
 block discarded – undo
950 950
 	 * @param int $row
951 951
 	 * @return boolean
952 952
 	 */
953
-	function set_row( $row ) {
954
-		$this->set( 'TKT_row', $row );
953
+	function set_row($row) {
954
+		$this->set('TKT_row', $row);
955 955
 	}
956 956
 
957 957
 
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 	 * @return boolean
962 962
 	 */
963 963
 	function deleted() {
964
-		return $this->get( 'TKT_deleted' );
964
+		return $this->get('TKT_deleted');
965 965
 	}
966 966
 
967 967
 
@@ -971,8 +971,8 @@  discard block
 block discarded – undo
971 971
 	 * @param boolean $deleted
972 972
 	 * @return boolean
973 973
 	 */
974
-	function set_deleted( $deleted ) {
975
-		$this->set( 'TKT_deleted', $deleted );
974
+	function set_deleted($deleted) {
975
+		$this->set('TKT_deleted', $deleted);
976 976
 	}
977 977
 
978 978
 
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
 	 * @return int
983 983
 	 */
984 984
 	function parent_ID() {
985
-		return $this->get( 'TKT_parent' );
985
+		return $this->get('TKT_parent');
986 986
 	}
987 987
 
988 988
 
@@ -992,8 +992,8 @@  discard block
 block discarded – undo
992 992
 	 * @param int $parent
993 993
 	 * @return boolean
994 994
 	 */
995
-	function set_parent_ID( $parent ) {
996
-		$this->set( 'TKT_parent', $parent );
995
+	function set_parent_ID($parent) {
996
+		$this->set('TKT_parent', $parent);
997 997
 	}
998 998
 
999 999
 
@@ -1004,10 +1004,10 @@  discard block
 block discarded – undo
1004 1004
 	 */
1005 1005
 	function name_and_info() {
1006 1006
 		$times = array();
1007
-		foreach ( $this->datetimes() as $datetime ) {
1007
+		foreach ($this->datetimes() as $datetime) {
1008 1008
 			$times[] = $datetime->start_date_and_time();
1009 1009
 		}
1010
-		return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->pretty_price();
1010
+		return $this->name()." @ ".implode(", ", $times)." for ".$this->pretty_price();
1011 1011
 	}
1012 1012
 
1013 1013
 
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 	 * @return string
1018 1018
 	 */
1019 1019
 	function name() {
1020
-		return $this->get( 'TKT_name' );
1020
+		return $this->get('TKT_name');
1021 1021
 	}
1022 1022
 
1023 1023
 
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 	 * @return float
1028 1028
 	 */
1029 1029
 	function price() {
1030
-		return $this->get( 'TKT_price' );
1030
+		return $this->get('TKT_price');
1031 1031
 	}
1032 1032
 
1033 1033
 
@@ -1037,8 +1037,8 @@  discard block
 block discarded – undo
1037 1037
 	 * @param array $query_params like EEM_Base::get_all's
1038 1038
 	 * @return EE_Registration[]
1039 1039
 	 */
1040
-	public function registrations( $query_params = array() ) {
1041
-		return $this->get_many_related( 'Registration', $query_params );
1040
+	public function registrations($query_params = array()) {
1041
+		return $this->get_many_related('Registration', $query_params);
1042 1042
 	}
1043 1043
 
1044 1044
 
@@ -1049,8 +1049,8 @@  discard block
 block discarded – undo
1049 1049
 	 * @return int
1050 1050
 	 */
1051 1051
 	public function update_tickets_sold() {
1052
-		$count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) );
1053
-		$this->set_sold( $count_regs_for_this_ticket );
1052
+		$count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0)));
1053
+		$this->set_sold($count_regs_for_this_ticket);
1054 1054
 		$this->save();
1055 1055
 		return $count_regs_for_this_ticket;
1056 1056
 	}
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
 	 * @param array $query_params like EEM_Base::get_all's
1063 1063
 	 * @return int
1064 1064
 	 */
1065
-	public function count_registrations( $query_params = array() ) {
1065
+	public function count_registrations($query_params = array()) {
1066 1066
 		return $this->count_related('Registration', $query_params);
1067 1067
 	}
1068 1068
 
@@ -1087,23 +1087,23 @@  discard block
 block discarded – undo
1087 1087
 	public function get_related_event() {
1088 1088
 		//get one datetime to use for getting the event
1089 1089
 		$datetime = $this->first_datetime();
1090
-		if ( ! $datetime instanceof \EE_Datetime ) {
1090
+		if ( ! $datetime instanceof \EE_Datetime) {
1091 1091
 			throw new UnexpectedEntityException(
1092 1092
 				$datetime,
1093 1093
 				'EE_Datetime',
1094 1094
 				sprintf(
1095
-					__( "The ticket (%s) is not associated with any valid datetimes.", "event_espresso" ),
1095
+					__("The ticket (%s) is not associated with any valid datetimes.", "event_espresso"),
1096 1096
 					$datetime->name()
1097 1097
 				)
1098 1098
 			);
1099 1099
 		}
1100 1100
 		$event = $datetime->event();
1101
-		if ( ! $event instanceof \EE_Event ) {
1101
+		if ( ! $event instanceof \EE_Event) {
1102 1102
 			throw new UnexpectedEntityException(
1103 1103
 				$event,
1104 1104
 				'EE_Event',
1105 1105
 				sprintf(
1106
-					__( "The ticket (%s) is not associated with a valid event.", "event_espresso" ),
1106
+					__("The ticket (%s) is not associated with a valid event.", "event_espresso"),
1107 1107
 					$this->name()
1108 1108
 				)
1109 1109
 			);
Please login to merge, or discard this patch.
templates/reg_admin_details_main_meta_box_attendees.template.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -3,35 +3,35 @@
 block discarded – undo
3 3
 	<br/>
4 4
 <?php //echo EEH_Debug_Tools::printr( $event_attendees, 'event_attendees' ); ?>
5 5
 <?php echo $attendee_notice; ?>
6
-<?php if ( !empty($attendees) ) : ?>
6
+<?php if ( ! empty($attendees)) : ?>
7 7
 	<div class="admin-primary-mbox-tbl-wrap">
8 8
 		<table class="admin-primary-mbox-tbl">
9 9
 			<thead>
10 10
 				<tr>
11
-					<th class="jst-left"><?php _e( '#', 'event_espresso' );?></th>
12
-					<th class="jst-left"><?php _e( 'Event Name', 'event_espresso' );?></th>
13
-					<th class="jst-left"><?php _e( 'Attendee', 'event_espresso' );?></th>
14
-					<th class="jst-rght"><?php _e( 'Price Paid', 'event_espresso' );?></th>
15
-					<th class="jst-left"><?php _e( 'Email', 'event_espresso' );?></th>
16
-					<th class="jst-left"><?php _e( 'Address', 'event_espresso' );?></th>
17
-					<!--<th class="jst-cntr"><?php _e( 'Actions', 'event_espresso' );?></th>-->
11
+					<th class="jst-left"><?php _e('#', 'event_espresso'); ?></th>
12
+					<th class="jst-left"><?php _e('Event Name', 'event_espresso'); ?></th>
13
+					<th class="jst-left"><?php _e('Attendee', 'event_espresso'); ?></th>
14
+					<th class="jst-rght"><?php _e('Price Paid', 'event_espresso'); ?></th>
15
+					<th class="jst-left"><?php _e('Email', 'event_espresso'); ?></th>
16
+					<th class="jst-left"><?php _e('Address', 'event_espresso'); ?></th>
17
+					<!--<th class="jst-cntr"><?php _e('Actions', 'event_espresso'); ?></th>-->
18 18
 				</tr>
19 19
 			</thead>
20 20
 			<tbody>
21 21
 
22
-			<?php foreach ( $attendees as $att_nmbr => $attendee ) : ?>
22
+			<?php foreach ($attendees as $att_nmbr => $attendee) : ?>
23 23
 
24 24
 				<tr>
25
-					<td class="jst-left"><?php echo $att_nmbr;?></td>
26
-					<td class="jst-left"><?php echo $attendee['event_name'];?></td>
25
+					<td class="jst-left"><?php echo $att_nmbr; ?></td>
26
+					<td class="jst-left"><?php echo $attendee['event_name']; ?></td>
27 27
 					<td class="jst-left">
28
-						<a href="<?php echo $attendee['att_link']; ?>" title="<?php esc_attr_e( 'View details for this attendee', 'event_espresso' );?>">
29
-							<?php echo $attendee['fname'] . ' ' . $attendee['lname'];?>
28
+						<a href="<?php echo $attendee['att_link']; ?>" title="<?php esc_attr_e('View details for this attendee', 'event_espresso'); ?>">
29
+							<?php echo $attendee['fname'].' '.$attendee['lname']; ?>
30 30
 						</a>
31 31
 					</td>
32
-					<td class="jst-rght"><?php echo $currency_sign . ' ' . number_format( $attendee['final_price'], 2 );?></td>
33
-					<td class="jst-left"><?php echo $attendee['email'];?></td>
34
-					<td class="jst-left"><?php echo $attendee['address'];?></td>
32
+					<td class="jst-rght"><?php echo $currency_sign.' '.number_format($attendee['final_price'], 2); ?></td>
33
+					<td class="jst-left"><?php echo $attendee['email']; ?></td>
34
+					<td class="jst-left"><?php echo $attendee['address']; ?></td>
35 35
 					<!--<th class="jst-cntr">view</th>-->
36 36
 				</tr>
37 37
 
Please login to merge, or discard this patch.
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   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -467,38 +467,38 @@  discard block
 block discarded – undo
467 467
 	 * @throws \EE_Error
468 468
 	 */
469 469
 	public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) {
470
-        // registrations per event
470
+		// registrations per event
471 471
 		$event_reg_count = array();
472 472
 		// spaces left per event
473 473
 		$event_spaces_remaining = array();
474
-        // tickets left sorted by ID
475
-        $tickets_remaining = array();
476
-        // registrations that have lost their space
474
+		// tickets left sorted by ID
475
+		$tickets_remaining = array();
476
+		// registrations that have lost their space
477 477
 		$ejected_registrations = array();
478 478
 		foreach ( $registrations as $REG_ID => $registration ) {
479 479
 			if ( $registration->status_ID() === EEM_Registration::status_id_approved ) {
480 480
 				continue;
481 481
 			}
482 482
 			$EVT_ID = $registration->event_ID();
483
-            $ticket = $registration->ticket();
484
-            if ( ! isset($tickets_remaining[$ticket->ID()])) {
485
-                $tickets_remaining[$ticket->ID()] = $ticket->remaining();
486
-            }
487
-            if ($tickets_remaining[$ticket->ID()] > 0) {
488
-                if ( ! isset($event_reg_count[$EVT_ID])) {
489
-                    $event_reg_count[$EVT_ID] = 0;
490
-                }
491
-                $event_reg_count[$EVT_ID]++;
492
-                if ( ! isset($event_spaces_remaining[$EVT_ID])) {
493
-                    $event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale();
494
-                }
495
-            }
483
+			$ticket = $registration->ticket();
484
+			if ( ! isset($tickets_remaining[$ticket->ID()])) {
485
+				$tickets_remaining[$ticket->ID()] = $ticket->remaining();
486
+			}
487
+			if ($tickets_remaining[$ticket->ID()] > 0) {
488
+				if ( ! isset($event_reg_count[$EVT_ID])) {
489
+					$event_reg_count[$EVT_ID] = 0;
490
+				}
491
+				$event_reg_count[$EVT_ID]++;
492
+				if ( ! isset($event_spaces_remaining[$EVT_ID])) {
493
+					$event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale();
494
+				}
495
+			}
496 496
 			if (
497 497
 				$revisit
498 498
 				&& (
499
-                    $tickets_remaining[$ticket->ID()] === 0
500
-				    || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
501
-                )
499
+					$tickets_remaining[$ticket->ID()] === 0
500
+					|| $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
501
+				)
502 502
 			) {
503 503
 				$ejected_registrations[ $REG_ID ] = $registration->event();
504 504
 				if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) {
@@ -573,9 +573,9 @@  discard block
 block discarded – undo
573 573
 				'layout_strategy' => new EE_Template_Layout(
574 574
 					array(
575 575
 						'layout_template_file' => SPCO_REG_STEPS_PATH
576
-						                          . $this->_slug
577
-						                          . DS
578
-						                          . 'sold_out_events.template.php',
576
+												  . $this->_slug
577
+												  . DS
578
+												  . 'sold_out_events.template.php',
579 579
 						'template_args'        => apply_filters(
580 580
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
581 581
 							array(
@@ -626,9 +626,9 @@  discard block
 block discarded – undo
626 626
 				'layout_strategy' => new EE_Template_Layout(
627 627
 					array(
628 628
 						'layout_template_file' => SPCO_REG_STEPS_PATH
629
-						                          . $this->_slug
630
-						                          . DS
631
-						                          . 'sold_out_events.template.php',
629
+												  . $this->_slug
630
+												  . DS
631
+												  . 'sold_out_events.template.php',
632 632
 						'template_args'        => apply_filters(
633 633
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___insufficient_spaces_available__template_args',
634 634
 							array(
@@ -680,9 +680,9 @@  discard block
 block discarded – undo
680 680
 				'layout_strategy' => new EE_Template_Layout(
681 681
 					array(
682 682
 						'layout_template_file' => SPCO_REG_STEPS_PATH
683
-						                          . $this->_slug
684
-						                          . DS
685
-						                          . 'events_requiring_pre_approval.template.php', // layout_template
683
+												  . $this->_slug
684
+												  . DS
685
+												  . 'events_requiring_pre_approval.template.php', // layout_template
686 686
 						'template_args'        => apply_filters(
687 687
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
688 688
 							array(
@@ -724,9 +724,9 @@  discard block
 block discarded – undo
724 724
 				'layout_strategy' => new EE_Template_Layout(
725 725
 					array(
726 726
 						'layout_template_file' => SPCO_REG_STEPS_PATH
727
-						                          . $this->_slug
728
-						                          . DS
729
-						                          . 'no_payment_required.template.php', // layout_template
727
+												  . $this->_slug
728
+												  . DS
729
+												  . 'no_payment_required.template.php', // layout_template
730 730
 						'template_args'        => apply_filters(
731 731
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
732 732
 							array(
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 					$available_payment_method_options[ $payment_method->slug() ] = $payment_method_button;
957 957
 				}
958 958
 				$payment_methods_billing_info[ $payment_method->slug()
959
-				                               . '-info' ] = $this->_payment_method_billing_info(
959
+											   . '-info' ] = $this->_payment_method_billing_info(
960 960
 					$payment_method
961 961
 				);
962 962
 			}
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 		// fill form with attendee info if applicable
1145 1145
 		if (
1146 1146
 			$payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form
1147
-		    && $this->checkout->transaction_has_primary_registrant()
1147
+			&& $this->checkout->transaction_has_primary_registrant()
1148 1148
 		) {
1149 1149
 			$payment_method_billing_form->populate_from_attendee(
1150 1150
 				$this->checkout->transaction->primary_registration()->attendee()
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 		// and debug content
1154 1154
 		if (
1155 1155
 			$payment_method_billing_form instanceof EE_Billing_Info_Form
1156
-		    && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1156
+			&& $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1157 1157
 		) {
1158 1158
 			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
1159 1159
 				$payment_method_billing_form
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 		}
1313 1313
 		// fill form with attendee info if applicable
1314 1314
 		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form
1315
-		     && $this->checkout->transaction_has_primary_registrant()
1315
+			 && $this->checkout->transaction_has_primary_registrant()
1316 1316
 		) {
1317 1317
 			$this->checkout->billing_form->populate_from_attendee(
1318 1318
 				$this->checkout->transaction->primary_registration()->attendee()
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
 		}
1321 1321
 		// and debug content
1322 1322
 		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form
1323
-		     && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1323
+			 && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1324 1324
 		) {
1325 1325
 			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
1326 1326
 				$this->checkout->billing_form
@@ -1454,8 +1454,8 @@  discard block
 block discarded – undo
1454 1454
 		}
1455 1455
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1456 1456
 		if ( ! empty( $attendee_data['ATT_fname'] )
1457
-		     && ! empty( $attendee_data['ATT_lname'] )
1458
-		     && ! empty( $attendee_data['ATT_email'] )
1457
+			 && ! empty( $attendee_data['ATT_lname'] )
1458
+			 && ! empty( $attendee_data['ATT_email'] )
1459 1459
 		) {
1460 1460
 			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(
1461 1461
 				array(
@@ -1697,7 +1697,7 @@  discard block
 block discarded – undo
1697 1697
 			$payment_status = $payment->status();
1698 1698
 			if (
1699 1699
 				$payment_status === EEM_Payment::status_id_approved
1700
-			    || $payment_status === EEM_Payment::status_id_pending
1700
+				|| $payment_status === EEM_Payment::status_id_pending
1701 1701
 			) {
1702 1702
 				return true;
1703 1703
 			} else {
@@ -1885,8 +1885,8 @@  discard block
 block discarded – undo
1885 1885
 			return false;
1886 1886
 		}
1887 1887
 		if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' )
1888
-		       instanceof
1889
-		       EE_Attendee
1888
+			   instanceof
1889
+			   EE_Attendee
1890 1890
 		) {
1891 1891
 			EE_Error::add_error(
1892 1892
 				sprintf(
Please login to merge, or discard this patch.
Spacing   +354 added lines, -354 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
 
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 	 * @param    EE_Checkout $checkout
128 128
 	 * @return    \EE_SPCO_Reg_Step_Payment_Options
129 129
 	 */
130
-	public function __construct( EE_Checkout $checkout ) {
130
+	public function __construct(EE_Checkout $checkout) {
131 131
 		$this->_slug = 'payment_options';
132
-		$this->_name = __( 'Payment Options', 'event_espresso' );
133
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
132
+		$this->_name = __('Payment Options', 'event_espresso');
133
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
134 134
 		$this->checkout = $checkout;
135 135
 		$this->_reset_success_message();
136 136
 		$this->set_instructions(
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	/**
156 156
 	 * @param null $line_item_display
157 157
 	 */
158
-	public function set_line_item_display( $line_item_display ) {
158
+	public function set_line_item_display($line_item_display) {
159 159
 		$this->line_item_display = $line_item_display;
160 160
 	}
161 161
 
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	/**
174 174
 	 * @param boolean $handle_IPN_in_this_request
175 175
 	 */
176
-	public function set_handle_IPN_in_this_request( $handle_IPN_in_this_request ) {
177
-		$this->handle_IPN_in_this_request = filter_var( $handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN );
176
+	public function set_handle_IPN_in_this_request($handle_IPN_in_this_request) {
177
+		$this->handle_IPN_in_this_request = filter_var($handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN);
178 178
 	}
179 179
 
180 180
 
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
 	public function enqueue_styles_and_scripts() {
210 210
 		$transaction = $this->checkout->transaction;
211 211
 		//if the transaction isn't set or nothing is owed on it, don't enqueue any JS
212
-		if( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats( $transaction->remaining(), 0 ) ) {
212
+		if ( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats($transaction->remaining(), 0)) {
213 213
 			return;
214 214
 		}
215
-		foreach( EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ) as $payment_method ) {
215
+		foreach (EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart) as $payment_method) {
216 216
 			$type_obj = $payment_method->type_obj();
217
-			if( $type_obj instanceof EE_PMT_Base ) {
218
-				$billing_form = $type_obj->generate_new_billing_form( $transaction );
219
-				if( $billing_form instanceof EE_Form_Section_Proper ) {
217
+			if ($type_obj instanceof EE_PMT_Base) {
218
+				$billing_form = $type_obj->generate_new_billing_form($transaction);
219
+				if ($billing_form instanceof EE_Form_Section_Proper) {
220 220
 					$billing_form->enqueue_js();
221 221
 				}
222 222
 			}
@@ -241,20 +241,20 @@  discard block
 block discarded – undo
241 241
 			// 	$ 0.00 transactions (no payment required)
242 242
 			! $this->checkout->payment_required()
243 243
 			// but do NOT remove if current action being called belongs to this reg step
244
-			&& ! is_callable( array( $this, $this->checkout->action ) )
244
+			&& ! is_callable(array($this, $this->checkout->action))
245 245
 			&& ! $this->completed()
246 246
 		) {
247 247
 			// and if so, then we no longer need the Payment Options step
248
-			if ( $this->is_current_step() ) {
248
+			if ($this->is_current_step()) {
249 249
 				$this->checkout->generate_reg_form = false;
250 250
 			}
251
-			$this->checkout->remove_reg_step( $this->_slug );
251
+			$this->checkout->remove_reg_step($this->_slug);
252 252
 			// DEBUG LOG
253 253
 			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
254 254
 			return false;
255 255
 		}
256 256
 		// load EEM_Payment_Method
257
-		EE_Registry::instance()->load_model( 'Payment_Method' );
257
+		EE_Registry::instance()->load_model('Payment_Method');
258 258
 		// get all active payment methods
259 259
 		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
260 260
 			$this->checkout->transaction,
@@ -281,15 +281,15 @@  discard block
 block discarded – undo
281 281
 		$insufficient_spaces_available = array();
282 282
 		$reg_count = 0;
283 283
 		// loop thru registrations to gather info
284
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
284
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
285 285
 		$ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space(
286 286
 			$registrations,
287 287
 			$this->checkout->revisit
288 288
 		);
289
-		foreach ( $registrations as $REG_ID => $registration ) {
289
+		foreach ($registrations as $REG_ID => $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
 			/** @var $registration EE_Registration */
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 				&& $registration->status_ID() === EEM_Registration::status_id_approved
302 302
 			)
303 303
 			) {
304
-				if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true ) ) {
304
+				if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) {
305 305
 					// add event to list of events that are sold out
306
-					$sold_out_events[ $registration->event()->ID() ] = $registration->event();
306
+					$sold_out_events[$registration->event()->ID()] = $registration->event();
307 307
 					do_action(
308 308
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
309 309
 						$registration->event(),
@@ -312,9 +312,9 @@  discard block
 block discarded – undo
312 312
 					continue;
313 313
 				}
314 314
 				// event requires admin approval
315
-				if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) {
315
+				if ($registration->status_ID() === EEM_Registration::status_id_not_approved) {
316 316
 					// add event to list of events with pre-approval reg status
317
-					$registrations_requiring_pre_approval[ $REG_ID ] = $registration;
317
+					$registrations_requiring_pre_approval[$REG_ID] = $registration;
318 318
 					do_action(
319 319
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
320 320
 						$registration->event(),
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
 				}
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
 		} else {
384 384
 			$this->_hide_reg_step_submit_button_if_revisit();
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 	 * @return \EE_Line_Item_Filter_Collection
410 410
 	 * @throws \EE_Error
411 411
 	 */
412
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
412
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
413 413
 		$line_item_filter_collection->add(
414 414
 			new EE_Billable_Line_Item_Filter(
415 415
 				EE_SPCO_Reg_Step_Payment_Options::remove_ejected_registrations(
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 				)
420 420
 			)
421 421
 		);
422
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
422
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
423 423
 		return $line_item_filter_collection;
424 424
 	}
425 425
 
@@ -435,15 +435,15 @@  discard block
 block discarded – undo
435 435
 	 * @return \EE_Registration[]
436 436
 	 * @throws \EE_Error
437 437
 	 */
438
-	public static function remove_ejected_registrations( array $registrations ) {
438
+	public static function remove_ejected_registrations(array $registrations) {
439 439
 		$ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space(
440 440
 			$registrations,
441 441
 			EE_Registry::instance()->SSN->checkout()->revisit
442 442
 		);
443
-		foreach ( $registrations as $REG_ID => $registration ) {
443
+		foreach ($registrations as $REG_ID => $registration) {
444 444
 			// has this registration lost it's space ?
445
-			if ( isset( $ejected_registrations[ $REG_ID ] ) ) {
446
-				unset( $registrations[ $REG_ID ] );
445
+			if (isset($ejected_registrations[$REG_ID])) {
446
+				unset($registrations[$REG_ID]);
447 447
 				continue;
448 448
 			}
449 449
 		}
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 * @return array
467 467
 	 * @throws \EE_Error
468 468
 	 */
469
-	public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) {
469
+	public static function find_registrations_that_lost_their_space(array $registrations, $revisit = false) {
470 470
         // registrations per event
471 471
 		$event_reg_count = array();
472 472
 		// spaces left per event
@@ -475,8 +475,8 @@  discard block
 block discarded – undo
475 475
         $tickets_remaining = array();
476 476
         // registrations that have lost their space
477 477
 		$ejected_registrations = array();
478
-		foreach ( $registrations as $REG_ID => $registration ) {
479
-			if ( $registration->status_ID() === EEM_Registration::status_id_approved ) {
478
+		foreach ($registrations as $REG_ID => $registration) {
479
+			if ($registration->status_ID() === EEM_Registration::status_id_approved) {
480 480
 				continue;
481 481
 			}
482 482
 			$EVT_ID = $registration->event_ID();
@@ -497,13 +497,13 @@  discard block
 block discarded – undo
497 497
 				$revisit
498 498
 				&& (
499 499
                     $tickets_remaining[$ticket->ID()] === 0
500
-				    || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
500
+				    || $event_reg_count[$EVT_ID] > $event_spaces_remaining[$EVT_ID]
501 501
                 )
502 502
 			) {
503
-				$ejected_registrations[ $REG_ID ] = $registration->event();
504
-				if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) {
503
+				$ejected_registrations[$REG_ID] = $registration->event();
504
+				if ($registration->status_ID() !== EEM_Registration::status_id_wait_list) {
505 505
 					/** @type EE_Registration_Processor $registration_processor */
506
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
506
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
507 507
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
508 508
 					$registration_processor->manually_update_registration_status(
509 509
 						$registration,
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
 	 * @return void
539 539
 	 */
540 540
 	protected function _hide_reg_step_submit_button_if_revisit() {
541
-		if ( $this->checkout->revisit ) {
542
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
541
+		if ($this->checkout->revisit) {
542
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
543 543
 		}
544 544
 	}
545 545
 
@@ -553,13 +553,13 @@  discard block
 block discarded – undo
553 553
 	 * @return \EE_Form_Section_Proper
554 554
 	 * @throws \EE_Error
555 555
 	 */
556
-	private function _sold_out_events( $sold_out_events_array = array() ) {
556
+	private function _sold_out_events($sold_out_events_array = array()) {
557 557
 		// set some defaults
558 558
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
559 559
 		$sold_out_events = '';
560
-		foreach ( $sold_out_events_array as $sold_out_event ) {
560
+		foreach ($sold_out_events_array as $sold_out_event) {
561 561
 			$sold_out_events .= EEH_HTML::li(
562
-				EEH_HTML::span( '  ' .$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )
562
+				EEH_HTML::span('  '.$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')
563 563
 			);
564 564
 		}
565 565
 		return new EE_Form_Section_Proper(
@@ -606,14 +606,14 @@  discard block
 block discarded – undo
606 606
 	 * @return \EE_Form_Section_Proper
607 607
 	 * @throws \EE_Error
608 608
 	 */
609
-	private function _insufficient_spaces_available( $insufficient_spaces_events_array = array() ) {
609
+	private function _insufficient_spaces_available($insufficient_spaces_events_array = array()) {
610 610
 		// set some defaults
611 611
 		$this->checkout->selected_method_of_payment = 'invoice';
612 612
 		$insufficient_space_events = '';
613
-		foreach ( $insufficient_spaces_events_array as $event ) {
614
-			if ( $event instanceof EE_Event ) {
613
+		foreach ($insufficient_spaces_events_array as $event) {
614
+			if ($event instanceof EE_Event) {
615 615
 				$insufficient_space_events .= EEH_HTML::li(
616
-					EEH_HTML::span( ' ' . $event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )
616
+					EEH_HTML::span(' '.$event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')
617 617
 				);
618 618
 			}
619 619
 		}
@@ -657,17 +657,17 @@  discard block
 block discarded – undo
657 657
 	 * @return \EE_Form_Section_Proper
658 658
 	 * @throws \EE_Error
659 659
 	 */
660
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array() ) {
660
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
661 661
 		$events_requiring_pre_approval = '';
662
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
663
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
664
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
662
+		foreach ($registrations_requiring_pre_approval as $registration) {
663
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
664
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
665 665
 					EEH_HTML::span(
666 666
 						'',
667 667
 						'',
668 668
 						'dashicons dashicons-marker ee-icon-size-16 orange-text'
669 669
 					)
670
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
670
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
671 671
 				);
672 672
 			}
673 673
 		}
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 						'template_args'        => apply_filters(
687 687
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
688 688
 							array(
689
-								'events_requiring_pre_approval'     => implode( '', $events_requiring_pre_approval ),
689
+								'events_requiring_pre_approval'     => implode('', $events_requiring_pre_approval),
690 690
 								'events_requiring_pre_approval_msg' => apply_filters(
691 691
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
692 692
 									__(
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	 * @return \EE_Form_Section_Proper
712 712
 	 * @throws \EE_Error
713 713
 	 */
714
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
714
+	private function _no_payment_required($registrations_for_free_events = array()) {
715 715
 		// set some defaults
716 716
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
717 717
 		// generate no_payment_required form
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 								'ticket_count'                  => array(),
736 736
 								'registrations_for_free_events' => $registrations_for_free_events,
737 737
 								'no_payment_required_msg'       => EEH_HTML::p(
738
-									__( 'This is a free event, so no billing will occur.', 'event_espresso' )
738
+									__('This is a free event, so no billing will occur.', 'event_espresso')
739 739
 								)
740 740
 							)
741 741
 						),
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 	 * @return \EE_Form_Section_Proper
755 755
 	 * @throws \EE_Error
756 756
 	 */
757
-	private function _display_payment_options( $transaction_details = '' ) {
757
+	private function _display_payment_options($transaction_details = '') {
758 758
 		// has method_of_payment been set by no-js user?
759 759
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
760 760
 		// build payment options form
@@ -766,18 +766,18 @@  discard block
 block discarded – undo
766 766
 						'before_payment_options' => apply_filters(
767 767
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
768 768
 							new EE_Form_Section_Proper(
769
-								array( 'layout_strategy' => new EE_Div_Per_Section_Layout() )
769
+								array('layout_strategy' => new EE_Div_Per_Section_Layout())
770 770
 							)
771 771
 						),
772 772
 						'payment_options'        => $this->_setup_payment_options(),
773 773
 						'after_payment_options'  => apply_filters(
774 774
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
775 775
 							new EE_Form_Section_Proper(
776
-								array( 'layout_strategy' => new EE_Div_Per_Section_Layout() )
776
+								array('layout_strategy' => new EE_Div_Per_Section_Layout())
777 777
 							)
778 778
 						),
779 779
 						'default_hidden_inputs'  => $this->reg_step_hidden_inputs(),
780
-						'extra_hidden_inputs'    => $this->_extra_hidden_inputs( false )
780
+						'extra_hidden_inputs'    => $this->_extra_hidden_inputs(false)
781 781
 					),
782 782
 					'layout_strategy' => new EE_Template_Layout(
783 783
 						array(
@@ -806,10 +806,10 @@  discard block
 block discarded – undo
806 806
 	 * @return \EE_Form_Section_Proper
807 807
 	 * @throws \EE_Error
808 808
 	 */
809
-	private function _extra_hidden_inputs( $no_payment_required = true ) {
809
+	private function _extra_hidden_inputs($no_payment_required = true) {
810 810
 		return new EE_Form_Section_Proper(
811 811
 			array(
812
-				'html_id'         => 'ee-' . $this->slug() . '-extra-hidden-inputs',
812
+				'html_id'         => 'ee-'.$this->slug().'-extra-hidden-inputs',
813 813
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
814 814
 				'subsections'     => array(
815 815
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -841,16 +841,16 @@  discard block
 block discarded – undo
841 841
 	 * @access protected
842 842
 	 * @param array $registrations
843 843
 	 */
844
-	protected function _apply_registration_payments_to_amount_owing( array $registrations ) {
844
+	protected function _apply_registration_payments_to_amount_owing(array $registrations) {
845 845
 		$payments = array();
846
-		foreach ( $registrations as $registration ) {
847
-			if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
846
+		foreach ($registrations as $registration) {
847
+			if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
848 848
 				$payments += $registration->registration_payments();
849 849
 			}
850 850
 		}
851
-		if ( ! empty( $payments ) ) {
852
-			foreach ( $payments as $payment ) {
853
-				if ( $payment instanceof EE_Registration_Payment ) {
851
+		if ( ! empty($payments)) {
852
+			foreach ($payments as $payment) {
853
+				if ($payment instanceof EE_Registration_Payment) {
854 854
 					$this->checkout->amount_owing -= $payment->amount();
855 855
 				}
856 856
 			}
@@ -866,11 +866,11 @@  discard block
 block discarded – undo
866 866
 	 * @param    bool $force_reset
867 867
 	 * @return    void
868 868
 	 */
869
-	private function _reset_selected_method_of_payment( $force_reset = false ) {
869
+	private function _reset_selected_method_of_payment($force_reset = false) {
870 870
 		$reset_payment_method = $force_reset
871 871
 			? true
872
-			: sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', false ) );
873
-		if ( $reset_payment_method ) {
872
+			: sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', false));
873
+		if ($reset_payment_method) {
874 874
 			$this->checkout->selected_method_of_payment = null;
875 875
 			$this->checkout->payment_method = null;
876 876
 			$this->checkout->billing_form = null;
@@ -889,12 +889,12 @@  discard block
 block discarded – undo
889 889
 	 * @param string $selected_method_of_payment
890 890
 	 * @return        EE_Billing_Info_Form
891 891
 	 */
892
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
893
-		$selected_method_of_payment = ! empty( $selected_method_of_payment )
892
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
893
+		$selected_method_of_payment = ! empty($selected_method_of_payment)
894 894
 			? $selected_method_of_payment
895 895
 			: $this->checkout->selected_method_of_payment;
896 896
 		EE_Registry::instance()->SSN->set_session_data(
897
-			array( 'selected_method_of_payment' => $selected_method_of_payment )
897
+			array('selected_method_of_payment' => $selected_method_of_payment)
898 898
 		);
899 899
 	}
900 900
 
@@ -910,19 +910,19 @@  discard block
 block discarded – undo
910 910
 		// load payment method classes
911 911
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
912 912
 		// switch up header depending on number of available payment methods
913
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
913
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
914 914
 			? apply_filters(
915 915
 				'FHEE__registration_page_payment_options__method_of_payment_hdr',
916
-				__( 'Please Select Your Method of Payment', 'event_espresso' )
916
+				__('Please Select Your Method of Payment', 'event_espresso')
917 917
 			)
918 918
 			: apply_filters(
919 919
 				'FHEE__registration_page_payment_options__method_of_payment_hdr',
920
-				__( 'Method of Payment', 'event_espresso' )
920
+				__('Method of Payment', 'event_espresso')
921 921
 			);
922 922
 		$available_payment_methods = array(
923 923
 			// display the "Payment Method" header
924 924
 			'payment_method_header' => new EE_Form_Section_HTML(
925
-				EEH_HTML::h4( $payment_method_header, 'method-of-payment-hdr' )
925
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
926 926
 			)
927 927
 		);
928 928
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
@@ -931,32 +931,32 @@  discard block
 block discarded – undo
931 931
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
932 932
 		$payment_methods_billing_info = array(
933 933
 			new EE_Form_Section_HTML(
934
-				EEH_HTML::div( '<br />', '', '', 'clear:both;' )
934
+				EEH_HTML::div('<br />', '', '', 'clear:both;')
935 935
 			)
936 936
 		);
937 937
 		// loop through payment methods
938
-		foreach ( $this->checkout->available_payment_methods as $payment_method ) {
939
-			if ( $payment_method instanceof EE_Payment_Method ) {
938
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
939
+			if ($payment_method instanceof EE_Payment_Method) {
940 940
 				$payment_method_button = EEH_HTML::img(
941 941
 					$payment_method->button_url(),
942 942
 					$payment_method->name(),
943
-					'spco-payment-method-' . $payment_method->slug() . '-btn-img',
943
+					'spco-payment-method-'.$payment_method->slug().'-btn-img',
944 944
 					'spco-payment-method-btn-img'
945 945
 				);
946 946
 				// check if any payment methods are set as default
947 947
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
948 948
 				if (
949
-					( $this->checkout->selected_method_of_payment === $payment_method->slug() )
950
-					|| ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )
949
+					($this->checkout->selected_method_of_payment === $payment_method->slug())
950
+					|| ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())
951 951
 				) {
952 952
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
953 953
 					$this->_save_selected_method_of_payment();
954
-					$default_payment_method_option[ $payment_method->slug() ] = $payment_method_button;
954
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
955 955
 				} else {
956
-					$available_payment_method_options[ $payment_method->slug() ] = $payment_method_button;
956
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
957 957
 				}
958
-				$payment_methods_billing_info[ $payment_method->slug()
959
-				                               . '-info' ] = $this->_payment_method_billing_info(
958
+				$payment_methods_billing_info[$payment_method->slug()
959
+				                               . '-info'] = $this->_payment_method_billing_info(
960 960
 					$payment_method
961 961
 				);
962 962
 			}
@@ -986,12 +986,12 @@  discard block
 block discarded – undo
986 986
 	 * @return EE_Payment_Method[]
987 987
 	 */
988 988
 	protected function _get_available_payment_methods() {
989
-		if ( ! empty( $this->checkout->available_payment_methods ) ) {
989
+		if ( ! empty($this->checkout->available_payment_methods)) {
990 990
 			return $this->checkout->available_payment_methods;
991 991
 		}
992 992
 		$available_payment_methods = array();
993 993
 		// load EEM_Payment_Method
994
-		EE_Registry::instance()->load_model( 'Payment_Method' );
994
+		EE_Registry::instance()->load_model('Payment_Method');
995 995
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
996 996
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
997 997
 		// get all active payment methods
@@ -999,9 +999,9 @@  discard block
 block discarded – undo
999 999
 			$this->checkout->transaction,
1000 1000
 			EEM_Payment_Method::scope_cart
1001 1001
 		);
1002
-		foreach ( $payment_methods as $payment_method ) {
1003
-			if ( $payment_method instanceof EE_Payment_Method ) {
1004
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
1002
+		foreach ($payment_methods as $payment_method) {
1003
+			if ($payment_method instanceof EE_Payment_Method) {
1004
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
1005 1005
 			}
1006 1006
 		}
1007 1007
 		return $available_payment_methods;
@@ -1016,14 +1016,14 @@  discard block
 block discarded – undo
1016 1016
 	 * @param    array $available_payment_method_options
1017 1017
 	 * @return    \EE_Form_Section_Proper
1018 1018
 	 */
1019
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
1019
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
1020 1020
 		// generate inputs
1021 1021
 		return new EE_Form_Section_Proper(
1022 1022
 			array(
1023 1023
 				'html_id'         => 'ee-available-payment-method-inputs',
1024 1024
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
1025 1025
 				'subsections'     => array(
1026
-					'' => new EE_Radio_Button_Input (
1026
+					'' => new EE_Radio_Button_Input(
1027 1027
 						$available_payment_method_options,
1028 1028
 						array(
1029 1029
 							'html_name'          => 'selected_method_of_payment',
@@ -1048,28 +1048,28 @@  discard block
 block discarded – undo
1048 1048
 	 * @return    \EE_Form_Section_Proper
1049 1049
 	 * @throws \EE_Error
1050 1050
 	 */
1051
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
1051
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
1052 1052
 		$currently_selected = $this->checkout->selected_method_of_payment === $payment_method->slug()
1053 1053
 			? true
1054 1054
 			: false;
1055 1055
 		// generate the billing form for payment method
1056 1056
 		$billing_form = $currently_selected
1057
-			? $this->_get_billing_form_for_payment_method( $payment_method )
1057
+			? $this->_get_billing_form_for_payment_method($payment_method)
1058 1058
 			: new EE_Form_Section_HTML();
1059 1059
 		$this->checkout->billing_form = $currently_selected
1060 1060
 			? $billing_form
1061 1061
 			: $this->checkout->billing_form;
1062 1062
 		// it's all in the details
1063 1063
 		$info_html = EEH_HTML::h3(
1064
-			__( 'Important information regarding your payment', 'event_espresso' ),
1064
+			__('Important information regarding your payment', 'event_espresso'),
1065 1065
 			'',
1066 1066
 			'spco-payment-method-hdr'
1067 1067
 		);
1068 1068
 		// add some info regarding the step, either from what's saved in the admin,
1069 1069
 		// or a default string depending on whether the PM has a billing form or not
1070
-		if ( $payment_method->description() ) {
1070
+		if ($payment_method->description()) {
1071 1071
 			$payment_method_info = $payment_method->description();
1072
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
1072
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
1073 1073
 			$payment_method_info = sprintf(
1074 1074
 				__(
1075 1075
 					'Please provide the following billing information, then click the "%1$s" button below in order to proceed.',
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 			);
1080 1080
 		} else {
1081 1081
 			$payment_method_info = sprintf(
1082
-				__( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ),
1082
+				__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'),
1083 1083
 				$this->submit_button_text()
1084 1084
 			);
1085 1085
 		}
@@ -1093,13 +1093,13 @@  discard block
 block discarded – undo
1093 1093
 		);
1094 1094
 		return new EE_Form_Section_Proper(
1095 1095
 			array(
1096
-				'html_id'         => 'spco-payment-method-info-' . $payment_method->slug(),
1096
+				'html_id'         => 'spco-payment-method-info-'.$payment_method->slug(),
1097 1097
 				'html_class'      => 'spco-payment-method-info-dv',
1098 1098
 				// only display the selected or default PM
1099 1099
 				'html_style'      => $currently_selected ? '' : 'display:none;',
1100 1100
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
1101 1101
 				'subsections'     => array(
1102
-					'info'         => new EE_Form_Section_HTML( $info_html ),
1102
+					'info'         => new EE_Form_Section_HTML($info_html),
1103 1103
 					'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML()
1104 1104
 				)
1105 1105
 			)
@@ -1117,15 +1117,15 @@  discard block
 block discarded – undo
1117 1117
 	 */
1118 1118
 	public function get_billing_form_html_for_payment_method() {
1119 1119
 		// how have they chosen to pay?
1120
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1120
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1121 1121
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
1122
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
1122
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
1123 1123
 			return false;
1124 1124
 		}
1125
-		if ( apply_filters(
1125
+		if (apply_filters(
1126 1126
 			'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1127 1127
 			false
1128
-		) ) {
1128
+		)) {
1129 1129
 			EE_Error::add_success(
1130 1130
 				apply_filters(
1131 1131
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 			);
1141 1141
 		}
1142 1142
 		// now generate billing form for selected method of payment
1143
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1143
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1144 1144
 		// fill form with attendee info if applicable
1145 1145
 		if (
1146 1146
 			$payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form
@@ -1162,10 +1162,10 @@  discard block
 block discarded – undo
1162 1162
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper
1163 1163
 			? $payment_method_billing_form->get_html()
1164 1164
 			: '';
1165
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ) );
1165
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
1166 1166
 		// localize validation rules for main form
1167 1167
 		$this->checkout->current_step->reg_form->localize_validation_rules();
1168
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
1168
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
1169 1169
 		return true;
1170 1170
 	}
1171 1171
 
@@ -1179,18 +1179,18 @@  discard block
 block discarded – undo
1179 1179
 	 * @return \EE_Billing_Info_Form|\EE_Form_Section_HTML
1180 1180
 	 * @throws \EE_Error
1181 1181
 	 */
1182
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
1182
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
1183 1183
 		$billing_form = $payment_method->type_obj()->billing_form(
1184 1184
 			$this->checkout->transaction,
1185
-			array( 'amount_owing' => $this->checkout->amount_owing )
1185
+			array('amount_owing' => $this->checkout->amount_owing)
1186 1186
 		);
1187
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
1187
+		if ($billing_form instanceof EE_Billing_Info_Form) {
1188 1188
 			if (
1189 1189
 				apply_filters(
1190 1190
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1191 1191
 					false
1192 1192
 				)
1193
-				&& EE_Registry::instance()->REQ->is_set( 'payment_method' )
1193
+				&& EE_Registry::instance()->REQ->is_set('payment_method')
1194 1194
 			) {
1195 1195
 				EE_Error::add_success(
1196 1196
 					apply_filters(
@@ -1232,15 +1232,15 @@  discard block
 block discarded – undo
1232 1232
 		$request_param = 'selected_method_of_payment'
1233 1233
 	) {
1234 1234
 		// is selected_method_of_payment set in the request ?
1235
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, false );
1236
-		if ( $selected_method_of_payment ) {
1235
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, false);
1236
+		if ($selected_method_of_payment) {
1237 1237
 			// sanitize it
1238
-			$selected_method_of_payment = is_array( $selected_method_of_payment )
1239
-				? array_shift( $selected_method_of_payment )
1238
+			$selected_method_of_payment = is_array($selected_method_of_payment)
1239
+				? array_shift($selected_method_of_payment)
1240 1240
 				: $selected_method_of_payment;
1241
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
1241
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
1242 1242
 			// store it in the session so that it's available for all subsequent requests including AJAX
1243
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
1243
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
1244 1244
 		} else {
1245 1245
 			// or is is set in the session ?
1246 1246
 			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data(
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
 			);
1249 1249
 		}
1250 1250
 		// do ya really really gotta have it?
1251
-		if ( empty( $selected_method_of_payment ) && $required ) {
1251
+		if (empty($selected_method_of_payment) && $required) {
1252 1252
 			EE_Error::add_error(
1253 1253
 				sprintf(
1254 1254
 					__(
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
 					),
1258 1258
 					'<br/>',
1259 1259
 					'<br/>',
1260
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1260
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1261 1261
 				),
1262 1262
 				__FILE__,
1263 1263
 				__FUNCTION__,
@@ -1284,13 +1284,13 @@  discard block
 block discarded – undo
1284 1284
 	 * @throws \EE_Error
1285 1285
 	 */
1286 1286
 	public function switch_payment_method() {
1287
-		if ( ! $this->_verify_payment_method_is_set() ) {
1287
+		if ( ! $this->_verify_payment_method_is_set()) {
1288 1288
 			return false;
1289 1289
 		}
1290
-		if ( apply_filters(
1290
+		if (apply_filters(
1291 1291
 			'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1292 1292
 			false
1293
-		) ) {
1293
+		)) {
1294 1294
 			EE_Error::add_success(
1295 1295
 				apply_filters(
1296 1296
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -1305,13 +1305,13 @@  discard block
 block discarded – undo
1305 1305
 			);
1306 1306
 		}
1307 1307
 		// generate billing form for selected method of payment if it hasn't been done already
1308
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1308
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
1309 1309
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1310 1310
 				$this->checkout->payment_method
1311 1311
 			);
1312 1312
 		}
1313 1313
 		// fill form with attendee info if applicable
1314
-		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form
1314
+		if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form
1315 1315
 		     && $this->checkout->transaction_has_primary_registrant()
1316 1316
 		) {
1317 1317
 			$this->checkout->billing_form->populate_from_attendee(
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 			);
1320 1320
 		}
1321 1321
 		// and debug content
1322
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form
1322
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form
1323 1323
 		     && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1324 1324
 		) {
1325 1325
 			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
@@ -1327,15 +1327,15 @@  discard block
 block discarded – undo
1327 1327
 			);
1328 1328
 		}
1329 1329
 		// get html and validation rules for form
1330
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
1330
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
1331 1331
 			$this->checkout->json_response->set_return_data(
1332
-				array( 'payment_method_info' => $this->checkout->billing_form->get_html() )
1332
+				array('payment_method_info' => $this->checkout->billing_form->get_html())
1333 1333
 			);
1334 1334
 			// localize validation rules for main form
1335
-			$this->checkout->billing_form->localize_validation_rules( true );
1336
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
1335
+			$this->checkout->billing_form->localize_validation_rules(true);
1336
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
1337 1337
 		} else {
1338
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ) );
1338
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
1339 1339
 		}
1340 1340
 		//prevents advancement to next step
1341 1341
 		$this->checkout->continue_reg = false;
@@ -1352,12 +1352,12 @@  discard block
 block discarded – undo
1352 1352
 	 */
1353 1353
 	protected function _verify_payment_method_is_set() {
1354 1354
 		// generate billing form for selected method of payment if it hasn't been done already
1355
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1355
+		if (empty($this->checkout->selected_method_of_payment)) {
1356 1356
 			// how have they chosen to pay?
1357
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1357
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1358 1358
 		}
1359 1359
 		// verify payment method
1360
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
1360
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
1361 1361
 			// get payment method for selected method of payment
1362 1362
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
1363 1363
 		}
@@ -1376,25 +1376,25 @@  discard block
 block discarded – undo
1376 1376
 	 * @throws \EE_Error
1377 1377
 	 */
1378 1378
 	public function save_payer_details_via_ajax() {
1379
-		if ( ! $this->_verify_payment_method_is_set() ) {
1379
+		if ( ! $this->_verify_payment_method_is_set()) {
1380 1380
 			return;
1381 1381
 		}
1382 1382
 		// generate billing form for selected method of payment if it hasn't been done already
1383
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1383
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
1384 1384
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1385 1385
 				$this->checkout->payment_method
1386 1386
 			);
1387 1387
 		}
1388 1388
 		// generate primary attendee from payer info if applicable
1389
-		if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1389
+		if ( ! $this->checkout->transaction_has_primary_registrant()) {
1390 1390
 			$attendee = $this->_create_attendee_from_request_data();
1391
-			if ( $attendee instanceof EE_Attendee ) {
1392
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
1393
-					if ( $registration->is_primary_registrant() ) {
1391
+			if ($attendee instanceof EE_Attendee) {
1392
+				foreach ($this->checkout->transaction->registrations() as $registration) {
1393
+					if ($registration->is_primary_registrant()) {
1394 1394
 						$this->checkout->primary_attendee_obj = $attendee;
1395
-						$registration->_add_relation_to( $attendee, 'Attendee' );
1396
-						$registration->set_attendee_id( $attendee->ID() );
1397
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
1395
+						$registration->_add_relation_to($attendee, 'Attendee');
1396
+						$registration->set_attendee_id($attendee->ID());
1397
+						$registration->update_cache_after_object_save('Attendee', $attendee);
1398 1398
 					}
1399 1399
 				}
1400 1400
 			}
@@ -1412,50 +1412,50 @@  discard block
 block discarded – undo
1412 1412
 	 */
1413 1413
 	protected function _create_attendee_from_request_data() {
1414 1414
 		// get State ID
1415
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
1416
-		if ( ! empty( $STA_ID ) ) {
1415
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
1416
+		if ( ! empty($STA_ID)) {
1417 1417
 			// can we get state object from name ?
1418
-			EE_Registry::instance()->load_model( 'State' );
1419
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1 ), 'STA_ID' );
1420
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
1418
+			EE_Registry::instance()->load_model('State');
1419
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
1420
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
1421 1421
 		}
1422 1422
 		// get Country ISO
1423
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
1424
-		if ( ! empty( $CNT_ISO ) ) {
1423
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
1424
+		if ( ! empty($CNT_ISO)) {
1425 1425
 			// can we get country object from name ?
1426
-			EE_Registry::instance()->load_model( 'Country' );
1426
+			EE_Registry::instance()->load_model('Country');
1427 1427
 			$country = EEM_Country::instance()->get_col(
1428
-				array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1 ),
1428
+				array(array('CNT_name' => $CNT_ISO), 'limit' => 1),
1429 1429
 				'CNT_ISO'
1430 1430
 			);
1431
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
1431
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
1432 1432
 		}
1433 1433
 		// grab attendee data
1434 1434
 		$attendee_data = array(
1435
-			'ATT_fname'    => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
1436
-			'ATT_lname'    => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
1437
-			'ATT_email'    => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1438
-			'ATT_address'  => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1439
-			'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1440
-			'ATT_city'     => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
1435
+			'ATT_fname'    => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
1436
+			'ATT_lname'    => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
1437
+			'ATT_email'    => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1438
+			'ATT_address'  => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1439
+			'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1440
+			'ATT_city'     => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1441 1441
 			'STA_ID'       => $STA_ID,
1442 1442
 			'CNT_ISO'      => $CNT_ISO,
1443
-			'ATT_zip'      => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1444
-			'ATT_phone'    => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1443
+			'ATT_zip'      => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1444
+			'ATT_phone'    => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1445 1445
 		);
1446 1446
 		// validate the email address since it is the most important piece of info
1447
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] !== $_REQUEST['email'] ) {
1447
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] !== $_REQUEST['email']) {
1448 1448
 			EE_Error::add_error(
1449
-				__( 'An invalid email address was submitted.', 'event_espresso' ),
1449
+				__('An invalid email address was submitted.', 'event_espresso'),
1450 1450
 				__FILE__,
1451 1451
 				__FUNCTION__,
1452 1452
 				__LINE__
1453 1453
 			);
1454 1454
 		}
1455 1455
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1456
-		if ( ! empty( $attendee_data['ATT_fname'] )
1457
-		     && ! empty( $attendee_data['ATT_lname'] )
1458
-		     && ! empty( $attendee_data['ATT_email'] )
1456
+		if ( ! empty($attendee_data['ATT_fname'])
1457
+		     && ! empty($attendee_data['ATT_lname'])
1458
+		     && ! empty($attendee_data['ATT_email'])
1459 1459
 		) {
1460 1460
 			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(
1461 1461
 				array(
@@ -1464,19 +1464,19 @@  discard block
 block discarded – undo
1464 1464
 					'ATT_email' => $attendee_data['ATT_email']
1465 1465
 				)
1466 1466
 			);
1467
-			if ( $existing_attendee instanceof EE_Attendee ) {
1467
+			if ($existing_attendee instanceof EE_Attendee) {
1468 1468
 				return $existing_attendee;
1469 1469
 			}
1470 1470
 		}
1471 1471
 		// no existing attendee? kk let's create a new one
1472 1472
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1473
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] )
1473
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname'])
1474 1474
 			? $attendee_data['ATT_fname']
1475 1475
 			: $attendee_data['ATT_email'];
1476
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] )
1476
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname'])
1477 1477
 			? $attendee_data['ATT_lname']
1478 1478
 			: $attendee_data['ATT_email'];
1479
-		return EE_Attendee::new_instance( $attendee_data );
1479
+		return EE_Attendee::new_instance($attendee_data);
1480 1480
 	}
1481 1481
 
1482 1482
 
@@ -1494,26 +1494,26 @@  discard block
 block discarded – undo
1494 1494
 		// how have they chosen to pay?
1495 1495
 		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free()
1496 1496
 			? 'no_payment_required'
1497
-			: $this->_get_selected_method_of_payment( true );
1497
+			: $this->_get_selected_method_of_payment(true);
1498 1498
 		// choose your own adventure based on method_of_payment
1499
-		switch ( $this->checkout->selected_method_of_payment ) {
1499
+		switch ($this->checkout->selected_method_of_payment) {
1500 1500
 
1501 1501
 			case 'events_sold_out' :
1502 1502
 				$this->checkout->redirect = true;
1503 1503
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1504
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1504
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1505 1505
 				// mark this reg step as completed
1506 1506
 				$this->set_completed();
1507 1507
 				return false;
1508 1508
 				break;
1509 1509
 
1510 1510
 			case 'payments_closed' :
1511
-				if ( apply_filters(
1511
+				if (apply_filters(
1512 1512
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success',
1513 1513
 					false
1514
-				) ) {
1514
+				)) {
1515 1515
 					EE_Error::add_success(
1516
-						__( 'no payment required at this time.', 'event_espresso' ),
1516
+						__('no payment required at this time.', 'event_espresso'),
1517 1517
 						__FILE__,
1518 1518
 						__FUNCTION__,
1519 1519
 						__LINE__
@@ -1525,12 +1525,12 @@  discard block
 block discarded – undo
1525 1525
 				break;
1526 1526
 
1527 1527
 			case 'no_payment_required' :
1528
-				if ( apply_filters(
1528
+				if (apply_filters(
1529 1529
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success',
1530 1530
 					false
1531
-				) ) {
1531
+				)) {
1532 1532
 					EE_Error::add_success(
1533
-						__( 'no payment required.', 'event_espresso' ),
1533
+						__('no payment required.', 'event_espresso'),
1534 1534
 						__FILE__,
1535 1535
 						__FUNCTION__,
1536 1536
 						__LINE__
@@ -1550,15 +1550,15 @@  discard block
 block discarded – undo
1550 1550
 					EE_Registry::instance()->SSN->checkout()->revisit
1551 1551
 				);
1552 1552
 				// calculate difference between the two arrays
1553
-				$registrations = array_diff( $registrations, $ejected_registrations );
1554
-				if ( empty( $registrations ) ) {
1553
+				$registrations = array_diff($registrations, $ejected_registrations);
1554
+				if (empty($registrations)) {
1555 1555
 					$this->_redirect_because_event_sold_out();
1556 1556
 					return false;
1557 1557
 				}
1558 1558
 				$payment_successful = $this->_process_payment();
1559
-				if ( $payment_successful ) {
1559
+				if ($payment_successful) {
1560 1560
 					$this->checkout->continue_reg = true;
1561
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1561
+					$this->_maybe_set_completed($this->checkout->payment_method);
1562 1562
 				} else {
1563 1563
 					$this->checkout->continue_reg = false;
1564 1564
 				}
@@ -1579,10 +1579,10 @@  discard block
 block discarded – undo
1579 1579
 		$this->checkout->continue_reg = false;
1580 1580
 		// set redirect URL
1581 1581
 		$this->checkout->redirect_url = add_query_arg(
1582
-			array( 'e_reg_url_link' => $this->checkout->reg_url_link ),
1582
+			array('e_reg_url_link' => $this->checkout->reg_url_link),
1583 1583
 			$this->checkout->current_step->reg_step_url()
1584 1584
 		);
1585
-		$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1585
+		$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1586 1586
 	}
1587 1587
 
1588 1588
 
@@ -1595,8 +1595,8 @@  discard block
 block discarded – undo
1595 1595
 	 * @return void
1596 1596
 	 * @throws \EE_Error
1597 1597
 	 */
1598
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1599
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1598
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1599
+		switch ($payment_method->type_obj()->payment_occurs()) {
1600 1600
 			case EE_PMT_Base::offsite :
1601 1601
 				break;
1602 1602
 			case EE_PMT_Base::onsite :
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
 	public function update_reg_step() {
1620 1620
 		$success = true;
1621 1621
 		// if payment required
1622
-		if ( $this->checkout->transaction->total() > 0 ) {
1622
+		if ($this->checkout->transaction->total() > 0) {
1623 1623
 			do_action(
1624 1624
 				'AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway',
1625 1625
 				$this->checkout->transaction
@@ -1627,13 +1627,13 @@  discard block
 block discarded – undo
1627 1627
 			// attempt payment via payment method
1628 1628
 			$success = $this->process_reg_step();
1629 1629
 		}
1630
-		if ( $success && ! $this->checkout->redirect ) {
1630
+		if ($success && ! $this->checkout->redirect) {
1631 1631
 			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn(
1632 1632
 				$this->checkout->transaction->ID()
1633 1633
 			);
1634 1634
 			// set return URL
1635 1635
 			$this->checkout->redirect_url = add_query_arg(
1636
-				array( 'e_reg_url_link' => $this->checkout->reg_url_link ),
1636
+				array('e_reg_url_link' => $this->checkout->reg_url_link),
1637 1637
 				$this->checkout->thank_you_page_url
1638 1638
 			);
1639 1639
 		}
@@ -1653,28 +1653,28 @@  discard block
 block discarded – undo
1653 1653
 		// clear any previous errors related to not selecting a payment method
1654 1654
 //		EE_Error::overwrite_errors();
1655 1655
 		// ya gotta make a choice man
1656
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1656
+		if (empty($this->checkout->selected_method_of_payment)) {
1657 1657
 			$this->checkout->json_response->set_plz_select_method_of_payment(
1658
-				__( 'Please select a method of payment before proceeding.', 'event_espresso' )
1658
+				__('Please select a method of payment before proceeding.', 'event_espresso')
1659 1659
 			);
1660 1660
 			return false;
1661 1661
 		}
1662 1662
 		// get EE_Payment_Method object
1663
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1663
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1664 1664
 			return false;
1665 1665
 		}
1666 1666
 		// setup billing form
1667
-		if ( $this->checkout->payment_method->is_on_site() ) {
1667
+		if ($this->checkout->payment_method->is_on_site()) {
1668 1668
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1669 1669
 				$this->checkout->payment_method
1670 1670
 			);
1671 1671
 			// bad billing form ?
1672
-			if ( ! $this->_billing_form_is_valid() ) {
1672
+			if ( ! $this->_billing_form_is_valid()) {
1673 1673
 				return false;
1674 1674
 			}
1675 1675
 		}
1676 1676
 		// ensure primary registrant has been fully processed
1677
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1677
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1678 1678
 			return false;
1679 1679
 		}
1680 1680
 		/** @type EE_Transaction_Processor $transaction_processor */
@@ -1682,18 +1682,18 @@  discard block
 block discarded – undo
1682 1682
 		// 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
1683 1683
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1684 1684
 		// attempt payment
1685
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1685
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1686 1686
 		// process results
1687
-		$payment = $this->_validate_payment( $payment );
1688
-		$payment = $this->_post_payment_processing( $payment );
1687
+		$payment = $this->_validate_payment($payment);
1688
+		$payment = $this->_post_payment_processing($payment);
1689 1689
 		// verify payment
1690
-		if ( $payment instanceof EE_Payment ) {
1690
+		if ($payment instanceof EE_Payment) {
1691 1691
 			// store that for later
1692 1692
 			$this->checkout->payment = $payment;
1693 1693
 			/** @type EE_Transaction_Processor $transaction_processor */
1694
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1694
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1695 1695
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1696
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1696
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1697 1697
 			$payment_status = $payment->status();
1698 1698
 			if (
1699 1699
 				$payment_status === EEM_Payment::status_id_approved
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 			} else {
1704 1704
 				return false;
1705 1705
 			}
1706
-		} else if ( $payment === true ) {
1706
+		} else if ($payment === true) {
1707 1707
 			// please note that offline payment methods will NOT make a payment,
1708 1708
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1709 1709
 			$this->checkout->payment = $payment;
@@ -1728,7 +1728,7 @@  discard block
 block discarded – undo
1728 1728
 		);
1729 1729
 		$html = $payment_method_billing_info->get_html_and_js();
1730 1730
 		$html .= $this->checkout->redirect_form;
1731
-		EE_Registry::instance()->REQ->add_output( $html );
1731
+		EE_Registry::instance()->REQ->add_output($html);
1732 1732
 		return true;
1733 1733
 	}
1734 1734
 
@@ -1742,28 +1742,28 @@  discard block
 block discarded – undo
1742 1742
 	 * @throws \EE_Error
1743 1743
 	 */
1744 1744
 	private function _billing_form_is_valid() {
1745
-		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1745
+		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) {
1746 1746
 			return true;
1747 1747
 		}
1748
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1749
-			if ( $this->checkout->billing_form->was_submitted() ) {
1748
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1749
+			if ($this->checkout->billing_form->was_submitted()) {
1750 1750
 				$this->checkout->billing_form->receive_form_submission();
1751
-				if ( $this->checkout->billing_form->is_valid() ) {
1751
+				if ($this->checkout->billing_form->is_valid()) {
1752 1752
 					return true;
1753 1753
 				}
1754 1754
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1755 1755
 				$error_strings = array();
1756
-				foreach ( $validation_errors as $validation_error ) {
1757
-					if ( $validation_error instanceof EE_Validation_Error ) {
1756
+				foreach ($validation_errors as $validation_error) {
1757
+					if ($validation_error instanceof EE_Validation_Error) {
1758 1758
 						$form_section = $validation_error->get_form_section();
1759
-						if ( $form_section instanceof EE_Form_Input_Base ) {
1759
+						if ($form_section instanceof EE_Form_Input_Base) {
1760 1760
 							$label = $form_section->html_label_text();
1761
-						} elseif ( $form_section instanceof EE_Form_Section_Base ) {
1761
+						} elseif ($form_section instanceof EE_Form_Section_Base) {
1762 1762
 							$label = $form_section->name();
1763 1763
 						} else {
1764
-							$label = __( 'Validation Error', 'event_espresso' );
1764
+							$label = __('Validation Error', 'event_espresso');
1765 1765
 						}
1766
-						$error_strings[] = sprintf( '%1$s: %2$s', $label, $validation_error->getMessage() );
1766
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1767 1767
 					}
1768 1768
 				}
1769 1769
 				EE_Error::add_error(
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 							'event_espresso'
1774 1774
 						),
1775 1775
 						'<br/>',
1776
-						implode( '<br/>', $error_strings )
1776
+						implode('<br/>', $error_strings)
1777 1777
 					),
1778 1778
 					__FILE__,
1779 1779
 					__FUNCTION__,
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
 			}
1793 1793
 		} else {
1794 1794
 			EE_Error::add_error(
1795
-				__( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ),
1795
+				__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'),
1796 1796
 				__FILE__,
1797 1797
 				__FUNCTION__,
1798 1798
 				__LINE__
@@ -1827,13 +1827,13 @@  discard block
 block discarded – undo
1827 1827
 		// grab the primary_registration object
1828 1828
 		$primary_registration = $this->checkout->transaction->primary_registration();
1829 1829
 		/** @type EE_Transaction_Processor $transaction_processor */
1830
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1830
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1831 1831
 		// at this point we'll consider a TXN to not have been failed
1832
-		$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1832
+		$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1833 1833
 		// save the TXN ( which clears cached copy of primary_registration)
1834 1834
 		$this->checkout->transaction->save();
1835 1835
 		// grab TXN ID and save it to the primary_registration
1836
-		$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1836
+		$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1837 1837
 		// save what we have so far
1838 1838
 		$primary_registration->save();
1839 1839
 		return true;
@@ -1851,7 +1851,7 @@  discard block
 block discarded – undo
1851 1851
 	private function _capture_primary_registration_data_from_billing_form() {
1852 1852
 		// convert billing form data into an attendee
1853 1853
 		$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1854
-		if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1854
+		if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1855 1855
 			EE_Error::add_error(
1856 1856
 				sprintf(
1857 1857
 					__(
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
 						'event_espresso'
1860 1860
 					),
1861 1861
 					'<br/>',
1862
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1862
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1863 1863
 				),
1864 1864
 				__FILE__,
1865 1865
 				__FUNCTION__,
@@ -1868,7 +1868,7 @@  discard block
 block discarded – undo
1868 1868
 			return false;
1869 1869
 		}
1870 1870
 		$primary_registration = $this->checkout->transaction->primary_registration();
1871
-		if ( ! $primary_registration instanceof EE_Registration ) {
1871
+		if ( ! $primary_registration instanceof EE_Registration) {
1872 1872
 			EE_Error::add_error(
1873 1873
 				sprintf(
1874 1874
 					__(
@@ -1876,7 +1876,7 @@  discard block
 block discarded – undo
1876 1876
 						'event_espresso'
1877 1877
 					),
1878 1878
 					'<br/>',
1879
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1879
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1880 1880
 				),
1881 1881
 				__FILE__,
1882 1882
 				__FUNCTION__,
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
 			);
1885 1885
 			return false;
1886 1886
 		}
1887
-		if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' )
1887
+		if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee')
1888 1888
 		       instanceof
1889 1889
 		       EE_Attendee
1890 1890
 		) {
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
 						'event_espresso'
1896 1896
 					),
1897 1897
 					'<br/>',
1898
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1898
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1899 1899
 				),
1900 1900
 				__FILE__,
1901 1901
 				__FUNCTION__,
@@ -1904,9 +1904,9 @@  discard block
 block discarded – undo
1904 1904
 			return false;
1905 1905
 		}
1906 1906
 		/** @type EE_Registration_Processor $registration_processor */
1907
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1907
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1908 1908
 		// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1909
-		$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1909
+		$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1910 1910
 		return true;
1911 1911
 	}
1912 1912
 
@@ -1921,22 +1921,22 @@  discard block
 block discarded – undo
1921 1921
 	 * @throws \EE_Error
1922 1922
 	 */
1923 1923
 	private function _get_payment_method_for_selected_method_of_payment() {
1924
-		if ( $this->checkout->selected_method_of_payment === 'events_sold_out' ) {
1924
+		if ($this->checkout->selected_method_of_payment === 'events_sold_out') {
1925 1925
 			$this->_redirect_because_event_sold_out();
1926 1926
 			return null;
1927 1927
 		}
1928 1928
 		// get EE_Payment_Method object
1929
-		if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] ) ) {
1930
-			$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1929
+		if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1930
+			$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1931 1931
 		} else {
1932 1932
 			// load EEM_Payment_Method
1933
-			EE_Registry::instance()->load_model( 'Payment_Method' );
1933
+			EE_Registry::instance()->load_model('Payment_Method');
1934 1934
 			/** @type EEM_Payment_Method $EEM_Payment_Method */
1935 1935
 			$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1936
-			$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1936
+			$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1937 1937
 		}
1938 1938
 		// verify $payment_method
1939
-		if ( ! $payment_method instanceof EE_Payment_Method ) {
1939
+		if ( ! $payment_method instanceof EE_Payment_Method) {
1940 1940
 			// not a payment
1941 1941
 			EE_Error::add_error(
1942 1942
 				sprintf(
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
 						'event_espresso'
1946 1946
 					),
1947 1947
 					'<br/>',
1948
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1948
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1949 1949
 				),
1950 1950
 				__FILE__,
1951 1951
 				__FUNCTION__,
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 			return null;
1955 1955
 		}
1956 1956
 		// and verify it has a valid Payment_Method Type object
1957
-		if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1957
+		if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1958 1958
 			// not a payment
1959 1959
 			EE_Error::add_error(
1960 1960
 				sprintf(
@@ -1963,7 +1963,7 @@  discard block
 block discarded – undo
1963 1963
 						'event_espresso'
1964 1964
 					),
1965 1965
 					'<br/>',
1966
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1966
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1967 1967
 				),
1968 1968
 				__FILE__,
1969 1969
 				__FUNCTION__,
@@ -1984,29 +1984,29 @@  discard block
 block discarded – undo
1984 1984
 	 * @return    mixed    EE_Payment | boolean
1985 1985
 	 * @throws \EE_Error
1986 1986
 	 */
1987
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1987
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1988 1988
 		$payment = null;
1989 1989
 		$this->checkout->transaction->save();
1990
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1991
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1990
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1991
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1992 1992
 			return false;
1993 1993
 		}
1994 1994
 		try {
1995
-			$payment_processor->set_revisit( $this->checkout->revisit );
1995
+			$payment_processor->set_revisit($this->checkout->revisit);
1996 1996
 			// generate payment object
1997 1997
 			$payment = $payment_processor->process_payment(
1998 1998
 				$payment_method,
1999 1999
 				$this->checkout->transaction,
2000 2000
 				$this->checkout->amount_owing,
2001 2001
 				$this->checkout->billing_form,
2002
-				$this->_get_return_url( $payment_method ),
2002
+				$this->_get_return_url($payment_method),
2003 2003
 				'CART',
2004 2004
 				$this->checkout->admin_request,
2005 2005
 				true,
2006 2006
 				$this->reg_step_url()
2007 2007
 			);
2008
-		} catch ( Exception $e ) {
2009
-			$this->_handle_payment_processor_exception( $e );
2008
+		} catch (Exception $e) {
2009
+			$this->_handle_payment_processor_exception($e);
2010 2010
 		}
2011 2011
 		return $payment;
2012 2012
 	}
@@ -2021,7 +2021,7 @@  discard block
 block discarded – undo
2021 2021
 	 * @return void
2022 2022
 	 * @throws \EE_Error
2023 2023
 	 */
2024
-	protected function _handle_payment_processor_exception( Exception $e ) {
2024
+	protected function _handle_payment_processor_exception(Exception $e) {
2025 2025
 		EE_Error::add_error(
2026 2026
 			sprintf(
2027 2027
 				__(
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
 					'event_espresso'
2030 2030
 				),
2031 2031
 				'<br/>',
2032
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
2032
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
2033 2033
 				$e->getMessage(),
2034 2034
 				$e->getFile(),
2035 2035
 				$e->getLine()
@@ -2050,9 +2050,9 @@  discard block
 block discarded – undo
2050 2050
 	 * @return string
2051 2051
 	 * @throws \EE_Error
2052 2052
 	 */
2053
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
2053
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
2054 2054
 		$return_url = '';
2055
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
2055
+		switch ($payment_method->type_obj()->payment_occurs()) {
2056 2056
 			case EE_PMT_Base::offsite :
2057 2057
 				$return_url = add_query_arg(
2058 2058
 					array(
@@ -2081,12 +2081,12 @@  discard block
 block discarded – undo
2081 2081
 	 * @return EE_Payment | FALSE
2082 2082
 	 * @throws \EE_Error
2083 2083
 	 */
2084
-	private function _validate_payment( $payment = null ) {
2085
-		if ( $this->checkout->payment_method->is_off_line() ) {
2084
+	private function _validate_payment($payment = null) {
2085
+		if ($this->checkout->payment_method->is_off_line()) {
2086 2086
 			return true;
2087 2087
 		}
2088 2088
 		// verify payment object
2089
-		if ( ! $payment instanceof EE_Payment ) {
2089
+		if ( ! $payment instanceof EE_Payment) {
2090 2090
 			// not a payment
2091 2091
 			EE_Error::add_error(
2092 2092
 				sprintf(
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
 						'event_espresso'
2096 2096
 					),
2097 2097
 					'<br/>',
2098
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2098
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2099 2099
 				),
2100 2100
 				__FILE__,
2101 2101
 				__FUNCTION__,
@@ -2116,27 +2116,27 @@  discard block
 block discarded – undo
2116 2116
 	 * @return bool
2117 2117
 	 * @throws \EE_Error
2118 2118
 	 */
2119
-	private function _post_payment_processing( $payment = null ) {
2119
+	private function _post_payment_processing($payment = null) {
2120 2120
 		// Off-Line payment?
2121
-		if ( $payment === true ) {
2121
+		if ($payment === true) {
2122 2122
 			//$this->_setup_redirect_for_next_step();
2123 2123
 			return true;
2124 2124
 		// On-Site payment?
2125
-		} else if ( $this->checkout->payment_method->is_on_site() ) {
2126
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite ) ) {
2125
+		} else if ($this->checkout->payment_method->is_on_site()) {
2126
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
2127 2127
 				//$this->_setup_redirect_for_next_step();
2128 2128
 				$this->checkout->continue_reg = false;
2129 2129
 			}
2130 2130
 		// Off-Site payment?
2131
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
2131
+		} else if ($this->checkout->payment_method->is_off_site()) {
2132 2132
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
2133
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ) {
2134
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
2133
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
2134
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
2135 2135
 				$this->checkout->redirect = true;
2136 2136
 				$this->checkout->redirect_form = $payment->redirect_form();
2137
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
2137
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
2138 2138
 				// set JSON response
2139
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
2139
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
2140 2140
 				// set cron job for finalizing the TXN
2141 2141
 				// in case the user does not return from the off-site gateway
2142 2142
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
 					$this->checkout->transaction->ID()
2145 2145
 				);
2146 2146
 				// and lastly, let's bump the payment status to pending
2147
-				$payment->set_status( EEM_Payment::status_id_pending );
2147
+				$payment->set_status(EEM_Payment::status_id_pending);
2148 2148
 				$payment->save();
2149 2149
 			} else {
2150 2150
 				// not a payment
@@ -2156,7 +2156,7 @@  discard block
 block discarded – undo
2156 2156
 							'event_espresso'
2157 2157
 						),
2158 2158
 						'<br/>',
2159
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2159
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
2160 2160
 					),
2161 2161
 					__FILE__,
2162 2162
 					__FUNCTION__,
@@ -2194,21 +2194,21 @@  discard block
 block discarded – undo
2194 2194
 	 * @return bool
2195 2195
 	 * @throws \EE_Error
2196 2196
 	 */
2197
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
2197
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
2198 2198
 		// off-line payment? carry on
2199
-		if ( $payment_occurs === EE_PMT_Base::offline ) {
2199
+		if ($payment_occurs === EE_PMT_Base::offline) {
2200 2200
 			return true;
2201 2201
 		}
2202 2202
 		// verify payment validity
2203
-		if ( $payment instanceof EE_Payment ) {
2204
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
2203
+		if ($payment instanceof EE_Payment) {
2204
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
2205 2205
 			$msg = $payment->gateway_response();
2206 2206
 			// check results
2207
-			switch ( $payment->status() ) {
2207
+			switch ($payment->status()) {
2208 2208
 				// good payment
2209 2209
 				case EEM_Payment::status_id_approved :
2210 2210
 					EE_Error::add_success(
2211
-						__( 'Your payment was processed successfully.', 'event_espresso' ),
2211
+						__('Your payment was processed successfully.', 'event_espresso'),
2212 2212
 						__FILE__,
2213 2213
 						__FUNCTION__,
2214 2214
 						__LINE__
@@ -2217,45 +2217,45 @@  discard block
 block discarded – undo
2217 2217
 					break;
2218 2218
 				// slow payment
2219 2219
 				case EEM_Payment::status_id_pending :
2220
-					if ( empty( $msg ) ) {
2220
+					if (empty($msg)) {
2221 2221
 						$msg = __(
2222 2222
 							'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.',
2223 2223
 							'event_espresso'
2224 2224
 						);
2225 2225
 					}
2226
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
2226
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
2227 2227
 					return true;
2228 2228
 					break;
2229 2229
 				// don't wanna payment
2230 2230
 				case EEM_Payment::status_id_cancelled :
2231
-					if ( empty( $msg ) ) {
2231
+					if (empty($msg)) {
2232 2232
 						$msg = _n(
2233 2233
 							'Payment cancelled. Please try again.',
2234 2234
 							'Payment cancelled. Please try again or select another method of payment.',
2235
-							count( $this->checkout->available_payment_methods ),
2235
+							count($this->checkout->available_payment_methods),
2236 2236
 							'event_espresso'
2237 2237
 						);
2238 2238
 					}
2239
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
2239
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
2240 2240
 					return false;
2241 2241
 					break;
2242 2242
 				// not enough payment
2243 2243
 				case EEM_Payment::status_id_declined :
2244
-					if ( empty( $msg ) ) {
2244
+					if (empty($msg)) {
2245 2245
 						$msg = _n(
2246 2246
 							'We\'re sorry but your payment was declined. Please try again.',
2247 2247
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
2248
-							count( $this->checkout->available_payment_methods ),
2248
+							count($this->checkout->available_payment_methods),
2249 2249
 							'event_espresso'
2250 2250
 						);
2251 2251
 					}
2252
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
2252
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
2253 2253
 					return false;
2254 2254
 					break;
2255 2255
 				// bad payment
2256 2256
 				case EEM_Payment::status_id_failed :
2257
-					if ( ! empty( $msg ) ) {
2258
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2257
+					if ( ! empty($msg)) {
2258
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2259 2259
 						return false;
2260 2260
 					}
2261 2261
 					// default to error below
@@ -2264,7 +2264,7 @@  discard block
 block discarded – undo
2264 2264
 		}
2265 2265
 		// off-site payment gateway responses are too unreliable, so let's just assume that
2266 2266
 		// the payment processing is just running slower than the registrant's request
2267
-		if ( $payment_occurs === EE_PMT_Base::offsite ) {
2267
+		if ($payment_occurs === EE_PMT_Base::offsite) {
2268 2268
 			return true;
2269 2269
 		}
2270 2270
 		EE_Error::add_error(
@@ -2274,7 +2274,7 @@  discard block
 block discarded – undo
2274 2274
 					'event_espresso'
2275 2275
 				),
2276 2276
 				'<br/>',
2277
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2277
+				EE_Registry::instance()->CFG->organization->get_pretty('email')
2278 2278
 			),
2279 2279
 			__FILE__,
2280 2280
 			__FUNCTION__,
@@ -2307,13 +2307,13 @@  discard block
 block discarded – undo
2307 2307
 	public function process_gateway_response() {
2308 2308
 		$payment = null;
2309 2309
 		// how have they chosen to pay?
2310
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
2310
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
2311 2311
 		// get EE_Payment_Method object
2312
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
2312
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
2313 2313
 			$this->checkout->continue_reg = false;
2314 2314
 			return false;
2315 2315
 		}
2316
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
2316
+		if ( ! $this->checkout->payment_method->is_off_site()) {
2317 2317
 			return false;
2318 2318
 		}
2319 2319
 		$this->_validate_offsite_return();
@@ -2327,23 +2327,23 @@  discard block
 block discarded – undo
2327 2327
 		//	true
2328 2328
 		//);
2329 2329
 		// verify TXN
2330
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
2330
+		if ($this->checkout->transaction instanceof EE_Transaction) {
2331 2331
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
2332
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
2332
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
2333 2333
 				$this->checkout->continue_reg = false;
2334 2334
 				return false;
2335 2335
 			}
2336
-			$payment = $this->_process_off_site_payment( $gateway );
2337
-			$payment = $this->_process_cancelled_payments( $payment );
2338
-			$payment = $this->_validate_payment( $payment );
2336
+			$payment = $this->_process_off_site_payment($gateway);
2337
+			$payment = $this->_process_cancelled_payments($payment);
2338
+			$payment = $this->_validate_payment($payment);
2339 2339
 			// if payment was not declined by the payment gateway or cancelled by the registrant
2340
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
2340
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
2341 2341
 				//$this->_setup_redirect_for_next_step();
2342 2342
 				// store that for later
2343 2343
 				$this->checkout->payment = $payment;
2344 2344
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
2345 2345
 				// because we will complete this step during the IPN processing then
2346
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request() ) {
2346
+				if ($gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request()) {
2347 2347
 					$this->set_completed();
2348 2348
 				}
2349 2349
 				return true;
@@ -2367,21 +2367,21 @@  discard block
 block discarded – undo
2367 2367
 	 * @throws \EE_Error
2368 2368
 	 */
2369 2369
 	private function _validate_offsite_return() {
2370
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
2371
-		if ( $TXN_ID !== $this->checkout->transaction->ID() ) {
2370
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
2371
+		if ($TXN_ID !== $this->checkout->transaction->ID()) {
2372 2372
 			// Houston... we might have a problem
2373 2373
 			$invalid_TXN = false;
2374 2374
 			// first gather some info
2375
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
2375
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
2376 2376
 			$primary_registrant = $valid_TXN instanceof EE_Transaction
2377 2377
 				? $valid_TXN->primary_registration()
2378 2378
 				: null;
2379 2379
 			// let's start by retrieving the cart for this TXN
2380
-			$cart = $this->checkout->get_cart_for_transaction( $this->checkout->transaction );
2381
-			if ( $cart instanceof EE_Cart ) {
2380
+			$cart = $this->checkout->get_cart_for_transaction($this->checkout->transaction);
2381
+			if ($cart instanceof EE_Cart) {
2382 2382
 				// verify that the current cart has tickets
2383 2383
 				$tickets = $cart->get_tickets();
2384
-				if ( empty( $tickets ) ) {
2384
+				if (empty($tickets)) {
2385 2385
 					$invalid_TXN = true;
2386 2386
 				}
2387 2387
 			} else {
@@ -2391,39 +2391,39 @@  discard block
 block discarded – undo
2391 2391
 				? $primary_registrant->session_ID()
2392 2392
 				: null;
2393 2393
 			// validate current Session ID and compare against valid TXN session ID
2394
-			if ( EE_Session::instance()->id() === null ) {
2394
+			if (EE_Session::instance()->id() === null) {
2395 2395
 				$invalid_TXN = true;
2396
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
2396
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
2397 2397
 				// WARNING !!!
2398 2398
 				// this could be PayPal sending back duplicate requests (ya they do that)
2399 2399
 				// or it **could** mean someone is simply registering AGAIN after having just done so
2400 2400
 				// so now we need to determine if this current TXN looks valid or not
2401 2401
 				/** @type EE_Transaction_Processor $transaction_processor */
2402
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
2402
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
2403 2403
 				// has this step even been started ?
2404
-				if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false )
2404
+				if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false)
2405 2405
 				) {
2406 2406
 					// really? you're half way through this reg step, but you never started it ?
2407 2407
 					$invalid_TXN = true;
2408 2408
 				}
2409 2409
 			}
2410
-			if ( $invalid_TXN ) {
2410
+			if ($invalid_TXN) {
2411 2411
 				// is the valid TXN completed ?
2412
-				if ( $valid_TXN instanceof EE_Transaction ) {
2412
+				if ($valid_TXN instanceof EE_Transaction) {
2413 2413
 					/** @type EE_Transaction_Processor $transaction_processor */
2414
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
2414
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
2415 2415
 					// has this step even been started ?
2416
-					$reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() );
2417
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
2416
+					$reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug());
2417
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
2418 2418
 						// so it **looks** like this is a double request from PayPal
2419 2419
 						// so let's try to pick up where we left off
2420 2420
 						$this->checkout->transaction = $valid_TXN;
2421
-						$this->checkout->refresh_all_entities( true );
2421
+						$this->checkout->refresh_all_entities(true);
2422 2422
 						return;
2423 2423
 					}
2424 2424
 				}
2425 2425
 				// you appear to be lost?
2426
-				$this->_redirect_wayward_request( $primary_registrant );
2426
+				$this->_redirect_wayward_request($primary_registrant);
2427 2427
 			}
2428 2428
 		}
2429 2429
 	}
@@ -2438,14 +2438,14 @@  discard block
 block discarded – undo
2438 2438
 	 * @return bool
2439 2439
 	 * @throws \EE_Error
2440 2440
 	 */
2441
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
2442
-		if ( ! $primary_registrant instanceof EE_Registration ) {
2441
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
2442
+		if ( ! $primary_registrant instanceof EE_Registration) {
2443 2443
 			// try redirecting based on the current TXN
2444 2444
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction
2445 2445
 				? $this->checkout->transaction->primary_registration()
2446 2446
 				: null;
2447 2447
 		}
2448
-		if ( ! $primary_registrant instanceof EE_Registration ) {
2448
+		if ( ! $primary_registrant instanceof EE_Registration) {
2449 2449
 			EE_Error::add_error(
2450 2450
 				sprintf(
2451 2451
 					__(
@@ -2453,7 +2453,7 @@  discard block
 block discarded – undo
2453 2453
 						'event_espresso'
2454 2454
 					),
2455 2455
 					'<br/>',
2456
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2456
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2457 2457
 				),
2458 2458
 				__FILE__,
2459 2459
 				__FUNCTION__,
@@ -2484,17 +2484,17 @@  discard block
 block discarded – undo
2484 2484
 	 * @return \EE_Payment
2485 2485
 	 * @throws \EE_Error
2486 2486
 	 */
2487
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
2487
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
2488 2488
 		try {
2489 2489
 			$request_data = \EE_Registry::instance()->REQ->params();
2490 2490
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
2491 2491
 			$this->set_handle_IPN_in_this_request(
2492
-				$gateway->handle_IPN_in_this_request( $request_data, false )
2492
+				$gateway->handle_IPN_in_this_request($request_data, false)
2493 2493
 			);
2494
-			if ( $this->handle_IPN_in_this_request() ) {
2494
+			if ($this->handle_IPN_in_this_request()) {
2495 2495
 				// get payment details and process results
2496 2496
 				/** @type EE_Payment_Processor $payment_processor */
2497
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
2497
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
2498 2498
 				$payment = $payment_processor->process_ipn(
2499 2499
 					$request_data,
2500 2500
 					$this->checkout->transaction,
@@ -2507,14 +2507,14 @@  discard block
 block discarded – undo
2507 2507
 				$payment = $this->checkout->transaction->last_payment();
2508 2508
 				//$payment_source = 'last_payment';
2509 2509
 			}
2510
-		} catch ( Exception $e ) {
2510
+		} catch (Exception $e) {
2511 2511
 			// let's just eat the exception and try to move on using any previously set payment info
2512 2512
 			$payment = $this->checkout->transaction->last_payment();
2513 2513
 			//$payment_source = 'last_payment after Exception';
2514 2514
 			// but if we STILL don't have a payment object
2515
-			if ( ! $payment instanceof EE_Payment ) {
2515
+			if ( ! $payment instanceof EE_Payment) {
2516 2516
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
2517
-				$this->_handle_payment_processor_exception( $e );
2517
+				$this->_handle_payment_processor_exception($e);
2518 2518
 			}
2519 2519
 		}
2520 2520
 		// DEBUG LOG
@@ -2539,13 +2539,13 @@  discard block
 block discarded – undo
2539 2539
 	 * @return EE_Payment | FALSE
2540 2540
 	 * @throws \EE_Error
2541 2541
 	 */
2542
-	private function _process_cancelled_payments( $payment = null ) {
2542
+	private function _process_cancelled_payments($payment = null) {
2543 2543
 		if (
2544 2544
 			$payment instanceof EE_Payment
2545
-			&& isset( $_REQUEST['ee_cancel_payment'] )
2545
+			&& isset($_REQUEST['ee_cancel_payment'])
2546 2546
 			&& $payment->status() === EEM_Payment::status_id_failed
2547 2547
 		) {
2548
-			$payment->set_status( EEM_Payment::status_id_cancelled );
2548
+			$payment->set_status(EEM_Payment::status_id_cancelled);
2549 2549
 		}
2550 2550
 		return $payment;
2551 2551
 	}
@@ -2562,14 +2562,14 @@  discard block
 block discarded – undo
2562 2562
 	public function get_transaction_details_for_gateways() {
2563 2563
 		$txn_details = array();
2564 2564
 		// ya gotta make a choice man
2565
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
2565
+		if (empty($this->checkout->selected_method_of_payment)) {
2566 2566
 			$txn_details = array(
2567
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
2567
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
2568 2568
 			);
2569 2569
 		}
2570 2570
 		// get EE_Payment_Method object
2571 2571
 		if (
2572
-			empty( $txn_details )
2572
+			empty($txn_details)
2573 2573
 			&&
2574 2574
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
2575 2575
 		) {
@@ -2581,8 +2581,8 @@  discard block
 block discarded – undo
2581 2581
 				)
2582 2582
 			);
2583 2583
 		}
2584
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
2585
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
2584
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
2585
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
2586 2586
 			$txn_details = array(
2587 2587
 				'TXN_ID'         => $this->checkout->transaction->ID(),
2588 2588
 				'TXN_timestamp'  => $this->checkout->transaction->datetime(),
@@ -2593,7 +2593,7 @@  discard block
 block discarded – undo
2593 2593
 				'PMD_ID'         => $this->checkout->transaction->payment_method_ID(),
2594 2594
 				'payment_amount' => $this->checkout->amount_owing,
2595 2595
 				'return_url'     => $return_url,
2596
-				'cancel_url'     => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
2596
+				'cancel_url'     => add_query_arg(array('ee_cancel_payment' => true), $return_url),
2597 2597
 				'notify_url'     => EE_Config::instance()->core->txn_page_url(
2598 2598
 					array(
2599 2599
 						'e_reg_url_link'    => $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -2602,7 +2602,7 @@  discard block
 block discarded – undo
2602 2602
 				)
2603 2603
 			);
2604 2604
 		}
2605
-		echo json_encode( $txn_details );
2605
+		echo json_encode($txn_details);
2606 2606
 		exit();
2607 2607
 	}
2608 2608
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_Resource_Manager.lib.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -880,8 +880,8 @@  discard block
 block discarded – undo
880 880
 	 * @return void
881 881
 	 */
882 882
 	public function deactivate_messenger( $messenger_name ) {
883
-        $this->_initialize_collections();
884
-        if ( $messenger_name instanceof EE_messenger ) {
883
+		$this->_initialize_collections();
884
+		if ( $messenger_name instanceof EE_messenger ) {
885 885
 			$messenger_name = $messenger_name->name;
886 886
 		}
887 887
 		unset( $this->_active_messengers[ $messenger_name ] );
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 	 * @param  string $message_type_name name of message type being deactivated
898 898
 	 */
899 899
 	public function deactivate_message_type( $message_type_name ) {
900
-        $this->_initialize_collections();
900
+		$this->_initialize_collections();
901 901
 		if ( $message_type_name instanceof EE_message_type ) {
902 902
 			$message_type_name = $message_type_name->name;
903 903
 		}
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 	 * @param string $messenger_name     Name of messenger the message type is being deactivated for.
928 928
 	 */
929 929
 	public function deactivate_message_type_for_messenger( $message_type_name, $messenger_name ) {
930
-        $this->_initialize_collections();
930
+		$this->_initialize_collections();
931 931
 		if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
932 932
 			unset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] );
933 933
 		}
Please login to merge, or discard this patch.
Spacing   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 
7 7
 
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 	 * @return void
135 135
 	 */
136 136
 	protected function _initialize_collections() {
137
-		if ( $this->_initialized ) {
137
+		if ($this->_initialized) {
138 138
 			return;
139 139
 		}
140 140
 		$this->_initialized = true;
141 141
 		$this->_messenger_collection_loader->load_messengers_from_folder();
142 142
 		$this->_message_type_collection_loader->load_message_types_from_folder();
143
-		$this->get_has_activated_messengers_option( true );
143
+		$this->get_has_activated_messengers_option(true);
144 144
 		$this->_set_active_messengers_and_message_types();
145 145
 	}
146 146
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 * @param string $messenger_name
171 171
 	 * @return \EE_messenger
172 172
 	 */
173
-	public function get_messenger( $messenger_name ) {
174
-		return $this->messenger_collection()->get_by_info( $messenger_name );
173
+	public function get_messenger($messenger_name) {
174
+		return $this->messenger_collection()->get_by_info($messenger_name);
175 175
 	}
176 176
 
177 177
 
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
 	 * @param string $messenger
183 183
 	 * @return EE_messenger | null
184 184
 	 */
185
-	public function get_active_messenger( $messenger ) {
185
+	public function get_active_messenger($messenger) {
186 186
 		$this->_initialize_collections();
187
-		return ! empty( $this->_active_messengers[ $messenger ] ) ? $this->_active_messengers[ $messenger ] : null;
187
+		return ! empty($this->_active_messengers[$messenger]) ? $this->_active_messengers[$messenger] : null;
188 188
 	}
189 189
 
190 190
 
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 	 * @return \EE_messenger[]
194 194
 	 */
195 195
 	public function installed_messengers() {
196
-		if ( empty( $this->_installed_messengers ) ) {
196
+		if (empty($this->_installed_messengers)) {
197 197
 			$this->_installed_messengers = array();
198 198
 			$this->messenger_collection()->rewind();
199
-			while ( $this->messenger_collection()->valid() ) {
200
-				$this->_installed_messengers[ $this->messenger_collection()->current()->name ] = $this->messenger_collection()->current();
199
+			while ($this->messenger_collection()->valid()) {
200
+				$this->_installed_messengers[$this->messenger_collection()->current()->name] = $this->messenger_collection()->current();
201 201
 				$this->messenger_collection()->next();
202 202
 			}
203 203
 		}
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 	 * @return \EE_messenger
212 212
 	 * @throws \EE_Error
213 213
 	 */
214
-	public function valid_messenger( $messenger_name ) {
215
-		$messenger = $this->get_messenger( $messenger_name );
216
-		if ( $messenger instanceof EE_messenger ) {
214
+	public function valid_messenger($messenger_name) {
215
+		$messenger = $this->get_messenger($messenger_name);
216
+		if ($messenger instanceof EE_messenger) {
217 217
 			return $messenger;
218 218
 		}
219 219
 		throw new EE_Error(
220 220
 			sprintf(
221
-				__( 'The "%1$s" messenger is either invalid or not installed', 'event_espresso' ),
221
+				__('The "%1$s" messenger is either invalid or not installed', 'event_espresso'),
222 222
 				$messenger_name
223 223
 			)
224 224
 		);
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 * @param string $message_type_name
251 251
 	 * @return \EE_message_type
252 252
 	 */
253
-	public function get_message_type( $message_type_name ) {
254
-		return $this->message_type_collection()->get_by_info( $message_type_name );
253
+	public function get_message_type($message_type_name) {
254
+		return $this->message_type_collection()->get_by_info($message_type_name);
255 255
 	}
256 256
 
257 257
 
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 	 * @param string $message_type_name
264 264
 	 * @return \EE_message_type|null
265 265
 	 */
266
-	public function get_active_message_type_for_messenger( $messenger_name, $message_type_name ) {
267
-		return $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name )
268
-			? $this->get_message_type( $message_type_name )
266
+	public function get_active_message_type_for_messenger($messenger_name, $message_type_name) {
267
+		return $this->is_message_type_active_for_messenger($messenger_name, $message_type_name)
268
+			? $this->get_message_type($message_type_name)
269 269
 			: null;
270 270
 	}
271 271
 
@@ -279,9 +279,9 @@  discard block
 block discarded – undo
279 279
 	 *
280 280
 	 * @return bool
281 281
 	 */
282
-	public function is_message_type_active_for_messenger( $messenger_name, $message_type_name ) {
282
+	public function is_message_type_active_for_messenger($messenger_name, $message_type_name) {
283 283
 		$this->_initialize_collections();
284
-		return ! empty( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] );
284
+		return ! empty($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]);
285 285
 	}
286 286
 
287 287
 
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 	 * @param string $messenger_name  the name of the messenger to check if active.
293 293
 	 * @return bool
294 294
 	 */
295
-	public function is_messenger_active( $messenger_name ) {
295
+	public function is_messenger_active($messenger_name) {
296 296
 		$this->_initialize_collections();
297
-		return ! empty( $this->_active_message_types[ $messenger_name ] );
297
+		return ! empty($this->_active_message_types[$messenger_name]);
298 298
 	}
299 299
 
300 300
 
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
 	 * @param string $message_type_name  The slug of the message type getting the settings for.
306 306
 	 * @return array
307 307
 	 */
308
-	public function get_message_type_settings_for_messenger( $messenger_name, $message_type_name ) {
308
+	public function get_message_type_settings_for_messenger($messenger_name, $message_type_name) {
309 309
 		$settings = array();
310
-		if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
311
-			$settings =  isset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings'] )
312
-				? $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings']
310
+		if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
311
+			$settings = isset($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings'])
312
+				? $this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings']
313 313
 				: array();
314 314
 		}
315 315
 		return $settings;
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
 	 * @param string $messenger_name
325 325
 	 * @return bool
326 326
 	 */
327
-	public function messenger_has_active_message_types( $messenger_name ) {
327
+	public function messenger_has_active_message_types($messenger_name) {
328 328
 		$this->_initialize_collections();
329 329
 		return
330
-			! empty( $this->_active_message_types[ $messenger_name ] )
331
-			&& ! empty( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ] );
330
+			! empty($this->_active_message_types[$messenger_name])
331
+			&& ! empty($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types']);
332 332
 	}
333 333
 
334 334
 
@@ -341,15 +341,15 @@  discard block
 block discarded – undo
341 341
 	 * @param string $messenger_name The messenger being checked
342 342
 	 * @return EE_message_type[]|array    (empty array if no active_message_types)
343 343
 	 */
344
-	public function get_active_message_types_for_messenger( $messenger_name ) {
344
+	public function get_active_message_types_for_messenger($messenger_name) {
345 345
 		$message_types = array();
346
-		if ( ! $this->messenger_has_active_message_types( $messenger_name ) ) {
346
+		if ( ! $this->messenger_has_active_message_types($messenger_name)) {
347 347
 			return $message_types;
348 348
 		}
349 349
 		$installed_message_types = $this->installed_message_types();
350
-		foreach ( $installed_message_types as $message_type_name => $message_type ) {
351
-			if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
352
-				$message_types[ $message_type_name ] = $message_type;
350
+		foreach ($installed_message_types as $message_type_name => $message_type) {
351
+			if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
352
+				$message_types[$message_type_name] = $message_type;
353 353
 			}
354 354
 		}
355 355
 		return $message_types;
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
 	public function list_of_active_message_types() {
368 368
 		$active_message_type_names = array();
369 369
 		$this->_initialize_collections();
370
-		foreach ( $this->_active_message_types as $messenger => $messenger_settings ) {
371
-			if ( ! isset( $messenger_settings['settings'][ $messenger . '-message_types' ] ) ) {
370
+		foreach ($this->_active_message_types as $messenger => $messenger_settings) {
371
+			if ( ! isset($messenger_settings['settings'][$messenger.'-message_types'])) {
372 372
 				continue;
373 373
 			}
374
-			foreach ( $messenger_settings['settings'][ $messenger . '-message_types' ] as $message_type_name => $message_type_config ) {
375
-				if ( ! in_array( $message_type_name, $active_message_type_names ) ) {
374
+			foreach ($messenger_settings['settings'][$messenger.'-message_types'] as $message_type_name => $message_type_config) {
375
+				if ( ! in_array($message_type_name, $active_message_type_names)) {
376 376
 					$active_message_type_names[] = $message_type_name;
377 377
 				}
378 378
 			}
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 		$active_message_types = array();
393 393
 		$installed_message_types = $this->installed_message_types();
394 394
 		$active_message_type_names = $this->list_of_active_message_types();
395
-		foreach ( $active_message_type_names as $active_message_type_name ) {
396
-			if ( isset( $installed_message_types[ $active_message_type_name ] ) ) {
397
-				$active_message_types[ $active_message_type_name ] = $installed_message_types[ $active_message_type_name ];
395
+		foreach ($active_message_type_names as $active_message_type_name) {
396
+			if (isset($installed_message_types[$active_message_type_name])) {
397
+				$active_message_types[$active_message_type_name] = $installed_message_types[$active_message_type_name];
398 398
 			}
399 399
 		}
400 400
 		return $active_message_types;
@@ -406,10 +406,10 @@  discard block
 block discarded – undo
406 406
 	 * @return \EE_message_type[]
407 407
 	 */
408 408
 	public function installed_message_types() {
409
-		if ( empty( $this->_installed_message_types ) ) {
409
+		if (empty($this->_installed_message_types)) {
410 410
 			$this->message_type_collection()->rewind();
411
-			while ( $this->message_type_collection()->valid() ) {
412
-				$this->_installed_message_types[ $this->message_type_collection()->current()->name ] = $this->message_type_collection()->current();
411
+			while ($this->message_type_collection()->valid()) {
412
+				$this->_installed_message_types[$this->message_type_collection()->current()->name] = $this->message_type_collection()->current();
413 413
 				$this->message_type_collection()->next();
414 414
 			}
415 415
 		}
@@ -422,14 +422,14 @@  discard block
 block discarded – undo
422 422
 	 * @return \EE_message_type
423 423
 	 * @throws \EE_Error
424 424
 	 */
425
-	public function valid_message_type( $message_type_name ) {
426
-		$message_type = $this->get_message_type( $message_type_name );
427
-		if ( $message_type instanceof EE_message_type ) {
425
+	public function valid_message_type($message_type_name) {
426
+		$message_type = $this->get_message_type($message_type_name);
427
+		if ($message_type instanceof EE_message_type) {
428 428
 			return $message_type;
429 429
 		}
430 430
 		throw new EE_Error(
431 431
 			sprintf(
432
-				__( 'The "%1$s" message type is either invalid or not installed', 'event_espresso' ),
432
+				__('The "%1$s" message type is either invalid or not installed', 'event_espresso'),
433 433
 				$message_type_name
434 434
 			)
435 435
 		);
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
 	 * @return boolean
446 446
 	 * @throws \EE_Error
447 447
 	 */
448
-	public function valid_message_type_for_messenger( EE_messenger $messenger, $message_type_name ) {
448
+	public function valid_message_type_for_messenger(EE_messenger $messenger, $message_type_name) {
449 449
 		$valid_message_types = $messenger->get_valid_message_types();
450
-		if ( ! in_array( $message_type_name, $valid_message_types ) ) {
450
+		if ( ! in_array($message_type_name, $valid_message_types)) {
451 451
 			throw new EE_Error(
452 452
 				sprintf(
453 453
 					__(
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * @return array
476 476
 	 */
477
-	public function get_active_messengers_option( $reset = false) {
478
-		if ( $reset ) {
479
-			$this->_active_message_types = get_option( 'ee_active_messengers', array() );
477
+	public function get_active_messengers_option($reset = false) {
478
+		if ($reset) {
479
+			$this->_active_message_types = get_option('ee_active_messengers', array());
480 480
 		}
481 481
 		return $this->_active_message_types;
482 482
 	}
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
 	 *                                 representing this data is used.
491 491
 	 * @return bool FALSE if not updated, TRUE if updated.
492 492
 	 */
493
-	public function update_active_messengers_option( $active_messenger_settings = array() ) {
494
-		$active_messenger_settings = empty( $active_messenger_settings ) ? $this->_active_message_types : $active_messenger_settings;
493
+	public function update_active_messengers_option($active_messenger_settings = array()) {
494
+		$active_messenger_settings = empty($active_messenger_settings) ? $this->_active_message_types : $active_messenger_settings;
495 495
 		//make sure _active_message_types is updated (this is the internal cache for the settings).
496 496
 		$this->_active_message_types = $active_messenger_settings;
497
-		return update_option( 'ee_active_messengers', $active_messenger_settings );
497
+		return update_option('ee_active_messengers', $active_messenger_settings);
498 498
 	}
499 499
 
500 500
 
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 	 *
510 510
 	 * @return array
511 511
 	 */
512
-	public function get_has_activated_messengers_option( $reset = false ) {
513
-		if ( $reset || empty( $this->_has_activated_messengers_and_message_types ) ) {
514
-			$this->_has_activated_messengers_and_message_types = get_option( 'ee_has_activated_messenger', array() );
512
+	public function get_has_activated_messengers_option($reset = false) {
513
+		if ($reset || empty($this->_has_activated_messengers_and_message_types)) {
514
+			$this->_has_activated_messengers_and_message_types = get_option('ee_has_activated_messenger', array());
515 515
 		}
516 516
 		return $this->_has_activated_messengers_and_message_types;
517 517
 	}
@@ -526,15 +526,15 @@  discard block
 block discarded – undo
526 526
 	 *
527 527
 	 * @return bool FALSE if not updated, TRUE if updated.
528 528
 	 */
529
-	public function update_has_activated_messengers_option( $has_activated_messengers = array() ) {
529
+	public function update_has_activated_messengers_option($has_activated_messengers = array()) {
530 530
 		//make sure the option has been retrieved from first so we don't overwrite it accidentally.
531
-		if ( empty( $has_activated_messengers ) && empty( $this->_has_activated_messengers_and_message_types ) ) {
531
+		if (empty($has_activated_messengers) && empty($this->_has_activated_messengers_and_message_types)) {
532 532
 			$this->get_has_activated_messengers_option();
533 533
 		}
534
-		$has_activated_messengers = empty( $has_activated_messengers )
534
+		$has_activated_messengers = empty($has_activated_messengers)
535 535
 			? $this->_has_activated_messengers_and_message_types
536 536
 			: $has_activated_messengers;
537
-		return update_option( 'ee_has_activated_messenger', $has_activated_messengers );
537
+		return update_option('ee_has_activated_messenger', $has_activated_messengers);
538 538
 	}
539 539
 
540 540
 
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
 		//echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() \n";
557 557
 		// list of activated messengers as set via the admin
558 558
 		// note calling `get_active_messengers_options` also initializes the _active_message_types property.
559
-		$this->get_active_messengers_option( true );
560
-		$this->ensure_messengers_are_active( array(), false, true );
559
+		$this->get_active_messengers_option(true);
560
+		$this->ensure_messengers_are_active(array(), false, true);
561 561
 		$this->update_active_messengers_option();
562 562
 		$this->update_has_activated_messengers_option();
563 563
 	}
@@ -575,11 +575,11 @@  discard block
 block discarded – undo
575 575
 	 * @param bool   $update_option  Whether to update the option in the db or not.
576 576
 	 * @return boolean true if either already active or successfully activated.
577 577
 	 */
578
-	public function ensure_messenger_is_active( $messenger_name, $update_option = true ) {
579
-		if ( ! isset( $this->_active_messengers[ $messenger_name ] ) ) {
578
+	public function ensure_messenger_is_active($messenger_name, $update_option = true) {
579
+		if ( ! isset($this->_active_messengers[$messenger_name])) {
580 580
 			try {
581
-				$this->activate_messenger( $messenger_name, array(), $update_option );
582
-			} catch( EE_Error $e ) {
581
+				$this->activate_messenger($messenger_name, array(), $update_option);
582
+			} catch (EE_Error $e) {
583 583
 				EE_Error::add_error(
584 584
 					$e->getMessage(),
585 585
 					__FILE__,
@@ -606,25 +606,25 @@  discard block
 block discarded – undo
606 606
 	 *                                and a messenger is indicated as active, but is NOT installed, then it will automatically be
607 607
 	 *                                deactivated.
608 608
 	 */
609
-	public function ensure_messengers_are_active( $messenger_names = array(), $update_option = true, $verify = false ) {
610
-		$messenger_names = empty( $messenger_names ) ? array_keys( $this->_active_message_types ) : $messenger_names;
609
+	public function ensure_messengers_are_active($messenger_names = array(), $update_option = true, $verify = false) {
610
+		$messenger_names = empty($messenger_names) ? array_keys($this->_active_message_types) : $messenger_names;
611 611
 
612 612
 		$not_installed = array();
613
-		foreach( $messenger_names as $messenger_name ) {
614
-			if ( $verify && ! $this->messenger_collection()->has_by_name( $messenger_name ) ) {
613
+		foreach ($messenger_names as $messenger_name) {
614
+			if ($verify && ! $this->messenger_collection()->has_by_name($messenger_name)) {
615 615
 				$not_installed[] = $messenger_name;
616
-				$this->deactivate_messenger( $messenger_name );
616
+				$this->deactivate_messenger($messenger_name);
617 617
 				continue;
618 618
 			}
619
-			$this->ensure_messenger_is_active( $messenger_name, $update_option );
619
+			$this->ensure_messenger_is_active($messenger_name, $update_option);
620 620
 		}
621 621
 
622
-		if ( ! empty( $not_installed_messenger ) ) {
622
+		if ( ! empty($not_installed_messenger)) {
623 623
 			EE_Error::add_error(
624 624
 				sprintf(
625
-					__( 'The following messengers are either not installed or are invalid:%1$s %2$s', 'event_espresso' ),
625
+					__('The following messengers are either not installed or are invalid:%1$s %2$s', 'event_espresso'),
626 626
 					'<br />',
627
-					implode( ', ', $not_installed_messenger )
627
+					implode(', ', $not_installed_messenger)
628 628
 				),
629 629
 				__FILE__, __FUNCTION__, __LINE__
630 630
 			);
@@ -643,18 +643,18 @@  discard block
 block discarded – undo
643 643
 	 * @return bool  Returns true if already is active or if was activated successfully.
644 644
 	 * @throws \EE_Error
645 645
 	 */
646
-	public function ensure_message_type_is_active( $message_type_name, $messenger_name, $update_option = true ) {
646
+	public function ensure_message_type_is_active($message_type_name, $messenger_name, $update_option = true) {
647 647
 		// grab the messenger to work with.
648
-		$messenger = $this->valid_messenger( $messenger_name );
649
-		if ( $this->valid_message_type_for_messenger( $messenger, $message_type_name ) ) {
648
+		$messenger = $this->valid_messenger($messenger_name);
649
+		if ($this->valid_message_type_for_messenger($messenger, $message_type_name)) {
650 650
 			//ensure messenger is active (that's an inherent coupling between active message types and the
651 651
 			//messenger they are being activated for.
652 652
 			try {
653
-				if ( ! $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
653
+				if ( ! $this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
654 654
 					//all is good so let's just get it active
655
-					$this->activate_messenger( $messenger_name, array( $message_type_name ), $update_option );
655
+					$this->activate_messenger($messenger_name, array($message_type_name), $update_option);
656 656
 				}
657
-			} catch( EE_Error $e ) {
657
+			} catch (EE_Error $e) {
658 658
 				EE_Error::add_error(
659 659
 					$e->getMessage(),
660 660
 					__FILE__,
@@ -678,14 +678,14 @@  discard block
 block discarded – undo
678 678
 	 * @param string $messenger_name      The name of the messenger that the message types are to be activated on.
679 679
 	 * @param bool   $update_option       Whether to persist the activation to the database or not (default true).
680 680
 	 */
681
-	public function ensure_message_types_are_active( $message_type_names, $messenger_name, $update_option = true ) {
681
+	public function ensure_message_types_are_active($message_type_names, $messenger_name, $update_option = true) {
682 682
 		$message_type_names = (array) $message_type_names;
683
-		foreach ( $message_type_names as $message_type_name ) {
683
+		foreach ($message_type_names as $message_type_name) {
684 684
 			// note, intentionally not updating option here because we're in a loop.
685 685
 			// We'll follow the instructions of the incoming $update_option argument after the loop.
686
-			$this->ensure_message_type_is_active( $message_type_name, $messenger_name, false );
686
+			$this->ensure_message_type_is_active($message_type_name, $messenger_name, false);
687 687
 		}
688
-		if ( $update_option ) {
688
+		if ($update_option) {
689 689
 			$this->update_active_messengers_option();
690 690
 			$this->update_has_activated_messengers_option();
691 691
 		}
@@ -712,24 +712,24 @@  discard block
 block discarded – undo
712 712
 	) {
713 713
 		$templates = array();
714 714
 		// grab the messenger to work with.
715
-		$messenger = $this->messenger_collection()->get_by_info( $messenger_name );
715
+		$messenger = $this->messenger_collection()->get_by_info($messenger_name);
716 716
 		// it's inactive. Activate it.
717
-		if ( $messenger instanceof EE_messenger ) {
718
-			$this->_active_messengers[ $messenger->name ] = $messenger;
717
+		if ($messenger instanceof EE_messenger) {
718
+			$this->_active_messengers[$messenger->name] = $messenger;
719 719
 			//activate incoming message types set to be activated with messenger.
720
-			$message_type_names = $this->_activate_message_types( $messenger, $message_type_names );
720
+			$message_type_names = $this->_activate_message_types($messenger, $message_type_names);
721 721
 			// setup any initial settings for the messenger if necessary.
722
-			$this->add_settings_for_messenger( $messenger->name );
723
-			if ( $update_active_messengers_option ) {
722
+			$this->add_settings_for_messenger($messenger->name);
723
+			if ($update_active_messengers_option) {
724 724
 				$this->update_active_messengers_option();
725 725
 				$this->update_has_activated_messengers_option();
726 726
 			}
727 727
 			//generate new templates if necessary and ensure all related templates that are already in the database are
728 728
 			//marked active.  Note, this will also deactivate a message type for a messenger if the template
729 729
 			//cannot be successfully created during its attempt (only happens for global template attempts).
730
-			if ( ! empty( $message_type_names ) ) {
731
-				$templates = EEH_MSG_Template::generate_new_templates( $messenger->name, $message_type_names, 0, true );
732
-				EEH_MSG_Template::update_to_active( array( $messenger->name ), $message_type_names );
730
+			if ( ! empty($message_type_names)) {
731
+				$templates = EEH_MSG_Template::generate_new_templates($messenger->name, $message_type_names, 0, true);
732
+				EEH_MSG_Template::update_to_active(array($messenger->name), $message_type_names);
733 733
 			}
734 734
 		}
735 735
 		return $templates;
@@ -748,29 +748,29 @@  discard block
 block discarded – undo
748 748
 	 *
749 749
 	 * @return array
750 750
 	 */
751
-	protected function _activate_message_types( EE_messenger $messenger, $message_type_names = array() ) {
751
+	protected function _activate_message_types(EE_messenger $messenger, $message_type_names = array()) {
752 752
 		//If $message_type_names is empty, AND $this->_active_message_types is empty, then that means
753 753
 		//things have never been initialized (which should happen on EEH_Activation::generate_message_templates).
754 754
 		//So ONLY then do we need to actually grab defaults and cycle through them.  Otherwise we
755 755
 		//only override _active_message_types when an explicit array of $message_type_names has been provided.
756
-		$message_type_names = empty( $message_type_names ) && ! isset( $this->_active_message_types[ $messenger->name ] )
756
+		$message_type_names = empty($message_type_names) && ! isset($this->_active_message_types[$messenger->name])
757 757
 			? $messenger->get_default_message_types()
758 758
 			: (array) $message_type_names;
759 759
 
760 760
 		//now we ALWAYS need to make sure that the messenger is active for the message types we're activating!
761
-		if ( ! isset( $this->_active_message_types[ $messenger->name ] ) ) {
762
-			$this->_active_message_types[ $messenger->name ]['settings'] = array();
761
+		if ( ! isset($this->_active_message_types[$messenger->name])) {
762
+			$this->_active_message_types[$messenger->name]['settings'] = array();
763 763
 		}
764 764
 
765
-		if ( $message_type_names ) {
765
+		if ($message_type_names) {
766 766
 			// cycle thru message types
767
-			foreach ( $message_type_names as $message_type_name ) {
767
+			foreach ($message_type_names as $message_type_name) {
768 768
 				//only register the message type as active IF it isn't already active
769 769
 				//and if its actually installed.
770 770
 				if (
771
-					! $this->is_message_type_active_for_messenger( $messenger->name, $message_type_name )
771
+					! $this->is_message_type_active_for_messenger($messenger->name, $message_type_name)
772 772
 				) {
773
-					$this->add_settings_for_message_type( $messenger->name, $message_type_name );
773
+					$this->add_settings_for_message_type($messenger->name, $message_type_name);
774 774
 					$this->_set_messenger_has_activated_message_type(
775 775
 						$messenger,
776 776
 						$message_type_name
@@ -793,24 +793,24 @@  discard block
 block discarded – undo
793 793
 	 * @param  string       $message_type_name The name of the message type adding the settings for
794 794
 	 * @param  array        $new_settings     Any new settings being set for the message type and messenger
795 795
 	 */
796
-	public function add_settings_for_message_type( $messenger_name, $message_type_name, $new_settings = array() ) {
796
+	public function add_settings_for_message_type($messenger_name, $message_type_name, $new_settings = array()) {
797 797
 		// get installed message type from collection
798
-		$message_type = $this->message_type_collection()->get_by_info( $message_type_name );
799
-		$existing_settings = $this->get_message_type_settings_for_messenger( $messenger_name, $message_type_name );
798
+		$message_type = $this->message_type_collection()->get_by_info($message_type_name);
799
+		$existing_settings = $this->get_message_type_settings_for_messenger($messenger_name, $message_type_name);
800 800
 		//we need to setup any initial settings for message types
801
-		if ( $message_type instanceof EE_message_type ) {
801
+		if ($message_type instanceof EE_message_type) {
802 802
 			$default_settings = $message_type->get_admin_settings_fields();
803
-			foreach ( $default_settings as $field => $values ) {
804
-				if ( isset( $new_settings[ $field ] ) ) {
805
-					$existing_settings[ $field ] = $new_settings[ $field ];
803
+			foreach ($default_settings as $field => $values) {
804
+				if (isset($new_settings[$field])) {
805
+					$existing_settings[$field] = $new_settings[$field];
806 806
 					continue;
807 807
 				}
808
-				if ( ! isset( $existing_settings[ $field ] ) ) {
809
-					$existing_settings[ $field ] = $values['default'];
808
+				if ( ! isset($existing_settings[$field])) {
809
+					$existing_settings[$field] = $values['default'];
810 810
 				}
811 811
 			}
812 812
 		}
813
-		$this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings'] = $existing_settings;
813
+		$this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings'] = $existing_settings;
814 814
 	}
815 815
 
816 816
 
@@ -823,20 +823,20 @@  discard block
 block discarded – undo
823 823
 	 * @param \EE_messenger $messenger
824 824
 	 * @param string        $message_type_name
825 825
 	 */
826
-	protected function _set_messenger_has_activated_message_type( EE_messenger $messenger, $message_type_name ) {
826
+	protected function _set_messenger_has_activated_message_type(EE_messenger $messenger, $message_type_name) {
827 827
 
828 828
 		//if _has_activated_messengers_and_message_types is empty then lets ensure its initialized
829
-		if ( empty( $this->_has_activated_messengers_and_message_types ) ) {
829
+		if (empty($this->_has_activated_messengers_and_message_types)) {
830 830
 			$this->get_has_activated_messengers_option();
831 831
 		}
832 832
 
833 833
 		// make sure this messenger has a record in the has_activated array
834
-		if ( ! isset( $this->_has_activated_messengers_and_message_types[ $messenger->name ] ) ) {
835
-			$this->_has_activated_messengers_and_message_types[ $messenger->name ] = array();
834
+		if ( ! isset($this->_has_activated_messengers_and_message_types[$messenger->name])) {
835
+			$this->_has_activated_messengers_and_message_types[$messenger->name] = array();
836 836
 		}
837 837
 		// check if message type has already been added
838
-		if ( ! in_array( $message_type_name, $this->_has_activated_messengers_and_message_types[ $messenger->name ] ) ) {
839
-			$this->_has_activated_messengers_and_message_types[ $messenger->name ][] = $message_type_name;
838
+		if ( ! in_array($message_type_name, $this->_has_activated_messengers_and_message_types[$messenger->name])) {
839
+			$this->_has_activated_messengers_and_message_types[$messenger->name][] = $message_type_name;
840 840
 		}
841 841
 	}
842 842
 
@@ -851,20 +851,20 @@  discard block
 block discarded – undo
851 851
 	 * @param string        $messenger_name The name of the messenger the settings is being added for.
852 852
 	 * @param array         $new_settings   An array of settings to update the existing settings.
853 853
 	 */
854
-	public function add_settings_for_messenger( $messenger_name, $new_settings = array() ) {
855
-		$messenger = $this->get_messenger( $messenger_name );
856
-		if ( $messenger instanceof EE_messenger ) {
854
+	public function add_settings_for_messenger($messenger_name, $new_settings = array()) {
855
+		$messenger = $this->get_messenger($messenger_name);
856
+		if ($messenger instanceof EE_messenger) {
857 857
 			$msgr_settings = $messenger->get_admin_settings_fields();
858
-			if ( ! empty( $msgr_settings ) ) {
859
-				foreach ( $msgr_settings as $field => $value ) {
858
+			if ( ! empty($msgr_settings)) {
859
+				foreach ($msgr_settings as $field => $value) {
860 860
 					//is there a new setting for this?
861
-					if ( isset( $new_settings[ $field ] ) ) {
862
-						$this->_active_message_types[ $messenger->name ]['settings'][ $field ] = $new_settings[ $field ];
861
+					if (isset($new_settings[$field])) {
862
+						$this->_active_message_types[$messenger->name]['settings'][$field] = $new_settings[$field];
863 863
 						continue;
864 864
 					}
865 865
 					//only set the default if it isn't already set.
866
-					if ( ! isset( $this->_active_message_types[ $messenger->name ]['settings'][ $field ] ) ) {
867
-						$this->_active_message_types[ $messenger->name ]['settings'][ $field ] = $value;
866
+					if ( ! isset($this->_active_message_types[$messenger->name]['settings'][$field])) {
867
+						$this->_active_message_types[$messenger->name]['settings'][$field] = $value;
868 868
 					}
869 869
 				}
870 870
 			}
@@ -879,14 +879,14 @@  discard block
 block discarded – undo
879 879
 	 * @param  string|EE_messenger $messenger_name name of messenger
880 880
 	 * @return void
881 881
 	 */
882
-	public function deactivate_messenger( $messenger_name ) {
882
+	public function deactivate_messenger($messenger_name) {
883 883
         $this->_initialize_collections();
884
-        if ( $messenger_name instanceof EE_messenger ) {
884
+        if ($messenger_name instanceof EE_messenger) {
885 885
 			$messenger_name = $messenger_name->name;
886 886
 		}
887
-		unset( $this->_active_messengers[ $messenger_name ] );
888
-		unset( $this->_active_message_types[ $messenger_name ] );
889
-		$this->_message_template_group_model->deactivate_message_template_groups_for( $messenger_name );
887
+		unset($this->_active_messengers[$messenger_name]);
888
+		unset($this->_active_message_types[$messenger_name]);
889
+		$this->_message_template_group_model->deactivate_message_template_groups_for($messenger_name);
890 890
 		$this->update_active_messengers_option();
891 891
 	}
892 892
 
@@ -896,22 +896,22 @@  discard block
 block discarded – undo
896 896
 	 *
897 897
 	 * @param  string $message_type_name name of message type being deactivated
898 898
 	 */
899
-	public function deactivate_message_type( $message_type_name ) {
899
+	public function deactivate_message_type($message_type_name) {
900 900
         $this->_initialize_collections();
901
-		if ( $message_type_name instanceof EE_message_type ) {
901
+		if ($message_type_name instanceof EE_message_type) {
902 902
 			$message_type_name = $message_type_name->name;
903 903
 		}
904
-		foreach ( $this->_active_message_types as $messenger_name => $settings ) {
904
+		foreach ($this->_active_message_types as $messenger_name => $settings) {
905 905
 			unset(
906
-				$this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]
906
+				$this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]
907 907
 			);
908 908
 
909 909
 			//we always record (even on deactivation) that a message type has been activated because there should at
910 910
 			//least be a record in the "has_activated" option that it WAS active at one point.
911
-			$messenger = $this->get_messenger( $messenger_name );
912
-			$this->_set_messenger_has_activated_message_type( $messenger, $message_type_name );
911
+			$messenger = $this->get_messenger($messenger_name);
912
+			$this->_set_messenger_has_activated_message_type($messenger, $message_type_name);
913 913
 		}
914
-		$this->_message_template_group_model->deactivate_message_template_groups_for( '', $message_type_name );
914
+		$this->_message_template_group_model->deactivate_message_template_groups_for('', $message_type_name);
915 915
 		$this->update_active_messengers_option();
916 916
 		$this->update_has_activated_messengers_option();
917 917
 	}
@@ -926,12 +926,12 @@  discard block
 block discarded – undo
926 926
 	 * @param string $message_type_name  Name of message type being deactivated.
927 927
 	 * @param string $messenger_name     Name of messenger the message type is being deactivated for.
928 928
 	 */
929
-	public function deactivate_message_type_for_messenger( $message_type_name, $messenger_name ) {
929
+	public function deactivate_message_type_for_messenger($message_type_name, $messenger_name) {
930 930
         $this->_initialize_collections();
931
-		if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
932
-			unset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] );
931
+		if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
932
+			unset($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]);
933 933
 		}
934
-		$this->_message_template_group_model->deactivate_message_template_groups_for( array( $messenger_name ), array( $message_type_name ) );
934
+		$this->_message_template_group_model->deactivate_message_template_groups_for(array($messenger_name), array($message_type_name));
935 935
 		$this->update_active_messengers_option();
936 936
 	}
937 937
 
@@ -948,12 +948,12 @@  discard block
 block discarded – undo
948 948
 	 *
949 949
 	 * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send.
950 950
 	 */
951
-	public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) {
951
+	public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) {
952 952
 		//get the $messengers the message type says it can be used with.
953
-		foreach ( $message_type->with_messengers() as $generating_messenger => $secondary_messengers ) {
953
+		foreach ($message_type->with_messengers() as $generating_messenger => $secondary_messengers) {
954 954
 			if (
955 955
 				$messenger->name === $generating_messenger
956
-				&& $this->is_message_type_active_for_messenger( $messenger->name, $message_type->name )
956
+				&& $this->is_message_type_active_for_messenger($messenger->name, $message_type->name)
957 957
 			) {
958 958
 				return true;
959 959
 			}
@@ -990,25 +990,25 @@  discard block
 block discarded – undo
990 990
 	 *                           or all contexts indexed by message type.
991 991
 	 * @return array
992 992
 	 */
993
-	public function get_all_contexts( $slugs_only = true ) {
993
+	public function get_all_contexts($slugs_only = true) {
994 994
 		$key = $slugs_only ? 'slugs' : 'all';
995 995
 		// check if contexts has been setup yet.
996
-		if ( empty( $this->_contexts[ $key ] ) ) {
996
+		if (empty($this->_contexts[$key])) {
997 997
 			// So let's get all active message type objects and loop through to get all unique contexts
998
-			foreach ( $this->get_active_message_type_objects() as $message_type ) {
999
-				if ( $message_type instanceof EE_message_type ) {
998
+			foreach ($this->get_active_message_type_objects() as $message_type) {
999
+				if ($message_type instanceof EE_message_type) {
1000 1000
 					$message_type_contexts = $message_type->get_contexts();
1001
-					if ( $slugs_only ) {
1002
-						foreach ( $message_type_contexts as $context => $context_details ) {
1003
-							$this->_contexts[ $key ][ $context ] = $context_details[ 'label' ];
1001
+					if ($slugs_only) {
1002
+						foreach ($message_type_contexts as $context => $context_details) {
1003
+							$this->_contexts[$key][$context] = $context_details['label'];
1004 1004
 						}
1005 1005
 					} else {
1006
-						$this->_contexts[ $key ][ $message_type->name ] = $message_type_contexts;
1006
+						$this->_contexts[$key][$message_type->name] = $message_type_contexts;
1007 1007
 					}
1008 1008
 				}
1009 1009
 			}
1010 1010
 		}
1011
-		return ! empty( $this->_contexts[ $key ] ) ? $this->_contexts[ $key ] : array();
1011
+		return ! empty($this->_contexts[$key]) ? $this->_contexts[$key] : array();
1012 1012
 	}
1013 1013
 
1014 1014
 
@@ -1027,9 +1027,9 @@  discard block
 block discarded – undo
1027 1027
 		$installed_message_types = $this->installed_message_types();
1028 1028
 		$all_message_types_valid = true;
1029 1029
 		//loop through list of active message types and verify they are installed.
1030
-		foreach( $list_of_active_message_type_names as $message_type_name ) {
1031
-			if ( ! isset( $installed_message_types[$message_type_name] ) ) {
1032
-				$this->deactivate_message_type( $message_type_name );
1030
+		foreach ($list_of_active_message_type_names as $message_type_name) {
1031
+			if ( ! isset($installed_message_types[$message_type_name])) {
1032
+				$this->deactivate_message_type($message_type_name);
1033 1033
 				$all_message_types_valid = false;
1034 1034
 			}
1035 1035
 		}
@@ -1048,10 +1048,10 @@  discard block
 block discarded – undo
1048 1048
 	 * @param $messenger_name
1049 1049
 	 * @return bool
1050 1050
 	 */
1051
-	public function has_message_type_been_activated_for_messenger( $message_type_name, $messenger_name ) {
1051
+	public function has_message_type_been_activated_for_messenger($message_type_name, $messenger_name) {
1052 1052
 		$has_activated = $this->get_has_activated_messengers_option();
1053
-		return isset( $has_activated[ $messenger_name ] )
1054
-			&& in_array( $message_type_name, $has_activated[ $messenger_name ] );
1053
+		return isset($has_activated[$messenger_name])
1054
+			&& in_array($message_type_name, $has_activated[$messenger_name]);
1055 1055
 	}
1056 1056
 }
1057 1057
 // End of file EE_Message_Resource_Manager.lib.php
Please login to merge, or discard this patch.