Completed
Branch BUG-9548-transaction-completio... (df8e55)
by
unknown
542:39 queued 526:55
created
core/db_classes/EE_Transaction.class.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
 	exit( 'No direct script access allowed' );
3 3
 }
4 4
 /**
5
- * EE_Transaction class
6
- *
7
- * @package     Event Espresso
8
- * @subpackage 	includes/classes/EE_Transaction.class.php
9
- * @author      Brent Christensen
10
- */
5
+	 * EE_Transaction class
6
+	 *
7
+	 * @package     Event Espresso
8
+	 * @subpackage 	includes/classes/EE_Transaction.class.php
9
+	 * @author      Brent Christensen
10
+	 */
11 11
 class EE_Transaction extends EE_Base_Class implements EEI_Transaction {
12 12
 
13 13
 	/**
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * Gets all the attendees for this transaction (handy for use with EE_Attendee's get_registrations_for_event function
413 413
 	 * for getting attendees and how many registrations they each have for an event)
414 414
 	 *
415
-	 * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT'
415
+	 * @return EE_Base_Class[] EE_Attendee[] by default, int if $output is set to 'COUNT'
416 416
 	 * @throws \EE_Error
417 417
 	 */
418 418
 	public function attendees() {
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 * Gets all the extra meta info on this payment
694 694
 	 *
695 695
 	 * @param array $query_params like EEM_Base::get_all
696
-	 * @return EE_Extra_Meta
696
+	 * @return EE_Base_Class[]
697 697
 	 * @throws \EE_Error
698 698
 	 */
699 699
 	public function extra_meta( $query_params = array() ) {
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 	 * Sets PMD_ID
871 871
 	 *
872 872
 	 * @param int $PMD_ID
873
-	 * @return boolean
873
+	 * @return boolean|null
874 874
 	 * @throws \EE_Error
875 875
 	 */
876 876
 	public function set_payment_method_ID($PMD_ID) {
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 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
  * EE_Transaction class
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 	 * @return EE_Transaction
26 26
 	 * @throws \EE_Error
27 27
 	 */
28
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
29
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
28
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
29
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
30 30
 		return $has_object
31 31
 			? $has_object
32
-			: new self( $props_n_values, false, $timezone, $date_formats );
32
+			: new self($props_n_values, false, $timezone, $date_formats);
33 33
 	}
34 34
 
35 35
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	 * @return EE_Transaction
42 42
 	 * @throws \EE_Error
43 43
 	 */
44
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
45
-		return new self( $props_n_values, TRUE, $timezone );
44
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
45
+		return new self($props_n_values, TRUE, $timezone);
46 46
 	}
47 47
 
48 48
 
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function lock() {
60 60
 		// attempt to set lock, but if that fails...
61
-		if ( ! $this->add_extra_meta( 'lock', time(), true )  ) {
61
+		if ( ! $this->add_extra_meta('lock', time(), true)) {
62 62
 			// then attempt to remove the lock in case it is expired
63
-			if ( $this->_remove_expired_lock() ) {
63
+			if ($this->_remove_expired_lock()) {
64 64
 				// if removal was successful, then try setting lock again
65 65
 				$this->lock();
66 66
 			} else {
67 67
 				// but if the lock can not be removed, then throw an exception
68 68
 				throw new EE_Error(
69 69
 					sprintf(
70
-						__( 'Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso' ),
70
+						__('Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso'),
71 71
 						$this->ID()
72 72
 					)
73 73
 				);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @throws \EE_Error
87 87
 	 */
88 88
 	public function unlock() {
89
-		return $this->delete_extra_meta( 'lock' );
89
+		return $this->delete_extra_meta('lock');
90 90
 	}
91 91
 
92 92
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function is_locked() {
109 109
 		// if TXN is not locked, then return false immediately
110
-		if ( ! $this->_get_lock() ) {
110
+		if ( ! $this->_get_lock()) {
111 111
 			return false;
112 112
 		}
113 113
 		// if not, then let's try and remove the lock in case it's expired...
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @throws \EE_Error
129 129
 	 */
130 130
 	protected function _get_lock() {
131
-		return (int)$this->get_extra_meta( 'lock', true, 0 );
131
+		return (int) $this->get_extra_meta('lock', true, 0);
132 132
 	}
133 133
 
134 134
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	protected function _remove_expired_lock() {
145 145
 		$locked = $this->_get_lock();
146
-		if ( $locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked ) {
146
+		if ($locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked) {
147 147
 			return $this->unlock();
148 148
 		}
149 149
 		return 0;
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 * @param        float $total total value of transaction
159 159
 	 * @throws \EE_Error
160 160
 	 */
161
-	public function set_total( $total = 0.00 ) {
162
-		$this->set( 'TXN_total', (float)$total );
161
+	public function set_total($total = 0.00) {
162
+		$this->set('TXN_total', (float) $total);
163 163
 	}
164 164
 
165 165
 
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @param        float $total_paid total amount paid to date (sum of all payments)
172 172
 	 * @throws \EE_Error
173 173
 	 */
174
-	public function set_paid( $total_paid = 0.00 ) {
175
-		$this->set( 'TXN_paid', (float)$total_paid );
174
+	public function set_paid($total_paid = 0.00) {
175
+		$this->set('TXN_paid', (float) $total_paid);
176 176
 	}
177 177
 
178 178
 
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 	 * @param        string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set
185 185
 	 * @throws \EE_Error
186 186
 	 */
187
-	public function set_status( $status = '' ) {
188
-		$this->set( 'STS_ID', $status );
187
+	public function set_status($status = '') {
188
+		$this->set('STS_ID', $status);
189 189
 	}
190 190
 
191 191
 
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 	 * @param        string $hash_salt required for some payment gateways
198 198
 	 * @throws \EE_Error
199 199
 	 */
200
-	public function set_hash_salt( $hash_salt = '' ) {
201
-		$this->set( 'TXN_hash_salt', $hash_salt );
200
+	public function set_hash_salt($hash_salt = '') {
201
+		$this->set('TXN_hash_salt', $hash_salt);
202 202
 	}
203 203
 
204 204
 
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 	 * @param array $txn_reg_steps
210 210
 	 * @throws \EE_Error
211 211
 	 */
212
-	public function set_reg_steps( array $txn_reg_steps ) {
213
-		$this->set( 'TXN_reg_steps', $txn_reg_steps );
212
+	public function set_reg_steps(array $txn_reg_steps) {
213
+		$this->set('TXN_reg_steps', $txn_reg_steps);
214 214
 	}
215 215
 
216 216
 
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 	 * @throws \EE_Error
223 223
 	 */
224 224
 	public function reg_steps() {
225
-		$TXN_reg_steps = $this->get( 'TXN_reg_steps' );
226
-		return is_array( $TXN_reg_steps ) ? (array)$TXN_reg_steps : array();
225
+		$TXN_reg_steps = $this->get('TXN_reg_steps');
226
+		return is_array($TXN_reg_steps) ? (array) $TXN_reg_steps : array();
227 227
 	}
228 228
 
229 229
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 * @throws \EE_Error
234 234
 	 */
235 235
 	public function pretty_total() {
236
-		return $this->get_pretty( 'TXN_total' );
236
+		return $this->get_pretty('TXN_total');
237 237
 	}
238 238
 
239 239
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @throws \EE_Error
246 246
 	 */
247 247
 	public function pretty_paid() {
248
-		return $this->get_pretty( 'TXN_paid' );
248
+		return $this->get_pretty('TXN_paid');
249 249
 	}
250 250
 
251 251
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 * @throws \EE_Error
259 259
 	 */
260 260
 	public function remaining() {
261
-		return (float)( $this->total() - $this->paid() );
261
+		return (float) ($this->total() - $this->paid());
262 262
 	}
263 263
 
264 264
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @throws \EE_Error
272 272
 	 */
273 273
 	public function total() {
274
-		return (float)$this->get( 'TXN_total' );
274
+		return (float) $this->get('TXN_total');
275 275
 	}
276 276
 
277 277
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 * @throws \EE_Error
285 285
 	 */
286 286
 	public function paid() {
287
-		return (float)$this->get( 'TXN_paid' );
287
+		return (float) $this->get('TXN_paid');
288 288
 	}
289 289
 
290 290
 
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
 	 * @throws \EE_Error
297 297
 	 */
298 298
 	public function get_cart_session() {
299
-		$session_data = (array)$this->get( 'TXN_session_data' );
300
-		return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart
301
-			? $session_data[ 'cart' ]
299
+		$session_data = (array) $this->get('TXN_session_data');
300
+		return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart
301
+			? $session_data['cart']
302 302
 			: null;
303 303
 	}
304 304
 
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
 	 * @throws \EE_Error
312 312
 	 */
313 313
 	public function session_data() {
314
-		$session_data = $this->get( 'TXN_session_data' );
315
-		if ( empty( $session_data ) ) {
314
+		$session_data = $this->get('TXN_session_data');
315
+		if (empty($session_data)) {
316 316
 			$session_data = array(
317 317
 				'id'            => null,
318 318
 				'user_id'       => null,
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 	 * @param        EE_Session|array $session_data
336 336
 	 * @throws \EE_Error
337 337
 	 */
338
-	public function set_txn_session_data( $session_data ) {
339
-		if ( $session_data instanceof EE_Session ) {
340
-			$this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE ));
338
+	public function set_txn_session_data($session_data) {
339
+		if ($session_data instanceof EE_Session) {
340
+			$this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE));
341 341
 		} else {
342
-			$this->set( 'TXN_session_data', $session_data );
342
+			$this->set('TXN_session_data', $session_data);
343 343
 		}
344 344
 	}
345 345
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 * @throws \EE_Error
353 353
 	 */
354 354
 	public function hash_salt_() {
355
-		return $this->get( 'TXN_hash_salt' );
355
+		return $this->get('TXN_hash_salt');
356 356
 	}
357 357
 
358 358
 
@@ -372,13 +372,13 @@  discard block
 block discarded – undo
372 372
 	 * @return    string | int
373 373
 	 * @throws \EE_Error
374 374
 	 */
375
-	public function datetime( $format = FALSE, $gmt = FALSE ) {
376
-		if ( $format ) {
377
-			return $this->get_pretty( 'TXN_timestamp' );
378
-		} else if ( $gmt ) {
379
-			return $this->get_raw( 'TXN_timestamp' );
375
+	public function datetime($format = FALSE, $gmt = FALSE) {
376
+		if ($format) {
377
+			return $this->get_pretty('TXN_timestamp');
378
+		} else if ($gmt) {
379
+			return $this->get_raw('TXN_timestamp');
380 380
 		} else {
381
-			return $this->get( 'TXN_timestamp' );
381
+			return $this->get('TXN_timestamp');
382 382
 		}
383 383
 	}
384 384
 
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
 	 * @return EE_Registration[]
393 393
 	 * @throws \EE_Error
394 394
 	 */
395
-	public function registrations( $query_params = array(), $get_cached = FALSE ) {
396
-		$query_params = ( empty( $query_params ) || ! is_array( $query_params ) )
395
+	public function registrations($query_params = array(), $get_cached = FALSE) {
396
+		$query_params = (empty($query_params) || ! is_array($query_params))
397 397
 			? array(
398 398
 				'order_by' => array(
399 399
 					'Event.EVT_name' => 'ASC',
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 			)
404 404
 			: $query_params;
405 405
 		$query_params = $get_cached ? array() : $query_params;
406
-		return $this->get_many_related( 'Registration', $query_params );
406
+		return $this->get_many_related('Registration', $query_params);
407 407
 	}
408 408
 
409 409
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 * @throws \EE_Error
417 417
 	 */
418 418
 	public function attendees() {
419
-		return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) );
419
+		return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID())));
420 420
 	}
421 421
 
422 422
 
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 	 * @return EE_Payment[]
429 429
 	 * @throws \EE_Error
430 430
 	 */
431
-	public function payments( $query_params = array() ) {
432
-		return $this->get_many_related( 'Payment', $query_params );
431
+	public function payments($query_params = array()) {
432
+		return $this->get_many_related('Payment', $query_params);
433 433
 	}
434 434
 
435 435
 
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 	 * @throws \EE_Error
442 442
 	 */
443 443
 	public function approved_payments() {
444
-		EE_Registry::instance()->load_model( 'Payment' );
445
-		return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) );
444
+		EE_Registry::instance()->load_model('Payment');
445
+		return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC')));
446 446
 	}
447 447
 
448 448
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 * @return string
455 455
 	 * @throws \EE_Error
456 456
 	 */
457
-	public function e_pretty_status( $show_icons = FALSE ) {
458
-		echo $this->pretty_status( $show_icons );
457
+	public function e_pretty_status($show_icons = FALSE) {
458
+		echo $this->pretty_status($show_icons);
459 459
 	}
460 460
 
461 461
 
@@ -467,10 +467,10 @@  discard block
 block discarded – undo
467 467
 	 * @return string
468 468
 	 * @throws \EE_Error
469 469
 	 */
470
-	public function pretty_status( $show_icons = FALSE ) {
471
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
470
+	public function pretty_status($show_icons = FALSE) {
471
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
472 472
 		$icon = '';
473
-		switch ( $this->status_ID() ) {
473
+		switch ($this->status_ID()) {
474 474
 			case EEM_Transaction::complete_status_code:
475 475
 				$icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : '';
476 476
 				break;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 				$icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : '';
488 488
 				break;
489 489
 		}
490
-		return $icon . $status[ $this->status_ID() ];
490
+		return $icon.$status[$this->status_ID()];
491 491
 	}
492 492
 
493 493
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	 * @throws \EE_Error
500 500
 	 */
501 501
 	public function status_ID() {
502
-		return $this->get( 'STS_ID' );
502
+		return $this->get('STS_ID');
503 503
 	}
504 504
 
505 505
 
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	 * @throws \EE_Error
512 512
 	 */
513 513
 	public function is_free() {
514
-		return (float)$this->get( 'TXN_total' ) === (float)0 ? TRUE : FALSE;
514
+		return (float) $this->get('TXN_total') === (float) 0 ? TRUE : FALSE;
515 515
 	}
516 516
 
517 517
 
@@ -591,12 +591,12 @@  discard block
 block discarded – undo
591 591
 	 * @return string
592 592
 	 * @throws \EE_Error
593 593
 	 */
594
-	public function invoice_url( $type = 'html' ) {
594
+	public function invoice_url($type = 'html') {
595 595
 		$REG = $this->primary_registration();
596
-		if ( ! $REG instanceof EE_Registration ) {
596
+		if ( ! $REG instanceof EE_Registration) {
597 597
 			return '';
598 598
 		}
599
-		return $REG->invoice_url( $type );
599
+		return $REG->invoice_url($type);
600 600
 	}
601 601
 
602 602
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 * @throws \EE_Error
609 609
 	 */
610 610
 	public function primary_registration() {
611
-		return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) );
611
+		return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
612 612
 	}
613 613
 
614 614
 
@@ -620,12 +620,12 @@  discard block
 block discarded – undo
620 620
 	 * @return string
621 621
 	 * @throws \EE_Error
622 622
 	 */
623
-	public function receipt_url( $type = 'html' ) {
623
+	public function receipt_url($type = 'html') {
624 624
 		$REG = $this->primary_registration();
625
-		if ( ! $REG instanceof EE_Registration ) {
625
+		if ( ! $REG instanceof EE_Registration) {
626 626
 			return '';
627 627
 		}
628
-		return $REG->receipt_url( $type );
628
+		return $REG->receipt_url($type);
629 629
 	}
630 630
 
631 631
 
@@ -653,15 +653,15 @@  discard block
 block discarded – undo
653 653
 	 * @return boolean
654 654
 	 * @throws \EE_Error
655 655
 	 */
656
-	public function update_based_on_payments(){
656
+	public function update_based_on_payments() {
657 657
 		EE_Error::doing_it_wrong(
658
-			__CLASS__ . '::' . __FUNCTION__,
659
-			sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ),
658
+			__CLASS__.'::'.__FUNCTION__,
659
+			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
660 660
 			'4.6.0'
661 661
 		);
662 662
 		/** @type EE_Transaction_Processor $transaction_processor */
663
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
664
-		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this );
663
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
664
+		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this);
665 665
 	}
666 666
 
667 667
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	 * @throws \EE_Error
672 672
 	 */
673 673
 	public function gateway_response_on_transaction() {
674
-		$payment = $this->get_first_related( 'Payment' );
674
+		$payment = $this->get_first_related('Payment');
675 675
 		return $payment instanceof EE_Payment ? $payment->gateway_response() : '';
676 676
 	}
677 677
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 	 * @throws \EE_Error
685 685
 	 */
686 686
 	public function status_obj() {
687
-		return $this->get_first_related( 'Status' );
687
+		return $this->get_first_related('Status');
688 688
 	}
689 689
 
690 690
 
@@ -696,8 +696,8 @@  discard block
 block discarded – undo
696 696
 	 * @return EE_Extra_Meta
697 697
 	 * @throws \EE_Error
698 698
 	 */
699
-	public function extra_meta( $query_params = array() ) {
700
-		return $this->get_many_related( 'Extra_Meta', $query_params );
699
+	public function extra_meta($query_params = array()) {
700
+		return $this->get_many_related('Extra_Meta', $query_params);
701 701
 	}
702 702
 
703 703
 
@@ -709,8 +709,8 @@  discard block
 block discarded – undo
709 709
 	 * @return EE_Base_Class the relation was added to
710 710
 	 * @throws \EE_Error
711 711
 	 */
712
-	public function add_registration( EE_Registration $registration ) {
713
-		return $this->_add_relation_to( $registration, 'Registration' );
712
+	public function add_registration(EE_Registration $registration) {
713
+		return $this->_add_relation_to($registration, 'Registration');
714 714
 	}
715 715
 
716 716
 
@@ -723,8 +723,8 @@  discard block
 block discarded – undo
723 723
 	 * @return EE_Base_Class that was removed from being related
724 724
 	 * @throws \EE_Error
725 725
 	 */
726
-	public function remove_registration_with_id( $registration_or_id ) {
727
-		return $this->_remove_relation_to( $registration_or_id, 'Registration' );
726
+	public function remove_registration_with_id($registration_or_id) {
727
+		return $this->_remove_relation_to($registration_or_id, 'Registration');
728 728
 	}
729 729
 
730 730
 
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 	 * @throws \EE_Error
737 737
 	 */
738 738
 	public function items_purchased() {
739
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) );
739
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item)));
740 740
 	}
741 741
 
742 742
 
@@ -748,8 +748,8 @@  discard block
 block discarded – undo
748 748
 	 * @return EE_Base_Class the relation was added to
749 749
 	 * @throws \EE_Error
750 750
 	 */
751
-	public function add_line_item( EE_Line_Item $line_item ) {
752
-		return $this->_add_relation_to( $line_item, 'Line_Item' );
751
+	public function add_line_item(EE_Line_Item $line_item) {
752
+		return $this->_add_relation_to($line_item, 'Line_Item');
753 753
 	}
754 754
 
755 755
 
@@ -761,8 +761,8 @@  discard block
 block discarded – undo
761 761
 	 * @return EE_Line_Item[]
762 762
 	 * @throws \EE_Error
763 763
 	 */
764
-	public function line_items( $query_params = array() ) {
765
-		return $this->get_many_related( 'Line_Item', $query_params );
764
+	public function line_items($query_params = array()) {
765
+		return $this->get_many_related('Line_Item', $query_params);
766 766
 	}
767 767
 
768 768
 
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 	 * @throws \EE_Error
775 775
 	 */
776 776
 	public function tax_items() {
777
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) );
777
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax)));
778 778
 	}
779 779
 
780 780
 
@@ -787,10 +787,10 @@  discard block
 block discarded – undo
787 787
 	 * @throws \EE_Error
788 788
 	 */
789 789
 	public function total_line_item() {
790
-		$item =  $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) );
791
-		if( ! $item ){
792
-			EE_Registry::instance()->load_helper( 'Line_Item' );
793
-			$item = EEH_Line_Item::create_total_line_item( $this );
790
+		$item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total)));
791
+		if ( ! $item) {
792
+			EE_Registry::instance()->load_helper('Line_Item');
793
+			$item = EEH_Line_Item::create_total_line_item($this);
794 794
 		}
795 795
 		return $item;
796 796
 	}
@@ -806,10 +806,10 @@  discard block
 block discarded – undo
806 806
 	 */
807 807
 	public function tax_total() {
808 808
 		$tax_line_item = $this->tax_total_line_item();
809
-		if ( $tax_line_item ) {
810
-			return (float)$tax_line_item->total();
809
+		if ($tax_line_item) {
810
+			return (float) $tax_line_item->total();
811 811
 		} else {
812
-			return (float)0;
812
+			return (float) 0;
813 813
 		}
814 814
 	}
815 815
 
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
 	 * @throws \EE_Error
823 823
 	 */
824 824
 	public function tax_total_line_item() {
825
-		return EEH_Line_Item::get_taxes_subtotal( $this->total_line_item() );
825
+		return EEH_Line_Item::get_taxes_subtotal($this->total_line_item());
826 826
 	}
827 827
 
828 828
 
@@ -833,20 +833,20 @@  discard block
 block discarded – undo
833 833
 	 * @return EE_Form_Section_Proper
834 834
 	 * @throws \EE_Error
835 835
 	 */
836
-	public function billing_info(){
836
+	public function billing_info() {
837 837
 		$payment_method = $this->payment_method();
838
-		if ( !$payment_method){
838
+		if ( ! $payment_method) {
839 839
 			EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
840 840
 			return false;
841 841
 		}
842 842
 		$primary_reg = $this->primary_registration();
843
-		if ( ! $primary_reg ) {
844
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
843
+		if ( ! $primary_reg) {
844
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
845 845
 			return FALSE;
846 846
 		}
847 847
 		$attendee = $primary_reg->attendee();
848
-		if ( ! $attendee ) {
849
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
848
+		if ( ! $attendee) {
849
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
850 850
 			return FALSE;
851 851
 		}
852 852
 		return $attendee->billing_info_for_payment_method($payment_method);
@@ -887,15 +887,15 @@  discard block
 block discarded – undo
887 887
 	 * @return EE_Payment_Method
888 888
 	 * @throws \EE_Error
889 889
 	 */
890
-	public function payment_method(){
890
+	public function payment_method() {
891 891
 		$pm = $this->get_first_related('Payment_Method');
892
-		if( $pm instanceof EE_Payment_Method ){
892
+		if ($pm instanceof EE_Payment_Method) {
893 893
 			return $pm;
894
-		}else{
894
+		} else {
895 895
 			$last_payment = $this->last_payment();
896
-			if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){
896
+			if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) {
897 897
 				return $last_payment->payment_method();
898
-			}else{
898
+			} else {
899 899
 				return NULL;
900 900
 			}
901 901
 		}
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 	 * @throws \EE_Error
911 911
 	 */
912 912
 	public function last_payment() {
913
-		return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) );
913
+		return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc')));
914 914
 	}
915 915
 
916 916
 
@@ -921,8 +921,8 @@  discard block
 block discarded – undo
921 921
 	 * @return EE_Line_Item[]
922 922
 	 * @throws \EE_Error
923 923
 	 */
924
-	public function non_ticket_line_items(){
925
-		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() );
924
+	public function non_ticket_line_items() {
925
+		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID());
926 926
 	}
927 927
 
928 928
 
Please login to merge, or discard this patch.