Completed
Branch FET-8162-relation-exists (8f4753)
by
unknown
80:03 queued 71:10
created
core/db_classes/EE_Registration.class.php 4 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			parent::set( 'STS_ID', $new_STS_ID, $use_default );
127 127
 			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
128 128
 			return TRUE;
129
-		}else{
129
+		} else{
130 130
 			//even though the old value matches the new value, it's still good to
131 131
 			//allow the parent set method to have a say
132 132
 			parent::set( 'STS_ID', $new_STS_ID, $use_default );
@@ -625,8 +625,9 @@  discard block
 block discarded – undo
625 625
 	 * @return EE_Registration
626 626
 	 */
627 627
 	public function get_primary_registration()  {
628
-		if ( $this->is_primary_registrant() )
629
-			return $this;
628
+		if ( $this->is_primary_registrant() ) {
629
+					return $this;
630
+		}
630 631
 
631 632
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
632 633
 		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
Please login to merge, or discard this patch.
Spacing   +161 added lines, -161 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_Registration class
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 	 * @param string $timezone
17 17
 	 * @return EE_Registration
18 18
 	 */
19
-	public static function new_instance( $props_n_values = array(), $timezone = '' ) {
20
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
21
-		return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone );
19
+	public static function new_instance($props_n_values = array(), $timezone = '') {
20
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
21
+		return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone);
22 22
 	}
23 23
 
24 24
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 	 * @param string  $timezone
29 29
 	 * @return EE_Registration
30 30
 	 */
31
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) {
32
-		return new self( $props_n_values, TRUE, $timezone );
31
+	public static function new_instance_from_db($props_n_values = array(), $timezone = '') {
32
+		return new self($props_n_values, TRUE, $timezone);
33 33
 	}
34 34
 
35 35
 
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	 * @access        public
41 41
 	 * @param        int $EVT_ID Event ID
42 42
 	 */
43
-	public function set_event( $EVT_ID = 0 ) {
44
-		$this->set( 'EVT_ID', $EVT_ID );
43
+	public function set_event($EVT_ID = 0) {
44
+		$this->set('EVT_ID', $EVT_ID);
45 45
 	}
46 46
 
47 47
 
@@ -52,18 +52,18 @@  discard block
 block discarded – undo
52 52
 	 * @param mixed  $field_value
53 53
 	 * @param bool   $use_default
54 54
 	 */
55
-	public function set( $field_name, $field_value, $use_default = FALSE ) {
56
-		switch( $field_name ) {
55
+	public function set($field_name, $field_value, $use_default = FALSE) {
56
+		switch ($field_name) {
57 57
 			case 'REG_code' :
58
-				if ( ! empty( $field_value ) && $this->reg_code() == '' ) {
59
-					$this->set_reg_code( $field_value, $use_default );
58
+				if ( ! empty($field_value) && $this->reg_code() == '') {
59
+					$this->set_reg_code($field_value, $use_default);
60 60
 				}
61 61
 				break;
62 62
 			case 'STS_ID' :
63
-				$this->set_status( $field_value, $use_default );
63
+				$this->set_status($field_value, $use_default);
64 64
 				break;
65 65
 			default :
66
-				parent::set( $field_name, $field_value, $use_default );
66
+				parent::set($field_name, $field_value, $use_default);
67 67
 		}
68 68
 	}
69 69
 
@@ -80,30 +80,30 @@  discard block
 block discarded – undo
80 80
 	 * @param boolean $use_default
81 81
 	 * @return bool
82 82
 	 */
83
-	public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) {
83
+	public function set_status($new_STS_ID = NULL, $use_default = FALSE) {
84 84
 		// get current REG_Status
85 85
 		$old_STS_ID = $this->status_ID();
86 86
 		// if status has changed
87
-		if ( $old_STS_ID != $new_STS_ID  ) {
87
+		if ($old_STS_ID != $new_STS_ID) {
88 88
 			// TO approved
89
-			if ( $new_STS_ID == EEM_Registration::status_id_approved ) {
89
+			if ($new_STS_ID == EEM_Registration::status_id_approved) {
90 90
 				// reserve a space by incrementing ticket and datetime sold values
91 91
 				$this->_reserve_registration_space();
92
-				do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID );
92
+				do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID);
93 93
 			// OR FROM  approved
94
-			} else if ( $old_STS_ID == EEM_Registration::status_id_approved ) {
94
+			} else if ($old_STS_ID == EEM_Registration::status_id_approved) {
95 95
 				// release a space by decrementing ticket and datetime sold values
96 96
 				$this->_release_registration_space();
97
-				do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID );
97
+				do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID);
98 98
 			}
99 99
 			// update status
100
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
101
-			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
100
+			parent::set('STS_ID', $new_STS_ID, $use_default);
101
+			do_action('AHEE__EE_Registration__set_status__after_update', $this);
102 102
 			return TRUE;
103
-		}else{
103
+		} else {
104 104
 			//even though the old value matches the new value, it's still good to
105 105
 			//allow the parent set method to have a say
106
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
106
+			parent::set('STS_ID', $new_STS_ID, $use_default);
107 107
 			return TRUE;
108 108
 		}
109 109
 		return FALSE;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @access        public
117 117
 	 */
118 118
 	public function status_ID() {
119
-		return $this->get( 'STS_ID' );
119
+		return $this->get('STS_ID');
120 120
 	}
121 121
 
122 122
 
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 		$ticket->increase_sold();
131 131
 		$ticket->save();
132 132
 		$datetimes = $ticket->datetimes();
133
-		if ( is_array( $datetimes ) ) {
134
-			foreach ( $datetimes as $datetime ) {
135
-				if ( $datetime instanceof EE_Datetime ) {
133
+		if (is_array($datetimes)) {
134
+			foreach ($datetimes as $datetime) {
135
+				if ($datetime instanceof EE_Datetime) {
136 136
 					$datetime->increase_sold();
137 137
 					$datetime->save();
138 138
 				}
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 	 * @param boolean $include_archived whether to include archived tickets or not.
151 151
 	 * @return EE_Ticket
152 152
 	 */
153
-	public function ticket( $include_archived = TRUE ) {
153
+	public function ticket($include_archived = TRUE) {
154 154
 		$query_params = array();
155
-		if ( $include_archived ) {
156
-			$query_params[ 'default_where_conditions' ] = 'none';
155
+		if ($include_archived) {
156
+			$query_params['default_where_conditions'] = 'none';
157 157
 		}
158
-		return $this->get_first_related( 'Ticket', $query_params );
158
+		return $this->get_first_related('Ticket', $query_params);
159 159
 	}
160 160
 
161 161
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @return EE_Event
166 166
 	 */
167 167
 	public function event() {
168
-		return $this->get_first_related( 'Event' );
168
+		return $this->get_first_related('Event');
169 169
 	}
170 170
 
171 171
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	public function wp_user() {
181 181
 		$event = $this->event();
182
-		if ( $event instanceof EE_Event ) {
182
+		if ($event instanceof EE_Event) {
183 183
 			return $event->wp_user();
184 184
 		}
185 185
 		return 0;
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 		$ticket->decrease_sold();
197 197
 		$ticket->save();
198 198
 		$datetimes = $ticket->datetimes();
199
-		if ( is_array( $datetimes ) ) {
200
-			foreach ( $datetimes as $datetime ) {
201
-				if ( $datetime instanceof EE_Datetime ) {
199
+		if (is_array($datetimes)) {
200
+			foreach ($datetimes as $datetime) {
201
+				if ($datetime instanceof EE_Datetime) {
202 202
 					$datetime->decrease_sold();
203 203
 					$datetime->save();
204 204
 				}
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 * @access        public
215 215
 	 * @param        int $ATT_ID Attendee ID
216 216
 	 */
217
-	public function set_attendee_id( $ATT_ID = 0 ) {
218
-		$this->set( 'ATT_ID', $ATT_ID );
217
+	public function set_attendee_id($ATT_ID = 0) {
218
+		$this->set('ATT_ID', $ATT_ID);
219 219
 	}
220 220
 
221 221
 
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 * @access        public
227 227
 	 * @param        int $TXN_ID Transaction ID
228 228
 	 */
229
-	public function set_transaction_id( $TXN_ID = 0 ) {
230
-		$this->set( 'TXN_ID', $TXN_ID );
229
+	public function set_transaction_id($TXN_ID = 0) {
230
+		$this->set('TXN_ID', $TXN_ID);
231 231
 	}
232 232
 
233 233
 
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 	 * @access    public
239 239
 	 * @param    string $REG_session PHP Session ID
240 240
 	 */
241
-	public function set_session( $REG_session = '' ) {
242
-		$this->set( 'REG_session', $REG_session );
241
+	public function set_session($REG_session = '') {
242
+		$this->set('REG_session', $REG_session);
243 243
 	}
244 244
 
245 245
 
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 * @access    public
251 251
 	 * @param    string $REG_url_link Registration URL Link
252 252
 	 */
253
-	public function set_reg_url_link( $REG_url_link = '' ) {
254
-		$this->set( 'REG_url_link', $REG_url_link );
253
+	public function set_reg_url_link($REG_url_link = '') {
254
+		$this->set('REG_url_link', $REG_url_link);
255 255
 	}
256 256
 
257 257
 
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	 * @access        public
263 263
 	 * @param        int $REG_count Primary Attendee
264 264
 	 */
265
-	public function set_count( $REG_count = 1 ) {
266
-		$this->set( 'REG_count', $REG_count );
265
+	public function set_count($REG_count = 1) {
266
+		$this->set('REG_count', $REG_count);
267 267
 	}
268 268
 
269 269
 
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 	 * @access        public
275 275
 	 * @param        boolean $REG_group_size Group Registration
276 276
 	 */
277
-	public function set_group_size( $REG_group_size = FALSE ) {
278
-		$this->set( 'REG_group_size', $REG_group_size );
277
+	public function set_group_size($REG_group_size = FALSE) {
278
+		$this->set('REG_group_size', $REG_group_size);
279 279
 	}
280 280
 
281 281
 
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
 	 * @access        public
359 359
 	 * @param        mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date
360 360
 	 */
361
-	public function set_reg_date( $REG_date = FALSE ) {
362
-		$this->set( 'REG_date', $REG_date );
361
+	public function set_reg_date($REG_date = FALSE) {
362
+		$this->set('REG_date', $REG_date);
363 363
 	}
364 364
 
365 365
 
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 	 * @access    public
371 371
 	 * @param    float $REG_final_price
372 372
 	 */
373
-	public function set_price_paid( $REG_final_price = 0.00 ) {
374
-		$this->set( 'REG_final_price', $REG_final_price );
373
+	public function set_price_paid($REG_final_price = 0.00) {
374
+		$this->set('REG_final_price', $REG_final_price);
375 375
 	}
376 376
 
377 377
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 * @return string of price, with correct decimal places and currency symbol
381 381
 	 */
382 382
 	public function pretty_price_paid() {
383
-		return $this->get_pretty( 'REG_final_price' );
383
+		return $this->get_pretty('REG_final_price');
384 384
 	}
385 385
 
386 386
 
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
 	 * @access        public
392 392
 	 * @param        boolean $REG_att_is_going Attendee Is Going
393 393
 	 */
394
-	public function set_att_is_going( $REG_att_is_going = FALSE ) {
395
-		$this->set( 'REG_att_is_going', $REG_att_is_going );
394
+	public function set_att_is_going($REG_att_is_going = FALSE) {
395
+		$this->set('REG_att_is_going', $REG_att_is_going);
396 396
 	}
397 397
 
398 398
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	 * @return EE_Attendee
403 403
 	 */
404 404
 	public function attendee() {
405
-		return $this->get_first_related( 'Attendee' );
405
+		return $this->get_first_related('Attendee');
406 406
 	}
407 407
 
408 408
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * @access        public
413 413
 	 */
414 414
 	public function event_ID() {
415
-		return $this->get( 'EVT_ID' );
415
+		return $this->get('EVT_ID');
416 416
 	}
417 417
 
418 418
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 	 */
424 424
 	public function event_name() {
425 425
 		$event = $this->event_obj();
426
-		if ( $event ) {
426
+		if ($event) {
427 427
 			return $event->name();
428 428
 		} else {
429 429
 			return NULL;
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	 * @return EE_Event
438 438
 	 */
439 439
 	public function event_obj() {
440
-		return $this->get_first_related( 'Event' );
440
+		return $this->get_first_related('Event');
441 441
 	}
442 442
 
443 443
 
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 * @access        public
448 448
 	 */
449 449
 	public function attendee_ID() {
450
-		return $this->get( 'ATT_ID' );
450
+		return $this->get('ATT_ID');
451 451
 	}
452 452
 
453 453
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 * @access        public
458 458
 	 */
459 459
 	public function session_ID() {
460
-		return $this->get( 'REG_session' );
460
+		return $this->get('REG_session');
461 461
 	}
462 462
 
463 463
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
468 468
 	 * @return string
469 469
 	 */
470
-	public function receipt_url( $messenger = 'html' ) {
470
+	public function receipt_url($messenger = 'html') {
471 471
 
472 472
 		/**
473 473
 		 * The below will be deprecated one version after this.  We check first if there is a custom receipt template already in use on old system.  If there is then we just return the standard url for it.
@@ -476,12 +476,12 @@  discard block
 block discarded – undo
476 476
 		 */
477 477
 		EE_Registry::instance()->load_helper('Template');
478 478
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php';
479
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
479
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
480 480
 
481
-		if ( $has_custom ) {
482
-			return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) );
481
+		if ($has_custom) {
482
+			return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch'));
483 483
 		}
484
-		return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' );
484
+		return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt');
485 485
 	}
486 486
 
487 487
 
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
493 493
 	 * @return string
494 494
 	 */
495
-	public function invoice_url( $messenger = 'html' ) {
495
+	public function invoice_url($messenger = 'html') {
496 496
 		/**
497 497
 		 * The below will be deprecated one version after this.  We check first if there is a custom invoice template already in use on old system.  If there is then we just return the standard url for it.
498 498
 		 *
@@ -500,21 +500,21 @@  discard block
 block discarded – undo
500 500
 		 */
501 501
 		EE_Registry::instance()->load_helper('Template');
502 502
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php';
503
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
503
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
504 504
 
505
-		if ( $has_custom ) {
506
-			if ( $messenger == 'html' ) {
507
-				return $this->invoice_url( 'launch' );
505
+		if ($has_custom) {
506
+			if ($messenger == 'html') {
507
+				return $this->invoice_url('launch');
508 508
 			}
509 509
 			$route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice';
510 510
 
511
-			$query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() );
512
-			if ( $messenger == 'html' ) {
511
+			$query_args = array('ee' => $route, 'id' => $this->reg_url_link());
512
+			if ($messenger == 'html') {
513 513
 				$query_args['html'] = TRUE;
514 514
 			}
515
-			return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) );
515
+			return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
516 516
 		}
517
-		return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' );
517
+		return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice');
518 518
 	}
519 519
 
520 520
 
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 	 * @access        public
525 525
 	 */
526 526
 	public function reg_url_link() {
527
-		return $this->get( 'REG_url_link' );
527
+		return $this->get('REG_url_link');
528 528
 	}
529 529
 
530 530
 
@@ -534,8 +534,8 @@  discard block
 block discarded – undo
534 534
 	 * @param string $type 'download','launch', or 'html' (default is 'launch')
535 535
 	 * @return void
536 536
 	 */
537
-	public function e_invoice_url( $type = 'launch' ) {
538
-		echo $this->invoice_url( $type );
537
+	public function e_invoice_url($type = 'launch') {
538
+		echo $this->invoice_url($type);
539 539
 	}
540 540
 
541 541
 
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 	 * @return string
556 556
 	 */
557 557
 	public function payment_overview_url() {
558
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), get_permalink( EE_Registry::instance()->CFG->core->reg_page_id ) );
558
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), get_permalink(EE_Registry::instance()->CFG->core->reg_page_id));
559 559
 	}
560 560
 
561 561
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 	 * @return string
567 567
 	 */
568 568
 	public function edit_attendee_information_url() {
569
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), get_permalink( EE_Registry::instance()->CFG->core->reg_page_id ) );
569
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), get_permalink(EE_Registry::instance()->CFG->core->reg_page_id));
570 570
 	}
571 571
 
572 572
 
@@ -576,8 +576,8 @@  discard block
 block discarded – undo
576 576
 	 * @return string
577 577
 	 */
578 578
 	public function get_admin_edit_url() {
579
-		EE_Registry::instance()->load_helper( 'URL' );
580
-		return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) );
579
+		EE_Registry::instance()->load_helper('URL');
580
+		return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php'));
581 581
 	}
582 582
 
583 583
 
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 	 * @access        public
588 588
 	 */
589 589
 	public function is_primary_registrant() {
590
-		return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE;
590
+		return $this->get('REG_count') == 1 ? TRUE : FALSE;
591 591
 	}
592 592
 
593 593
 
@@ -596,12 +596,12 @@  discard block
 block discarded – undo
596 596
 	 * This returns the primary registration object for this registration group (which may be this object).
597 597
 	 * @return EE_Registration
598 598
 	 */
599
-	public function get_primary_registration()  {
600
-		if ( $this->is_primary_registrant() )
599
+	public function get_primary_registration() {
600
+		if ($this->is_primary_registrant())
601 601
 			return $this;
602 602
 
603 603
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
604
-		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
604
+		$primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1)));
605 605
 		return $primary_registrant;
606 606
 	}
607 607
 
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 	* 		@access		public
613 613
 	*/
614 614
 	public function count() {
615
-		return $this->get( 'REG_count' );
615
+		return $this->get('REG_count');
616 616
 	}
617 617
 
618 618
 
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	 * @access        public
623 623
 	 */
624 624
 	public function group_size() {
625
-		return $this->get( 'REG_group_size' );
625
+		return $this->get('REG_group_size');
626 626
 	}
627 627
 
628 628
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 	 * @access        public
633 633
 	 */
634 634
 	public function date() {
635
-		return $this->get( 'REG_date' );
635
+		return $this->get('REG_date');
636 636
 	}
637 637
 
638 638
 
@@ -643,8 +643,8 @@  discard block
 block discarded – undo
643 643
 	 * @param string $time_format
644 644
 	 * @return string
645 645
 	 */
646
-	public function pretty_date( $date_format = NULL, $time_format = NULL ) {
647
-		return $this->get_datetime( 'REG_date', $date_format, $time_format );
646
+	public function pretty_date($date_format = NULL, $time_format = NULL) {
647
+		return $this->get_datetime('REG_date', $date_format, $time_format);
648 648
 	}
649 649
 
650 650
 
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 	 * @access        public
655 655
 	 */
656 656
 	public function price_paid() {
657
-		return $this->get( 'REG_final_price' );
657
+		return $this->get('REG_final_price');
658 658
 	}
659 659
 
660 660
 
@@ -664,8 +664,8 @@  discard block
 block discarded – undo
664 664
 	 * @param bool $show_icons
665 665
 	 * @return void
666 666
 	 */
667
-	public function e_pretty_status( $show_icons = FALSE ) {
668
-		echo $this->pretty_status( $show_icons );
667
+	public function e_pretty_status($show_icons = FALSE) {
668
+		echo $this->pretty_status($show_icons);
669 669
 	}
670 670
 
671 671
 
@@ -676,10 +676,10 @@  discard block
 block discarded – undo
676 676
 	 * @param bool $show_icons
677 677
 	 * @return string
678 678
 	 */
679
-	public function pretty_status( $show_icons = FALSE ) {
680
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
679
+	public function pretty_status($show_icons = FALSE) {
680
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
681 681
 		$icon = '';
682
-		switch ( $this->status_ID() ) {
682
+		switch ($this->status_ID()) {
683 683
 			case EEM_Registration::status_id_approved:
684 684
 				$icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : '';
685 685
 				break;
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 				$icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : '';
700 700
 				break;
701 701
 		}
702
-		return $icon . $status[ $this->status_ID() ];
702
+		return $icon.$status[$this->status_ID()];
703 703
 	}
704 704
 
705 705
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 * @access        public
710 710
 	 */
711 711
 	public function att_is_going() {
712
-		return $this->get( 'REG_att_is_going' );
712
+		return $this->get('REG_att_is_going');
713 713
 	}
714 714
 
715 715
 
@@ -719,8 +719,8 @@  discard block
 block discarded – undo
719 719
 	 * @param array $query_params like EEM_Base::get_all
720 720
 	 * @return EE_Answer[]
721 721
 	 */
722
-	public function answers( $query_params = NULL ) {
723
-		return $this->get_many_related( 'Answer', $query_params );
722
+	public function answers($query_params = NULL) {
723
+		return $this->get_many_related('Answer', $query_params);
724 724
 	}
725 725
 
726 726
 
@@ -734,9 +734,9 @@  discard block
 block discarded – undo
734 734
 	 * (because the answer might be an array of answer values, so passing pretty_value=true
735 735
 	 * will convert it into some kind of string)
736 736
 	 */
737
-	public function answer_value_to_question( $question, $pretty_value=true ) {
737
+	public function answer_value_to_question($question, $pretty_value = true) {
738 738
 		$question_id = EEM_Question::instance()->ensure_is_ID($question);
739
-		return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value);
739
+		return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value);
740 740
 	}
741 741
 
742 742
 	/**
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	 * @return string
746 746
 	 */
747 747
 	public function reg_date() {
748
-		return $this->get_datetime( 'REG_date' );
748
+		return $this->get_datetime('REG_date');
749 749
 	}
750 750
 
751 751
 
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 	 * @return EE_Datetime_Ticket
758 758
 	 */
759 759
 	public function datetime_ticket() {
760
-		return $this->get_first_related( 'Datetime_Ticket' );
760
+		return $this->get_first_related('Datetime_Ticket');
761 761
 	}
762 762
 
763 763
 
@@ -767,15 +767,15 @@  discard block
 block discarded – undo
767 767
 	 * @param EE_Datetime_Ticket $datetime_ticket
768 768
 	 * @return EE_Datetime_Ticket
769 769
 	 */
770
-	public function set_datetime_ticket( $datetime_ticket ) {
771
-		return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' );
770
+	public function set_datetime_ticket($datetime_ticket) {
771
+		return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket');
772 772
 	}
773 773
 	/**
774 774
 	 * Gets deleted
775 775
 	 * @return boolean
776 776
 	 */
777 777
 	public function deleted() {
778
-		return $this->get( 'REG_deleted' );
778
+		return $this->get('REG_deleted');
779 779
 	}
780 780
 
781 781
 	/**
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 	 * @return boolean
785 785
 	 */
786 786
 	public function set_deleted($deleted) {
787
-		$this->set( 'REG_deleted', $deleted );
787
+		$this->set('REG_deleted', $deleted);
788 788
 	}
789 789
 
790 790
 
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 	 * @return EE_Status
795 795
 	 */
796 796
 	public function status_obj() {
797
-		return $this->get_first_related( 'Status' );
797
+		return $this->get_first_related('Status');
798 798
 	}
799 799
 
800 800
 
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 	 * @return int
806 806
 	 */
807 807
 	public function count_checkins() {
808
-		return $this->get_model()->count_related( $this, 'Checkin' );
808
+		return $this->get_model()->count_related($this, 'Checkin');
809 809
 	}
810 810
 
811 811
 
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 	 * @return int
816 816
 	 */
817 817
 	public function count_checkins_not_checkedout() {
818
-		return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) );
818
+		return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1)));
819 819
 	}
820 820
 
821 821
 
@@ -828,15 +828,15 @@  discard block
 block discarded – undo
828 828
 	 *
829 829
 	 * @return bool
830 830
 	 */
831
-	public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) {
832
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
831
+	public function can_checkin($DTT_OR_ID, $check_approved = TRUE) {
832
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
833 833
 
834 834
 		//first check registration status
835
-		if (  $check_approved && ! $this->is_approved() ) {
835
+		if ($check_approved && ! $this->is_approved()) {
836 836
 			return false;
837 837
 		}
838 838
 		//is there a datetime ticket that matches this dtt_ID?
839
-		return EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) );
839
+		return EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID)));
840 840
 	}
841 841
 
842 842
 
@@ -852,25 +852,25 @@  discard block
 block discarded – undo
852 852
 	 * @param  bool $verify  If true then can_checkin() is used to verify whether the person can be checked in or not.  Otherwise this forces change in checkin status.
853 853
 	 * @return int|BOOL            the chk_in status toggled to OR false if nothing got changed.
854 854
 	 */
855
-	public function toggle_checkin_status( $DTT_ID = NULL, $verify = FALSE ) {
856
-		if ( empty( $DTT_ID ) ) {
855
+	public function toggle_checkin_status($DTT_ID = NULL, $verify = FALSE) {
856
+		if (empty($DTT_ID)) {
857 857
 			$datetime = $this->get_related_primary_datetime();
858 858
 			$DTT_ID = $datetime->ID();
859 859
 		//verify the registration can checkin for the given DTT_ID
860
-		} elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) {
861
-			EE_Error::add_error( sprintf( __( 'The given registration (ID:%d) can not be checked in to the given DTT_ID (%d), because the registration does not have access', 'event_espresso'), $this->ID(), $DTT_ID ), __FILE__, __FUNCTION__, __LINE__ );
860
+		} elseif ( ! $this->can_checkin($DTT_ID, $verify)) {
861
+			EE_Error::add_error(sprintf(__('The given registration (ID:%d) can not be checked in to the given DTT_ID (%d), because the registration does not have access', 'event_espresso'), $this->ID(), $DTT_ID), __FILE__, __FUNCTION__, __LINE__);
862 862
 			return FALSE;
863 863
 		}
864
-		$status_paths = array( 0 => 1, 1 => 2, 2 => 1 );
864
+		$status_paths = array(0 => 1, 1 => 2, 2 => 1);
865 865
 		//start by getting the current status so we know what status we'll be changing to.
866
-		$cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL );
867
-		$status_to = $status_paths[ $cur_status ];
866
+		$cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL);
867
+		$status_to = $status_paths[$cur_status];
868 868
 		//add relation - note Check-ins are always creating new rows because we are keeping track of Check-ins over time.  Eventually we'll probably want to show a list table for the individual Check-ins so that can be managed.
869 869
 		$new_status = $status_to == 2 ? 0 : $status_to;
870
-		$chk_data = array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID, 'CHK_in' => $new_status );
871
-		$checkin = EE_Checkin::new_instance( $chk_data );
870
+		$chk_data = array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID, 'CHK_in' => $new_status);
871
+		$checkin = EE_Checkin::new_instance($chk_data);
872 872
 		$updated = $checkin->save();
873
-		if ( $updated === 0 ) {
873
+		if ($updated === 0) {
874 874
 			$status_to = FALSE;
875 875
 		}
876 876
 		return $status_to;
@@ -894,22 +894,22 @@  discard block
 block discarded – undo
894 894
 	 * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
895 895
 	 * @return int            Integer representing Check-in status.
896 896
 	 */
897
-	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) {
898
-		if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) {
897
+	public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) {
898
+		if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) {
899 899
 			$datetime = $this->get_related_primary_datetime();
900
-			if ( ! $datetime instanceof EE_Datetime ) {
900
+			if ( ! $datetime instanceof EE_Datetime) {
901 901
 				return 0;
902 902
 			}
903 903
 			$DTT_ID = $datetime->ID();
904 904
 		//verify the registration can checkin for the given DTT_ID
905
-		} elseif ( ! $checkin instanceof EE_Checkin && ! $this->can_checkin( $DTT_ID, false ) ) {
906
-			EE_Error::add_error( sprintf( __( 'The checkin status for the given registration (ID:%d) and DTT_ID (%d) cannot be retrieved because the registration does not have access to that date and time.  So there is no status for this registration.', 'event_espresso'), $this->ID(), $DTT_ID ) );
905
+		} elseif ( ! $checkin instanceof EE_Checkin && ! $this->can_checkin($DTT_ID, false)) {
906
+			EE_Error::add_error(sprintf(__('The checkin status for the given registration (ID:%d) and DTT_ID (%d) cannot be retrieved because the registration does not have access to that date and time.  So there is no status for this registration.', 'event_espresso'), $this->ID(), $DTT_ID));
907 907
 			return false;
908 908
 		}
909 909
 		//get checkin object (if exists)
910
-		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) );
911
-		if ( $checkin instanceof EE_Checkin ) {
912
-			if ( $checkin->get( 'CHK_in' ) ) {
910
+		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC')));
911
+		if ($checkin instanceof EE_Checkin) {
912
+			if ($checkin->get('CHK_in')) {
913 913
 				return 1; //checked in
914 914
 			} else {
915 915
 				return 2; //had checked in but is now checked out.
@@ -927,28 +927,28 @@  discard block
 block discarded – undo
927 927
 	 * @param bool $error  This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name.
928 928
 	 * @return string         internationalized message
929 929
 	 */
930
-	public function get_checkin_msg( $DTT_ID, $error = FALSE ) {
930
+	public function get_checkin_msg($DTT_ID, $error = FALSE) {
931 931
 		//let's get the attendee first so we can include the name of the attendee
932
-		$attendee = $this->get_first_related( 'Attendee' );
933
-		if ( $attendee instanceof EE_Attendee ) {
934
-			if ( $error ) {
935
-				return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() );
932
+		$attendee = $this->get_first_related('Attendee');
933
+		if ($attendee instanceof EE_Attendee) {
934
+			if ($error) {
935
+				return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name());
936 936
 			}
937
-			$cur_status = $this->check_in_status_for_datetime( $DTT_ID );
937
+			$cur_status = $this->check_in_status_for_datetime($DTT_ID);
938 938
 			//what is the status message going to be?
939
-			switch ( $cur_status ) {
939
+			switch ($cur_status) {
940 940
 				case 0 :
941
-					return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() );
941
+					return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name());
942 942
 					break;
943 943
 				case 1 :
944
-					return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() );
944
+					return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name());
945 945
 					break;
946 946
 				case 2 :
947
-					return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() );
947
+					return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name());
948 948
 					break;
949 949
 			}
950 950
 		}
951
-		return __( "The check-in status could not be determined.", "event_espresso" );
951
+		return __("The check-in status could not be determined.", "event_espresso");
952 952
 	}
953 953
 
954 954
 
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 	 * @return EE_Transaction
959 959
 	 */
960 960
 	public function transaction() {
961
-		return $this->get_first_related( 'Transaction' );
961
+		return $this->get_first_related('Transaction');
962 962
 	}
963 963
 
964 964
 
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 	 * @access        public
970 970
 	 */
971 971
 	public function reg_code() {
972
-		return $this->get( 'REG_code' );
972
+		return $this->get('REG_code');
973 973
 	}
974 974
 
975 975
 
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
 	 * @access        public
980 980
 	 */
981 981
 	public function transaction_ID() {
982
-		return $this->get( 'TXN_ID' );
982
+		return $this->get('TXN_ID');
983 983
 	}
984 984
 
985 985
 
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 	 * @return int
989 989
 	 */
990 990
 	public function ticket_ID() {
991
-		return $this->get( 'TKT_ID' );
991
+		return $this->get('TKT_ID');
992 992
 	}
993 993
 
994 994
 
@@ -1000,17 +1000,17 @@  discard block
 block discarded – undo
1000 1000
 	 * @param    string $REG_code Registration Code
1001 1001
 	 * @param	boolean $use_default
1002 1002
 	 */
1003
-	public function set_reg_code( $REG_code, $use_default = FALSE ) {
1004
-		if ( empty( $REG_code )) {
1005
-			EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1003
+	public function set_reg_code($REG_code, $use_default = FALSE) {
1004
+		if (empty($REG_code)) {
1005
+			EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1006 1006
 			return;
1007 1007
 		}
1008
-		if ( ! $this->reg_code() ) {
1009
-			parent::set( 'REG_code', $REG_code, $use_default );
1008
+		if ( ! $this->reg_code()) {
1009
+			parent::set('REG_code', $REG_code, $use_default);
1010 1010
 		} else {
1011 1011
 			EE_Error::doing_it_wrong(
1012
-				__CLASS__ . '::' . __FUNCTION__,
1013
-				__( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ),
1012
+				__CLASS__.'::'.__FUNCTION__,
1013
+				__('Can not change a registration REG_code once it has been set.', 'event_espresso'),
1014 1014
 				'4.6.0'
1015 1015
 			);
1016 1016
 		}
@@ -1027,17 +1027,17 @@  discard block
 block discarded – undo
1027 1027
 	 * @return EE_Registration[]  or empty array if this isn't a group registration.
1028 1028
 	 */
1029 1029
 	public function get_all_other_registrations_in_group() {
1030
-		if ( $this->group_size() < 2 ) {
1030
+		if ($this->group_size() < 2) {
1031 1031
 			return array();
1032 1032
 		}
1033 1033
 
1034 1034
 		$query[0] = array(
1035 1035
 			'TXN_ID' => $this->transaction_ID(),
1036
-			'REG_ID' => array( '!=', $this->ID() ),
1036
+			'REG_ID' => array('!=', $this->ID()),
1037 1037
 			'TKT_ID' => $this->ticket_ID()
1038 1038
 			);
1039 1039
 
1040
-		$registrations = $this->get_model()->get_all( $query );
1040
+		$registrations = $this->get_model()->get_all($query);
1041 1041
 		return $registrations;
1042 1042
 	}
1043 1043
 }
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -618,9 +618,9 @@
 block discarded – undo
618 618
 
619 619
 
620 620
 	/**
621
-	*		get  Attendee Number
622
-	* 		@access		public
623
-	*/
621
+	 *		get  Attendee Number
622
+	 * 		@access		public
623
+	 */
624 624
 	public function count() {
625 625
 		return $this->get( 'REG_count' );
626 626
 	}
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 	/**
782 782
 	 * Sets deleted
783 783
 	 * @param boolean $deleted
784
-	 * @return boolean
784
+	 * @return boolean|null
785 785
 	 */
786 786
 	public function set_deleted($deleted) {
787 787
 		$this->set( 'REG_deleted', $deleted );
@@ -825,6 +825,7 @@  discard block
 block discarded – undo
825 825
 	 *
826 826
 	 * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against
827 827
 	 * @param bool   $check_approved   This is used to indicate whether the caller wants can_checkin to also consider registration status as well as datetime access.
828
+	 * @param integer $DTT_OR_ID
828 829
 	 *
829 830
 	 * @return bool
830 831
 	 */
@@ -985,7 +986,7 @@  discard block
 block discarded – undo
985 986
 
986 987
 
987 988
 	/**
988
-	 * @return int
989
+	 * @return boolean
989 990
 	 */
990 991
 	public function ticket_ID() {
991 992
 		return $this->get( 'TKT_ID' );
Please login to merge, or discard this patch.
core/db_classes/EE_Soft_Delete_Base_Class.class.php 1 patch
Spacing   +7 added lines, -7 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
  * Event Espresso
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @return boolean success
34 34
 	 */
35 35
 	public function delete() {
36
-		return $this->delete_or_restore( TRUE );
36
+		return $this->delete_or_restore(TRUE);
37 37
 	}
38 38
 
39 39
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return boolean success
44 44
 	 */
45 45
 	public function delete_permanently() {
46
-		return $this->get_model()->delete_permanently_by_ID( $this->ID() );
46
+		return $this->get_model()->delete_permanently_by_ID($this->ID());
47 47
 	}
48 48
 
49 49
 
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @param bool $delete true=>delete, false=>restore
54 54
 	 * @return bool
55 55
 	 */
56
-	public function delete_or_restore( $delete = TRUE ) {
56
+	public function delete_or_restore($delete = TRUE) {
57 57
 		$model = $this->get_model();
58
-		return $model->delete_or_restore_by_ID( $delete, $this->ID() );
58
+		return $model->delete_or_restore_by_ID($delete, $this->ID());
59 59
 	}
60 60
 
61 61
 
@@ -65,6 +65,6 @@  discard block
 block discarded – undo
65 65
 	 * @return boolean
66 66
 	 */
67 67
 	public function restore() {
68
-		return $this->delete_or_restore( FALSE );
68
+		return $this->delete_or_restore(FALSE);
69 69
 	}
70 70
 }
71 71
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_classes/EE_Taxes.class.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@
 block discarded – undo
36 36
 		$tax = 0;
37 37
 		$total_tax = 0;
38 38
 		//This first checks to see if the given ticket is taxable.
39
-		if ( ! $ticket->get( 'TKT_taxable' ) )
40
-			return $tax;
39
+		if ( ! $ticket->get( 'TKT_taxable' ) ) {
40
+					return $tax;
41
+		}
41 42
 		//get subtotal (notice we're only retrieving a subtotal if there isn't one given)
42 43
 		$subtotal = self::get_subtotal_for_admin( $ticket );
43 44
 		//get taxes
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 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
  * Taxes class
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 	 * @param  EE_Ticket $ticket incoming EE_Ticket
33 33
 	 * @return float             total taxes to apply to ticket.
34 34
 	 */
35
-	public static function get_total_taxes_for_admin( EE_Ticket $ticket ) {
35
+	public static function get_total_taxes_for_admin(EE_Ticket $ticket) {
36 36
 		$tax = 0;
37 37
 		$total_tax = 0;
38 38
 		//This first checks to see if the given ticket is taxable.
39
-		if ( ! $ticket->get( 'TKT_taxable' ) )
39
+		if ( ! $ticket->get('TKT_taxable'))
40 40
 			return $tax;
41 41
 		//get subtotal (notice we're only retrieving a subtotal if there isn't one given)
42
-		$subtotal = self::get_subtotal_for_admin( $ticket );
42
+		$subtotal = self::get_subtotal_for_admin($ticket);
43 43
 		//get taxes
44 44
 		$taxes = self::get_taxes_for_admin();
45 45
 		//apply taxes to subtotal
46
-		foreach ( $taxes as $tax ) {
46
+		foreach ($taxes as $tax) {
47 47
 			//assuming taxes are not cumulative
48
-			$total_tax += $subtotal * $tax->get( 'PRC_amount' ) / 100;
48
+			$total_tax += $subtotal * $tax->get('PRC_amount') / 100;
49 49
 		}
50 50
 		return $total_tax;
51 51
 	}
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 	 * @param EE_Ticket $ticket
57 57
 	 * @return float
58 58
 	 */
59
-	public static function get_subtotal_for_admin( EE_Ticket $ticket ) {
59
+	public static function get_subtotal_for_admin(EE_Ticket $ticket) {
60 60
 		$TKT_ID = $ticket->ID();
61
-		return isset( self::$_subtotal[ $TKT_ID ] ) ? self::$_subtotal[ $TKT_ID ] : self::_get_subtotal_for_admin( $ticket );
61
+		return isset(self::$_subtotal[$TKT_ID]) ? self::$_subtotal[$TKT_ID] : self::_get_subtotal_for_admin($ticket);
62 62
 	}
63 63
 
64 64
 
@@ -68,26 +68,26 @@  discard block
 block discarded – undo
68 68
 	 * @param  EE_Ticket $ticket
69 69
 	 * @return float     subtotal calculated from all EE_Price[] on Ticket.
70 70
 	 */
71
-	private static function _get_subtotal_for_admin( EE_Ticket $ticket ) {
71
+	private static function _get_subtotal_for_admin(EE_Ticket $ticket) {
72 72
 		$subtotal = 0;
73 73
 		//get all prices
74
-		$prices = $ticket->get_many_related( 'Price', array( 'default_where_conditions' => 'none', 'order_by' => array( 'PRC_order' => 'ASC' ) ) );
74
+		$prices = $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC')));
75 75
 		//let's loop through them (base price is always the first item)
76
-		foreach ( $prices as $price ) {
77
-			if ( $price instanceof EE_Price ) {
78
-				switch ( $price->type_obj()->base_type() ) {
76
+		foreach ($prices as $price) {
77
+			if ($price instanceof EE_Price) {
78
+				switch ($price->type_obj()->base_type()) {
79 79
 					case 1: // base price
80 80
 					case 3: // surcharges
81
-						$subtotal += $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' );
81
+						$subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount');
82 82
 						break;
83 83
 					case 2: // discounts
84
-						$subtotal -= $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' );
84
+						$subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount');
85 85
 						break;
86 86
 				}
87 87
 			}
88 88
 		}
89 89
 		$TKT_ID = $ticket->ID();
90
-		self::$_subtotal = array( $TKT_ID => $subtotal );
90
+		self::$_subtotal = array($TKT_ID => $subtotal);
91 91
 		return $subtotal;
92 92
 	}
93 93
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @return EE_Price[] EE_Price objects that have PRT_ID == 4
99 99
 	 */
100 100
 	public static function get_taxes_for_admin() {
101
-		self::$_default_taxes = ! empty( self::$_default_taxes ) ? self::$_default_taxes : EE_Registry::instance()->load_model( 'Price' )->get_all( array( array( 'Price_Type.PBT_ID' => 4 ) ) );
101
+		self::$_default_taxes = ! empty(self::$_default_taxes) ? self::$_default_taxes : EE_Registry::instance()->load_model('Price')->get_all(array(array('Price_Type.PBT_ID' => 4)));
102 102
 		return self::$_default_taxes;
103 103
 	}
104 104
 
Please login to merge, or discard this patch.
core/db_classes/EE_Term_Relationship.class.php 1 patch
Spacing   +7 added lines, -7 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
  * Event Espresso
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 	 * @param array $props_n_values
31 31
 	 * @return EE_Term_Relationship
32 32
 	 */
33
-	public static function new_instance( $props_n_values = array() ) {
34
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
35
-		return $has_object ? $has_object : new self( $props_n_values );
33
+	public static function new_instance($props_n_values = array()) {
34
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
35
+		return $has_object ? $has_object : new self($props_n_values);
36 36
 	}
37 37
 
38 38
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	 * @param array $props_n_values
42 42
 	 * @return EE_Term_Relationship
43 43
 	 */
44
-	public static function new_instance_from_db( $props_n_values = array() ) {
45
-		return new self( $props_n_values, TRUE );
44
+	public static function new_instance_from_db($props_n_values = array()) {
45
+		return new self($props_n_values, TRUE);
46 46
 	}
47 47
 
48 48
 
Please login to merge, or discard this patch.
core/db_classes/EE_Ticket_Price.class.php 1 patch
Spacing   +7 added lines, -7 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
  * Event Espresso
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @param string $timezone
36 36
 	 * @return EE_Ticket_Price|mixed
37 37
 	 */
38
-	public static function new_instance( $props_n_values = array(), $timezone = '' ) {
39
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone );
40
-		return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone );
38
+	public static function new_instance($props_n_values = array(), $timezone = '') {
39
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone);
40
+		return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone);
41 41
 	}
42 42
 
43 43
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 * @param string $timezone
48 48
 	 * @return EE_Ticket_Price
49 49
 	 */
50
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) {
51
-		return new self( $props_n_values, TRUE, $timezone );
50
+	public static function new_instance_from_db($props_n_values = array(), $timezone = '') {
51
+		return new self($props_n_values, TRUE, $timezone);
52 52
 	}
53 53
 
54 54
 
Please login to merge, or discard this patch.
core/db_classes/EE_Ticket_Template.class.php 1 patch
Spacing   +7 added lines, -7 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
  * Event Espresso
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @param string $timezone
36 36
 	 * @return EE_Ticket_Template|mixed
37 37
 	 */
38
-	public static function new_instance( $props_n_values = array(), $timezone = '' ) {
39
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone );
40
-		return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone );
38
+	public static function new_instance($props_n_values = array(), $timezone = '') {
39
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone);
40
+		return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone);
41 41
 	}
42 42
 
43 43
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 * @param string $timezone
48 48
 	 * @return EE_Ticket_Template
49 49
 	 */
50
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) {
51
-		return new self( $props_n_values, TRUE, $timezone );
50
+	public static function new_instance_from_db($props_n_values = array(), $timezone = '') {
51
+		return new self($props_n_values, TRUE, $timezone);
52 52
 	}
53 53
 
54 54
 
Please login to merge, or discard this patch.
core/db_classes/EE_Transaction.class.php 3 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -742,11 +742,11 @@
 block discarded – undo
742 742
 		$pm = $this->get_first_related('Payment_Method');
743 743
 		if( $pm instanceof EE_Payment_Method ){
744 744
 			return $pm;
745
-		}else{
745
+		} else{
746 746
 			$last_payment = $this->last_payment();
747 747
 			if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){
748 748
 				return $last_payment->payment_method();
749
-			}else{
749
+			} else{
750 750
 				return NULL;
751 751
 			}
752 752
 		}
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	/**
210 210
 	 *        get Transaction Total
211 211
 	 * @access        public
212
-	 * @return float
212
+	 * @return boolean
213 213
 	 */
214 214
 	public function total() {
215 215
 		return $this->get( 'TXN_total' );
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	/**
221 221
 	 *        get Total Amount Paid to Date
222 222
 	 * @access        public
223
-	 * @return float
223
+	 * @return boolean
224 224
 	 */
225 225
 	public function paid() {
226 226
 		return $this->get( 'TXN_paid' );
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	/**
323 323
 	 * Gets all the attendees for this transaction (handy for use with EE_Attendee's get_registrations_for_event function
324 324
 	 * for getting attendees and how many registrations they each have for an event)
325
-	 * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT'
325
+	 * @return EE_Base_Class[] EE_Attendee[] by default, int if $output is set to 'COUNT'
326 326
 	 */
327 327
 	public function attendees() {
328 328
 		return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) );
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 	/**
568 568
 	 * Gets all the extra meta info on this payment
569 569
 	 * @param array $query_params like EEM_Base::get_all
570
-	 * @return EE_Extra_Meta
570
+	 * @return EE_Base_Class[]
571 571
 	 */
572 572
 	public function extra_meta( $query_params = array() ) {
573 573
 		return $this->get_many_related( 'Extra_Meta', $query_params );
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 
715 715
 	/**
716 716
 	 * Gets PMD_ID
717
-	 * @return int
717
+	 * @return boolean
718 718
 	 */
719 719
 	function payment_method_ID() {
720 720
 		return $this->get('PMD_ID');
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 	/**
726 726
 	 * Sets PMD_ID
727 727
 	 * @param int $PMD_ID
728
-	 * @return boolean
728
+	 * @return boolean|null
729 729
 	 */
730 730
 	function set_payment_method_ID($PMD_ID) {
731 731
 		$this->set('PMD_ID', $PMD_ID);
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 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
  * Event Espresso
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  * @subpackage 	includes/classes/EE_Transaction.class.php
27 27
  * @author 				Brent Christensen
28 28
  */
29
-class EE_Transaction extends EE_Base_Class implements EEI_Transaction{
29
+class EE_Transaction extends EE_Base_Class implements EEI_Transaction {
30 30
 
31 31
 
32 32
 	/**
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @param string $timezone
36 36
 	 * @return EE_Transaction
37 37
 	 */
38
-	public static function new_instance( $props_n_values = array(), $timezone = '' ) {
39
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
40
-		return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone );
38
+	public static function new_instance($props_n_values = array(), $timezone = '') {
39
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
40
+		return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone);
41 41
 	}
42 42
 
43 43
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 * @param string $timezone
49 49
 	 * @return EE_Transaction
50 50
 	 */
51
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) {
52
-		return new self( $props_n_values, TRUE, $timezone );
51
+	public static function new_instance_from_db($props_n_values = array(), $timezone = '') {
52
+		return new self($props_n_values, TRUE, $timezone);
53 53
 	}
54 54
 
55 55
 
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 	 * @return 	void
65 65
 	 */
66 66
 	public function lock() {
67
-		$locked_transactions = get_option( 'ee_locked_transactions', array() );
68
-		$locked_transactions[ $this->ID() ] = true;
69
-		update_option( 'ee_locked_transactions', $locked_transactions );
67
+		$locked_transactions = get_option('ee_locked_transactions', array());
68
+		$locked_transactions[$this->ID()] = true;
69
+		update_option('ee_locked_transactions', $locked_transactions);
70 70
 	}
71 71
 
72 72
 
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 * @return 	void
81 81
 	 */
82 82
 	public function unlock() {
83
-		$locked_transactions = get_option( 'ee_locked_transactions', array() );
84
-		unset( $locked_transactions[ $this->ID() ] );
85
-		update_option( 'ee_locked_transactions', $locked_transactions );
83
+		$locked_transactions = get_option('ee_locked_transactions', array());
84
+		unset($locked_transactions[$this->ID()]);
85
+		update_option('ee_locked_transactions', $locked_transactions);
86 86
 	}
87 87
 
88 88
 	/**
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 * @return boolean
100 100
 	 */
101 101
 	public function is_locked() {
102
-		$locked_transactions = get_option( 'ee_locked_transactions', array() );
103
-		return isset( $locked_transactions[ $this->ID() ] ) ? true : false;
102
+		$locked_transactions = get_option('ee_locked_transactions', array());
103
+		return isset($locked_transactions[$this->ID()]) ? true : false;
104 104
 	}
105 105
 
106 106
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 * @access        public
112 112
 	 * @param        float $total total value of transaction
113 113
 	 */
114
-	public function set_total( $total = 0.00 ) {
115
-		$this->set( 'TXN_total', $total );
114
+	public function set_total($total = 0.00) {
115
+		$this->set('TXN_total', $total);
116 116
 	}
117 117
 
118 118
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 	 * @access        public
124 124
 	 * @param        float $total_paid total amount paid to date (sum of all payments)
125 125
 	 */
126
-	public function set_paid( $total_paid = 0.00 ) {
127
-		$this->set( 'TXN_paid', $total_paid );
126
+	public function set_paid($total_paid = 0.00) {
127
+		$this->set('TXN_paid', $total_paid);
128 128
 	}
129 129
 
130 130
 
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 	 * @access        public
136 136
 	 * @param        string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set
137 137
 	 */
138
-	public function set_status( $status = '' ) {
139
-		$this->set( 'STS_ID', $status );
138
+	public function set_status($status = '') {
139
+		$this->set('STS_ID', $status);
140 140
 	}
141 141
 
142 142
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @access        public
148 148
 	 * @param        string $hash_salt required for some payment gateways
149 149
 	 */
150
-	public function set_hash_salt( $hash_salt = '' ) {
151
-		$this->set( 'TXN_hash_salt', $hash_salt );
150
+	public function set_hash_salt($hash_salt = '') {
151
+		$this->set('TXN_hash_salt', $hash_salt);
152 152
 	}
153 153
 
154 154
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 	 * Sets TXN_reg_steps array
158 158
 	 * @param array $txn_reg_steps
159 159
 	 */
160
-	function set_reg_steps( $txn_reg_steps ) {
161
-		$this->set( 'TXN_reg_steps', $txn_reg_steps );
160
+	function set_reg_steps($txn_reg_steps) {
161
+		$this->set('TXN_reg_steps', $txn_reg_steps);
162 162
 	}
163 163
 
164 164
 
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 * @return EE_SPCO_Reg_Step[]
169 169
 	 */
170 170
 	function reg_steps() {
171
-		$TXN_reg_steps = $this->get( 'TXN_reg_steps' );
172
-		return is_array( $TXN_reg_steps ) ? $TXN_reg_steps : array();
171
+		$TXN_reg_steps = $this->get('TXN_reg_steps');
172
+		return is_array($TXN_reg_steps) ? $TXN_reg_steps : array();
173 173
 	}
174 174
 
175 175
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @return string of transaction's total cost, with currency symbol and decimal
180 180
 	 */
181 181
 	public function pretty_total() {
182
-		return $this->get_pretty( 'TXN_total' );
182
+		return $this->get_pretty('TXN_total');
183 183
 	}
184 184
 
185 185
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @return string
190 190
 	 */
191 191
 	public function pretty_paid() {
192
-		return $this->get_pretty( 'TXN_paid' );
192
+		return $this->get_pretty('TXN_paid');
193 193
 	}
194 194
 
195 195
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @return float amount remaining
202 202
 	 */
203 203
 	public function remaining() {
204
-		return (float)( $this->total() - $this->paid() );
204
+		return (float) ($this->total() - $this->paid());
205 205
 	}
206 206
 
207 207
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 * @return float
213 213
 	 */
214 214
 	public function total() {
215
-		return $this->get( 'TXN_total' );
215
+		return $this->get('TXN_total');
216 216
 	}
217 217
 
218 218
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 * @return float
224 224
 	 */
225 225
 	public function paid() {
226
-		return $this->get( 'TXN_paid' );
226
+		return $this->get('TXN_paid');
227 227
 	}
228 228
 
229 229
 
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @access        public
234 234
 	 */
235 235
 	public function get_cart_session() {
236
-		$session_data = $this->get( 'TXN_session_data' );
237
-		return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart ? $session_data[ 'cart' ] : NULL;
236
+		$session_data = $this->get('TXN_session_data');
237
+		return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart ? $session_data['cart'] : NULL;
238 238
 	}
239 239
 
240 240
 
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
 	 * @access        public
245 245
 	 */
246 246
 	public function session_data() {
247
-		$session_data = $this->get( 'TXN_session_data' );
248
-		if ( empty( $session_data ) ) {
249
-			$session_data = array( 'id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array() );
247
+		$session_data = $this->get('TXN_session_data');
248
+		if (empty($session_data)) {
249
+			$session_data = array('id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array());
250 250
 		}
251 251
 		return $session_data;
252 252
 	}
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 	 * @access        public
260 260
 	 * @param        EE_Session|array $session_data
261 261
 	 */
262
-	public function set_txn_session_data( $session_data ) {
263
-		if ( $session_data instanceof EE_Session ) {
264
-			$this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE ));
262
+	public function set_txn_session_data($session_data) {
263
+		if ($session_data instanceof EE_Session) {
264
+			$this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE));
265 265
 		} else {
266
-			$this->set( 'TXN_session_data', $session_data );
266
+			$this->set('TXN_session_data', $session_data);
267 267
 		}
268 268
 	}
269 269
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	 * @access        public
275 275
 	 */
276 276
 	public function hash_salt_() {
277
-		return $this->get( 'TXN_hash_salt' );
277
+		return $this->get('TXN_hash_salt');
278 278
 	}
279 279
 
280 280
 
@@ -293,13 +293,13 @@  discard block
 block discarded – undo
293 293
 	 * @param 	boolean 	$gmt - whether to return a unix timestamp with UTC offset applied (default) or no UTC offset applied
294 294
 	 * @return 	string | int
295 295
 	 */
296
-	public function datetime( $format = FALSE, $gmt = FALSE ) {
297
-		if ( $format ) {
298
-			return $this->get_pretty( 'TXN_timestamp' );
299
-		} else if ( $gmt ) {
300
-			return $this->get_raw( 'TXN_timestamp' );
296
+	public function datetime($format = FALSE, $gmt = FALSE) {
297
+		if ($format) {
298
+			return $this->get_pretty('TXN_timestamp');
299
+		} else if ($gmt) {
300
+			return $this->get_raw('TXN_timestamp');
301 301
 		} else {
302
-			return $this->get( 'TXN_timestamp' );
302
+			return $this->get('TXN_timestamp');
303 303
 		}
304 304
 	}
305 305
 
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 	 * @param        boolean $get_cached   TRUE to retrieve cached registrations or FALSE to pull from the db
312 312
 	 * @return EE_Registration[]
313 313
 	 */
314
-	public function registrations( $query_params = array(), $get_cached = FALSE ) {
315
-		$query_params = ( empty( $query_params ) || ! is_array( $query_params ) ) ? array( 'order_by' => array( 'Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC' ) ) : $query_params;
314
+	public function registrations($query_params = array(), $get_cached = FALSE) {
315
+		$query_params = (empty($query_params) || ! is_array($query_params)) ? array('order_by' => array('Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC')) : $query_params;
316 316
 		$query_params = $get_cached ? array() : $query_params;
317
-		return $this->get_many_related( 'Registration', $query_params );
317
+		return $this->get_many_related('Registration', $query_params);
318 318
 	}
319 319
 
320 320
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT'
326 326
 	 */
327 327
 	public function attendees() {
328
-		return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) );
328
+		return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID())));
329 329
 	}
330 330
 
331 331
 
@@ -335,8 +335,8 @@  discard block
 block discarded – undo
335 335
 	 * @param array $query_params like EEM_Base::get_all
336 336
 	 * @return EE_Payment[]
337 337
 	 */
338
-	public function payments( $query_params = array() ) {
339
-		return $this->get_many_related( 'Payment', $query_params );
338
+	public function payments($query_params = array()) {
339
+		return $this->get_many_related('Payment', $query_params);
340 340
 	}
341 341
 
342 342
 
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
 	 * @return EE_Payment[]
347 347
 	 */
348 348
 	public function approved_payments() {
349
-		EE_Registry::instance()->load_model( 'Payment' );
350
-		return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) );
349
+		EE_Registry::instance()->load_model('Payment');
350
+		return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC')));
351 351
 	}
352 352
 
353 353
 
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 	 * @param bool $show_icons
358 358
 	 * @return string
359 359
 	 */
360
-	public function e_pretty_status( $show_icons = FALSE ) {
361
-		echo $this->pretty_status( $show_icons );
360
+	public function e_pretty_status($show_icons = FALSE) {
361
+		echo $this->pretty_status($show_icons);
362 362
 	}
363 363
 
364 364
 
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 	 * @param bool $show_icons
369 369
 	 * @return string
370 370
 	 */
371
-	public function pretty_status( $show_icons = FALSE ) {
372
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
371
+	public function pretty_status($show_icons = FALSE) {
372
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
373 373
 		$icon = '';
374
-		switch ( $this->status_ID() ) {
374
+		switch ($this->status_ID()) {
375 375
 			case EEM_Transaction::complete_status_code:
376 376
 				$icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : '';
377 377
 				break;
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 				$icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : '';
389 389
 				break;
390 390
 		}
391
-		return $icon . $status[ $this->status_ID() ];
391
+		return $icon.$status[$this->status_ID()];
392 392
 	}
393 393
 
394 394
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	 * @access        public
399 399
 	 */
400 400
 	public function status_ID() {
401
-		return $this->get( 'STS_ID' );
401
+		return $this->get('STS_ID');
402 402
 	}
403 403
 
404 404
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	 * @return boolean
409 409
 	 */
410 410
 	public function is_free() {
411
-		return (float)$this->get( 'TXN_total' ) == 0 ? TRUE : FALSE;
411
+		return (float) $this->get('TXN_total') == 0 ? TRUE : FALSE;
412 412
 	}
413 413
 
414 414
 
@@ -476,12 +476,12 @@  discard block
 block discarded – undo
476 476
 	 * @access public
477 477
 	 * @return string
478 478
 	 */
479
-	public function invoice_url( $type = 'html' ) {
479
+	public function invoice_url($type = 'html') {
480 480
 		$REG = $this->primary_registration();
481
-		if ( ! $REG instanceof EE_Registration ) {
481
+		if ( ! $REG instanceof EE_Registration) {
482 482
 			return '';
483 483
 		}
484
-		return $REG->invoice_url( $type );
484
+		return $REG->invoice_url($type);
485 485
 	}
486 486
 
487 487
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	 * @return EE_Registration
492 492
 	 */
493 493
 	public function primary_registration() {
494
-		return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) );
494
+		return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
495 495
 	}
496 496
 
497 497
 
@@ -501,12 +501,12 @@  discard block
 block discarded – undo
501 501
 	 * @param string $type 'pdf' or 'html' (default is 'html')
502 502
 	 * @return string
503 503
 	 */
504
-	public function receipt_url( $type = 'html' ) {
504
+	public function receipt_url($type = 'html') {
505 505
 		$REG = $this->primary_registration();
506
-		if ( ! $REG instanceof EE_Registration ) {
506
+		if ( ! $REG instanceof EE_Registration) {
507 507
 			return '';
508 508
 		}
509
-		return $REG->receipt_url( $type );
509
+		return $REG->receipt_url($type);
510 510
 	}
511 511
 
512 512
 
@@ -531,15 +531,15 @@  discard block
 block discarded – undo
531 531
 	 * @deprecated
532 532
 	 * @return boolean
533 533
 	 */
534
-	public function update_based_on_payments(){
534
+	public function update_based_on_payments() {
535 535
 		EE_Error::doing_it_wrong(
536
-			__CLASS__ . '::' . __FUNCTION__,
537
-			sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ),
536
+			__CLASS__.'::'.__FUNCTION__,
537
+			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
538 538
 			'4.6.0'
539 539
 		);
540 540
 		/** @type EE_Transaction_Processor $transaction_processor */
541
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
542
-		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this );
541
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
542
+		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this);
543 543
 	}
544 544
 
545 545
 
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	 * @return string
549 549
 	 */
550 550
 	public function gateway_response_on_transaction() {
551
-		$payment = $this->get_first_related( 'Payment' );
551
+		$payment = $this->get_first_related('Payment');
552 552
 		return $payment instanceof EE_Payment ? $payment->gateway_response() : '';
553 553
 	}
554 554
 
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 	 * @return EE_Status
560 560
 	 */
561 561
 	public function status_obj() {
562
-		return $this->get_first_related( 'Status' );
562
+		return $this->get_first_related('Status');
563 563
 	}
564 564
 
565 565
 
@@ -569,8 +569,8 @@  discard block
 block discarded – undo
569 569
 	 * @param array $query_params like EEM_Base::get_all
570 570
 	 * @return EE_Extra_Meta
571 571
 	 */
572
-	public function extra_meta( $query_params = array() ) {
573
-		return $this->get_many_related( 'Extra_Meta', $query_params );
572
+	public function extra_meta($query_params = array()) {
573
+		return $this->get_many_related('Extra_Meta', $query_params);
574 574
 	}
575 575
 
576 576
 
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
 	 * @param EE_Registration $registration
581 581
 	 * @return EE_Base_Class the relation was added to
582 582
 	 */
583
-	public function add_registration( EE_Registration $registration ) {
584
-		return $this->_add_relation_to( $registration, 'Registration' );
583
+	public function add_registration(EE_Registration $registration) {
584
+		return $this->_add_relation_to($registration, 'Registration');
585 585
 	}
586 586
 
587 587
 
@@ -592,8 +592,8 @@  discard block
 block discarded – undo
592 592
 	 * @param int $registration_or_id
593 593
 	 * @return EE_Base_Class that was removed from being related
594 594
 	 */
595
-	public function remove_registration_with_id( $registration_or_id ) {
596
-		return $this->_remove_relation_to( $registration_or_id, 'Registration' );
595
+	public function remove_registration_with_id($registration_or_id) {
596
+		return $this->_remove_relation_to($registration_or_id, 'Registration');
597 597
 	}
598 598
 
599 599
 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 	 * @return EE_Line_Item[]
604 604
 	 */
605 605
 	public function items_purchased() {
606
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) );
606
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item)));
607 607
 	}
608 608
 
609 609
 
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
 	 * @param EE_Line_Item $line_item
614 614
 	 * @return EE_Base_Class the relation was added to
615 615
 	 */
616
-	public function add_line_item( EE_Line_Item $line_item ) {
617
-		return $this->_add_relation_to( $line_item, 'Line_Item' );
616
+	public function add_line_item(EE_Line_Item $line_item) {
617
+		return $this->_add_relation_to($line_item, 'Line_Item');
618 618
 	}
619 619
 
620 620
 
@@ -624,8 +624,8 @@  discard block
 block discarded – undo
624 624
 	 * @param array $query_params
625 625
 	 * @return EE_Line_Item[]
626 626
 	 */
627
-	public function line_items( $query_params = array() ) {
628
-		return $this->get_many_related( 'Line_Item', $query_params );
627
+	public function line_items($query_params = array()) {
628
+		return $this->get_many_related('Line_Item', $query_params);
629 629
 	}
630 630
 
631 631
 
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 	 * @return EE_Line_Item[]
636 636
 	 */
637 637
 	public function tax_items() {
638
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) );
638
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax)));
639 639
 	}
640 640
 
641 641
 
@@ -646,9 +646,9 @@  discard block
 block discarded – undo
646 646
 	 * @return EE_Line_Item
647 647
 	 */
648 648
 	public function total_line_item() {
649
-		$item =  $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) );
650
-		if( ! $item ){
651
-			EE_Registry::instance()->load_helper( 'Line_Item' );
649
+		$item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total)));
650
+		if ( ! $item) {
651
+			EE_Registry::instance()->load_helper('Line_Item');
652 652
 			$item = EEH_Line_Item::create_default_total_line_item();
653 653
 		}
654 654
 		return $item;
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	 */
664 664
 	public function tax_total() {
665 665
 		$tax_line_item = $this->tax_total_line_item();
666
-		if ( $tax_line_item ) {
666
+		if ($tax_line_item) {
667 667
 			return $tax_line_item->total();
668 668
 		} else {
669 669
 			return 0;
@@ -677,9 +677,9 @@  discard block
 block discarded – undo
677 677
 	 * @return EE_Line_Item
678 678
 	 */
679 679
 	public function tax_total_line_item() {
680
-		$item =  $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax_sub_total ) ) );
681
-		if( ! $item ){
682
-			EE_Registry::instance()->load_helper( 'Line_Item' );
680
+		$item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax_sub_total)));
681
+		if ( ! $item) {
682
+			EE_Registry::instance()->load_helper('Line_Item');
683 683
 			$item = EEH_Line_Item::create_default_total_line_item();
684 684
 		}
685 685
 		return $item;
@@ -691,20 +691,20 @@  discard block
 block discarded – undo
691 691
 	 *  Gets the array of billing info for the gateway and for this transaction's primary registration's attendee.
692 692
 	 * @return EE_Form_Section_Proper
693 693
 	 */
694
-	public function billing_info(){
694
+	public function billing_info() {
695 695
 		$payment_method = $this->payment_method();
696
-		if ( !$payment_method){
696
+		if ( ! $payment_method) {
697 697
 			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__);
698 698
 			return false;
699 699
 		}
700 700
 		$primary_reg = $this->primary_registration();
701
-		if ( ! $primary_reg ) {
702
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
701
+		if ( ! $primary_reg) {
702
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
703 703
 			return FALSE;
704 704
 		}
705 705
 		$attendee = $primary_reg->attendee();
706
-		if ( ! $attendee ) {
707
-			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__ );
706
+		if ( ! $attendee) {
707
+			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__);
708 708
 			return FALSE;
709 709
 		}
710 710
 		return $attendee->billing_info_for_payment_method($payment_method);
@@ -739,15 +739,15 @@  discard block
 block discarded – undo
739 739
 	 * offline ones, dont' create payments)
740 740
 	 * @return EE_Payment_Method
741 741
 	 */
742
-	function payment_method(){
742
+	function payment_method() {
743 743
 		$pm = $this->get_first_related('Payment_Method');
744
-		if( $pm instanceof EE_Payment_Method ){
744
+		if ($pm instanceof EE_Payment_Method) {
745 745
 			return $pm;
746
-		}else{
746
+		} else {
747 747
 			$last_payment = $this->last_payment();
748
-			if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){
748
+			if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) {
749 749
 				return $last_payment->payment_method();
750
-			}else{
750
+			} else {
751 751
 				return NULL;
752 752
 			}
753 753
 		}
@@ -758,15 +758,15 @@  discard block
 block discarded – undo
758 758
 	 * @return EE_Payment
759 759
 	 */
760 760
 	public function last_payment() {
761
-		return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) );
761
+		return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc')));
762 762
 	}
763 763
 
764 764
 	/**
765 765
 	 * Gets all the line items which are unrelated to tickets on this transaction
766 766
 	 * @return EE_Line_Item[]
767 767
 	 */
768
-	public function non_ticket_line_items(){
769
-		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() );
768
+	public function non_ticket_line_items() {
769
+		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID());
770 770
 	}
771 771
 
772 772
 
Please login to merge, or discard this patch.
core/db_classes/EE_WP_User.class.php 1 patch
Spacing   +9 added lines, -9 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_WP_User class
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	 * @param array $props_n_values
23 23
 	 * @return EE_WP_User|mixed
24 24
 	 */
25
-	public static function new_instance( $props_n_values = array() ) {
26
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
27
-		return $has_object ? $has_object : new self( $props_n_values );
25
+	public static function new_instance($props_n_values = array()) {
26
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
27
+		return $has_object ? $has_object : new self($props_n_values);
28 28
 	}
29 29
 
30 30
 
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	 * @param array $props_n_values
34 34
 	 * @return EE_WP_User
35 35
 	 */
36
-	public static function new_instance_from_db( $props_n_values = array() ) {
37
-		return new self( $props_n_values, TRUE );
36
+	public static function new_instance_from_db($props_n_values = array()) {
37
+		return new self($props_n_values, TRUE);
38 38
 	}
39 39
 
40 40
 	/**
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @return WP_User
43 43
 	 */
44 44
 	public function wp_user_obj() {
45
-		if( ! $this->_wp_user_obj ) {
46
-			$this->_wp_user_obj = get_user_by('ID', $this->ID() );
45
+		if ( ! $this->_wp_user_obj) {
46
+			$this->_wp_user_obj = get_user_by('ID', $this->ID());
47 47
 		}
48 48
 		return $this->_wp_user_obj;
49 49
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Answer.model.php 2 patches
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -89,7 +91,7 @@  discard block
 block discarded – undo
89 91
 			if( $answer_obj instanceof EE_Answer ){
90 92
 				if($pretty_answer){
91 93
 					$value = $answer_obj->pretty_value();
92
-				}else{
94
+				} else{
93 95
 					$value = $answer_obj->value();
94 96
 				}
95 97
 			}
@@ -129,13 +131,13 @@  discard block
 block discarded – undo
129 131
 				if($field_name == 'STA_ID'){
130 132
 					$state = $registration->attendee()->state_obj();
131 133
 					$value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'),$registration->attendee()->state_ID());
132
-				}else if($field_name == 'CNT_ISO'){
134
+				} else if($field_name == 'CNT_ISO'){
133 135
 					$country = $registration->attendee()->country_obj();
134 136
 					$value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID());
135
-				}else{
137
+				} else{
136 138
 					$value = $registration->attendee()->get_pretty($field_name);
137 139
 				}
138
-			}else{
140
+			} else{
139 141
 				$value = $registration->attendee()->get($field_name);
140 142
 			}
141 143
 		}
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 	/**
51 51
 	 * 	constructor
52 52
 	 */
53
-	protected function __construct( $timezone = NULL ){
54
-		$this->singular_item = __('Answer','event_espresso');
55
-		$this->plural_item = __('Answers','event_espresso');
53
+	protected function __construct($timezone = NULL) {
54
+		$this->singular_item = __('Answer', 'event_espresso');
55
+		$this->plural_item = __('Answers', 'event_espresso');
56 56
 		$this->_tables = array(
57 57
 			'Answer'=> new EE_Primary_Table('esp_answer', 'ANS_ID')
58 58
 		);
59 59
 		$this->_fields = array(
60 60
 			'Answer'=>array(
61
-				'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID','event_espresso')),
62
-				'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID','event_espresso'), false, 0, 'Registration'),
63
-				'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'),
64
-				'ANS_value'=>new EE_Maybe_Serialized_Text_Field('ANS_value', __('Answer Value','event_espresso'), false, '')
61
+				'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID', 'event_espresso')),
62
+				'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'),
63
+				'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'),
64
+				'ANS_value'=>new EE_Maybe_Serialized_Text_Field('ANS_value', __('Answer Value', 'event_espresso'), false, '')
65 65
 			));
66 66
 		$this->_model_relations = array(
67 67
 			'Registration'=>new EE_Belongs_To_Relation(),
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		);
70 70
 		$this->_model_chain_to_wp_user = 'Registration.Event';
71 71
 
72
-		parent::__construct( $timezone );
72
+		parent::__construct($timezone);
73 73
 	}
74 74
 
75 75
 
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
 	 * @param boolean $pretty_answer whether to call 'pretty_value' or just 'value'
83 83
 	 * @return string
84 84
 	 */
85
-	public function get_answer_value_to_question( EE_Registration $registration, $question_id = NULL,$pretty_answer = FALSE ){
86
-		$value = $this->get_attendee_property_answer_value( $registration, $question_id, $pretty_answer );
87
-		if (  $value === NULL ){
88
-			$answer_obj = $this->get_registration_question_answer_object( $registration, $question_id, $pretty_answer );
89
-			if( $answer_obj instanceof EE_Answer ){
90
-				if($pretty_answer){
85
+	public function get_answer_value_to_question(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) {
86
+		$value = $this->get_attendee_property_answer_value($registration, $question_id, $pretty_answer);
87
+		if ($value === NULL) {
88
+			$answer_obj = $this->get_registration_question_answer_object($registration, $question_id, $pretty_answer);
89
+			if ($answer_obj instanceof EE_Answer) {
90
+				if ($pretty_answer) {
91 91
 					$value = $answer_obj->pretty_value();
92
-				}else{
92
+				} else {
93 93
 					$value = $answer_obj->value();
94 94
 				}
95 95
 			}
96 96
 		}
97
-		return apply_filters( 'FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id );
97
+		return apply_filters('FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id);
98 98
 	}
99 99
 
100 100
 
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	 * @param int $question_id
106 106
 	 * @return EE_Answer
107 107
 	 */
108
-	public function get_registration_question_answer_object( EE_Registration $registration, $question_id = NULL){
109
-		$answer_obj = $this->get_one( array( array( 'QST_ID'=>$question_id, 'REG_ID'=>$registration->ID() )));
110
-		return apply_filters( 'FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id );
108
+	public function get_registration_question_answer_object(EE_Registration $registration, $question_id = NULL) {
109
+		$answer_obj = $this->get_one(array(array('QST_ID'=>$question_id, 'REG_ID'=>$registration->ID())));
110
+		return apply_filters('FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id);
111 111
 	}
112 112
 
113 113
 
@@ -119,27 +119,27 @@  discard block
 block discarded – undo
119 119
 	 * @param boolean $pretty_answer
120 120
 	 * @return string
121 121
 	 */
122
-	public function get_attendee_property_answer_value( EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE ){
122
+	public function get_attendee_property_answer_value(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) {
123 123
 		$field_name = NULL;
124 124
 		$value = NULL;
125 125
 		//only bother checking if the registration has an attendee
126
-		if( $registration->attendee() instanceof EE_Attendee && isset($this->_question_id_to_att_field_map[$question_id])){
126
+		if ($registration->attendee() instanceof EE_Attendee && isset($this->_question_id_to_att_field_map[$question_id])) {
127 127
 			$field_name = $this->_question_id_to_att_field_map[$question_id];
128
-			if($pretty_answer){
129
-				if($field_name == 'STA_ID'){
128
+			if ($pretty_answer) {
129
+				if ($field_name == 'STA_ID') {
130 130
 					$state = $registration->attendee()->state_obj();
131
-					$value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'),$registration->attendee()->state_ID());
132
-				}else if($field_name == 'CNT_ISO'){
131
+					$value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID());
132
+				} else if ($field_name == 'CNT_ISO') {
133 133
 					$country = $registration->attendee()->country_obj();
134
-					$value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID());
135
-				}else{
134
+					$value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"), $registration->attendee()->country_ID());
135
+				} else {
136 136
 					$value = $registration->attendee()->get_pretty($field_name);
137 137
 				}
138
-			}else{
138
+			} else {
139 139
 				$value = $registration->attendee()->get($field_name);
140 140
 			}
141 141
 		}
142
-		return apply_filters( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id );
142
+		return apply_filters('FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id);
143 143
 	}
144 144
 
145 145
 
Please login to merge, or discard this patch.