Completed
Branch FET-9856-direct-instantiation (b60923)
by
unknown
10:35
created
data_migration_scripts/4_8_0_stages/EE_DMS_4_8_0_pretax_totals.dmsstage.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION')) {
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3 3
 	exit('No direct script access allowed');
4 4
 }
5 5
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  *
14 14
  * Migrates line items that used to have LIN_code="tickets" to "pre-tax-total"
15 15
  */
16
-class EE_DMS_4_8_0_pretax_totals extends EE_Data_Migration_Script_Stage{
16
+class EE_DMS_4_8_0_pretax_totals extends EE_Data_Migration_Script_Stage {
17 17
 
18 18
 	protected $_line_item_table_name;
19 19
 
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 		global $wpdb;
54 54
 		$rows_updated = $wpdb->update(
55 55
 				$this->_line_item_table_name,
56
-				array( 'LIN_code' => 'pre-tax-subtotal' ),
57
-				array( 'LIN_code' => 'tickets' ),
58
-				array( '%s' ),
59
-				array( '%s' ) );
56
+				array('LIN_code' => 'pre-tax-subtotal'),
57
+				array('LIN_code' => 'tickets'),
58
+				array('%s'),
59
+				array('%s') );
60 60
 		$this->set_completed();
61 61
 		return 1;
62 62
 	}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_Data_Migration_Script_Stage_Table.core.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
 	protected $_old_table;
22 22
 
23 23
 /**
24
-	 * Set in the constructor to add this sql to both the counting query in
25
-	 * EE_Data_Migration_Script_Stage_Table::_count_records_to_migrate() and
26
-	 * EE_Data_Migration_Script_Stage_Table::_get_rows().
27
-	 * Eg "where column_name like '%some_value%'"
28
-	 * @var string
29
-	 */
24
+ * Set in the constructor to add this sql to both the counting query in
25
+ * EE_Data_Migration_Script_Stage_Table::_count_records_to_migrate() and
26
+ * EE_Data_Migration_Script_Stage_Table::_get_rows().
27
+ * Eg "where column_name like '%some_value%'"
28
+ * @var string
29
+ */
30 30
 	protected $_extra_where_sql;
31 31
 
32 32
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 	 * @param int $num_items
42 42
 	 * @return int number of items ACTUALLY migrated
43 43
 	 */
44
-	function _migration_step($num_items=50){
45
-		$rows = $this->_get_rows( $num_items );
44
+	function _migration_step($num_items = 50) {
45
+		$rows = $this->_get_rows($num_items);
46 46
 		$items_actually_migrated = 0;
47
-		foreach($rows as $old_row){
47
+		foreach ($rows as $old_row) {
48 48
 			$this->_migrate_old_row($old_row);
49 49
 			$items_actually_migrated++;
50 50
 		}
51
-		if($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()){
51
+		if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
52 52
 			$this->set_completed();
53 53
 		}
54 54
 		return $items_actually_migrated;
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 	 * @param int $limit
61 61
 	 * @return array of arrays like $wpdb->get_results($sql, ARRAY_A)
62 62
 	 */
63
-	protected function _get_rows( $limit ){
63
+	protected function _get_rows($limit) {
64 64
 		global $wpdb;
65 65
 		$start_at_record = $this->count_records_migrated();
66
-		$query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} " . $wpdb->prepare("LIMIT %d, %d",$start_at_record,$limit);
67
-		return $wpdb->get_results($query,ARRAY_A);
66
+		$query = "SELECT * FROM {$this->_old_table} {$this->_extra_where_sql} ".$wpdb->prepare("LIMIT %d, %d", $start_at_record, $limit);
67
+		return $wpdb->get_results($query, ARRAY_A);
68 68
 	}
69 69
 
70 70
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	function _count_records_to_migrate() {
77 77
 		global $wpdb;
78
-		$query =  "SELECT COUNT(*) FROM {$this->_old_table} {$this->_extra_where_sql}";
79
-		$count = $wpdb->get_var( $query );
78
+		$query = "SELECT COUNT(*) FROM {$this->_old_table} {$this->_extra_where_sql}";
79
+		$count = $wpdb->get_var($query);
80 80
 		return $count;
81 81
 	}
82 82
 
Please login to merge, or discard this patch.
core/db_classes/EE_Checkin.class.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 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
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
3 5
 /**
4 6
  * Event Espresso
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
+do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3 3
 /**
4 4
  * Event Espresso
5 5
  *
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @subpackage		includes/classes/EE_Checkin.class.php
24 24
  * @author				Darren Ethier
25 25
  */
26
-class EE_Checkin extends EE_Base_Class{
26
+class EE_Checkin extends EE_Base_Class {
27 27
 
28 28
 
29 29
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Datetime.class.php 4 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -708,12 +708,10 @@
 block discarded – undo
708 708
 		if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) ) {
709 709
 			$display_date = $this->start_date( 'M j\, Y g:i a' ) . ' - ' . $this->end_date( 'M j\, Y g:i a' );
710 710
 			//next condition is if its the same month but different day
711
-		}
712
-		else {
711
+		} else {
713 712
 			if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) == date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) && date( 'd', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'd', $this->get_raw( 'DTT_EVT_end' ) ) ) {
714 713
 				$display_date = $this->start_date( 'M j\, g:i a' ) . ' - ' . $this->end_date( 'M j\, g:i a Y' );
715
-			}
716
-			else {
714
+			} else {
717 715
 				$display_date = $this->start_date( 'F j\, Y' ) . ' @ ' . $this->start_date( 'g:i a' ) . ' - ' . $this->end_date( 'g:i a' );
718 716
 			}
719 717
 		}
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 * increments reserved by amount passed by $qty
254 254
 	 *
255 255
 	 * @param int $qty
256
-	 * @return boolean
256
+	 * @return boolean|null
257 257
 	 */
258 258
 	public function increase_reserved( $qty = 1 ) {
259 259
 		$reserved = $this->reserved() + absint( $qty );
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 * decrements (subtracts) reserved by amount passed by $qty
267 267
 	 *
268 268
 	 * @param int $qty
269
-	 * @return boolean
269
+	 * @return boolean|null
270 270
 	 */
271 271
 	public function decrease_reserved( $qty = 1 ) {
272 272
 		$reserved = $this->reserved() - absint( $qty );
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 	 * @param string $dt_frmt     - string representation of date format defaults to WP settings
412 412
 	 * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with
413 413
 	 *                            the end date ie: Jan 01 "to" Dec 31
414
-	 * @return mixed        string on success, FALSE on fail
414
+	 * @return string        string on success, FALSE on fail
415 415
 	 * @throws \EE_Error
416 416
 	 */
417 417
 	public function date_range( $dt_frmt = '', $conjunction = ' - ' ) {
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 	 * @param string $tm_format   string representation of time format defaults to 'g:i a'
484 484
 	 * @param string $conjunction conjunction junction what's your function ?
485 485
 	 *                            this string joins the start date with the end date ie: Jan 01 "to" Dec 31
486
-	 * @return mixed              string on success, FALSE on fail
486
+	 * @return string              string on success, FALSE on fail
487 487
 	 * @throws \EE_Error
488 488
 	 */
489 489
 	public function time_range( $tm_format = '', $conjunction = ' - ' ) {
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -358,13 +358,13 @@  discard block
 block discarded – undo
358 358
 
359 359
 
360 360
 
361
-    /**
362
-     * get event start date.  Provide either the date format, or NULL to re-use the
363
-     * last-used format, or '' to use the default date format
364
-     *
365
-     * @param string $dt_frmt - string representation of date format defaults to 'F j, Y'
366
-     * @return        mixed        string on success, FALSE on fail
367
-     */
361
+	/**
362
+	 * get event start date.  Provide either the date format, or NULL to re-use the
363
+	 * last-used format, or '' to use the default date format
364
+	 *
365
+	 * @param string $dt_frmt - string representation of date format defaults to 'F j, Y'
366
+	 * @return        mixed        string on success, FALSE on fail
367
+	 */
368 368
 	public function start_date( $dt_frmt = '' ) {
369 369
 		return $this->_show_datetime( 'D', 'start', $dt_frmt );
370 370
 	}
@@ -381,13 +381,13 @@  discard block
 block discarded – undo
381 381
 
382 382
 
383 383
 
384
-    /**
385
-     * get end date. Provide either the date format, or NULL to re-use the
386
-     * last-used format, or '' to use the default date format
387
-     *
388
-     * @param string $dt_frmt - string representation of date format defaults to 'F j, Y'
389
-     * @return        mixed        string on success, FALSE on fail
390
-     */
384
+	/**
385
+	 * get end date. Provide either the date format, or NULL to re-use the
386
+	 * last-used format, or '' to use the default date format
387
+	 *
388
+	 * @param string $dt_frmt - string representation of date format defaults to 'F j, Y'
389
+	 * @return        mixed        string on success, FALSE on fail
390
+	 */
391 391
 	public function end_date( $dt_frmt = '' ) {
392 392
 		return $this->_show_datetime( 'D', 'end', $dt_frmt );
393 393
 	}
@@ -509,23 +509,23 @@  discard block
 block discarded – undo
509 509
 	/**
510 510
 	 * This returns a range representation of the date and times.
511 511
 	 * Output is dependent on the difference (or similarity) between DTT_EVT_start and DTT_EVT_end.
512
-     * Also, the return value is localized.
513
-     *
514
-     * @param string $dt_format
512
+	 * Also, the return value is localized.
513
+	 *
514
+	 * @param string $dt_format
515 515
 	 * @param string $tm_format
516 516
 	 * @param string $conjunction used between two different dates or times.
517
-     *                            ex: Dec 1{$conjunction}}Dec 6, or 2pm{$conjunction}3pm
518
-     * @param string $separator   used between the date and time formats.
519
-     *                            ex: Dec 1, 2016{$separator}2pm
517
+	 *                            ex: Dec 1{$conjunction}}Dec 6, or 2pm{$conjunction}3pm
518
+	 * @param string $separator   used between the date and time formats.
519
+	 *                            ex: Dec 1, 2016{$separator}2pm
520 520
 	 * @return string
521 521
 	 * @throws \EE_Error
522 522
 	 */
523 523
 	public function date_and_time_range(
524
-	    $dt_format = '',
525
-        $tm_format = '',
526
-        $conjunction = ' - ' ,
527
-        $separator = ' '
528
-    ) {
524
+		$dt_format = '',
525
+		$tm_format = '',
526
+		$conjunction = ' - ' ,
527
+		$separator = ' '
528
+	) {
529 529
 		$dt_format = ! empty( $dt_format ) ? $dt_format : $this->_dt_frmt;
530 530
 		$tm_format = ! empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
531 531
 		$full_format = $dt_format . $separator . $tm_format;
@@ -539,14 +539,14 @@  discard block
 block discarded – undo
539 539
 			//start and end date are the same but times are different
540 540
 			case ( $this->start_date() === $this->end_date() ) :
541 541
 				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format )
542
-				          . $conjunction
543
-				          . $this->get_i18n_datetime( 'DTT_EVT_end', $tm_format );
542
+						  . $conjunction
543
+						  . $this->get_i18n_datetime( 'DTT_EVT_end', $tm_format );
544 544
 				break;
545 545
 			//all other conditions
546 546
 			default :
547 547
 				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format )
548
-				          . $conjunction
549
-				          . $this->get_i18n_datetime( 'DTT_EVT_end', $full_format );
548
+						  . $conjunction
549
+						  . $this->get_i18n_datetime( 'DTT_EVT_end', $full_format );
550 550
 				break;
551 551
 		}
552 552
 		return $output;
@@ -630,13 +630,13 @@  discard block
 block discarded – undo
630 630
 
631 631
 
632 632
 	/**
633
-     *        get end date and time
634
-     *
635
-     * @param string $dt_frmt   - string representation of date format defaults to 'F j, Y'
636
-     * @param string $tm_format - string representation of time format defaults to 'g:i a'
637
-     * @return    mixed                string on success, FALSE on fail
638
-     */
639
-    public function end_date_and_time($dt_frmt = '', $tm_format = '') {
633
+	 *        get end date and time
634
+	 *
635
+	 * @param string $dt_frmt   - string representation of date format defaults to 'F j, Y'
636
+	 * @param string $tm_format - string representation of time format defaults to 'g:i a'
637
+	 * @return    mixed                string on success, FALSE on fail
638
+	 */
639
+	public function end_date_and_time($dt_frmt = '', $tm_format = '') {
640 640
 		return $this->_show_datetime( '', 'end', $dt_frmt, $tm_format );
641 641
 	}
642 642
 
@@ -905,13 +905,13 @@  discard block
 block discarded – undo
905 905
 
906 906
 
907 907
 
908
-    /**
909
-     * Updates the DTT_sold attribute (and saves) based on the number of registrations for this datetime (via the tickets).
910
-     * into account
911
-     *
912
-     * @return int
913
-     * @throws \EE_Error
914
-     */
908
+	/**
909
+	 * Updates the DTT_sold attribute (and saves) based on the number of registrations for this datetime (via the tickets).
910
+	 * into account
911
+	 *
912
+	 * @return int
913
+	 * @throws \EE_Error
914
+	 */
915 915
 	public function update_sold() {
916 916
 		$count_regs_for_this_datetime = EEM_Registration::instance()->count(
917 917
 			array( array(
@@ -920,14 +920,14 @@  discard block
 block discarded – undo
920 920
 				'Ticket.Datetime.DTT_ID' 	=> $this->ID(),
921 921
 			) )
922 922
 		);
923
-        $sold = $this->sold();
924
-        if ($count_regs_for_this_datetime > $sold) {
925
-            $this->increase_sold($count_regs_for_this_datetime - $sold);
926
-            $this->save();
927
-        } else if ($count_regs_for_this_datetime < $sold) {
928
-            $this->decrease_sold($count_regs_for_this_datetime - $sold);
929
-            $this->save();
930
-        }
923
+		$sold = $this->sold();
924
+		if ($count_regs_for_this_datetime > $sold) {
925
+			$this->increase_sold($count_regs_for_this_datetime - $sold);
926
+			$this->save();
927
+		} else if ($count_regs_for_this_datetime < $sold) {
928
+			$this->decrease_sold($count_regs_for_this_datetime - $sold);
929
+			$this->save();
930
+		}
931 931
 		return $count_regs_for_this_datetime;
932 932
 	}
933 933
 }
Please login to merge, or discard this patch.
Spacing   +144 added lines, -144 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
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	/**
69 69
 	 * @param $name
70 70
 	 */
71
-	public function set_name( $name ) {
72
-		$this->set( 'DTT_name', $name );
71
+	public function set_name($name) {
72
+		$this->set('DTT_name', $name);
73 73
 	}
74 74
 
75 75
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	/**
78 78
 	 * @param $description
79 79
 	 */
80
-	public function set_description( $description ) {
81
-		$this->set( 'DTT_description', $description );
80
+	public function set_description($description) {
81
+		$this->set('DTT_description', $description);
82 82
 	}
83 83
 
84 84
 
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
92 92
 	 */
93
-	public function set_start_date( $date ) {
94
-		$this->_set_date_for( $date, 'DTT_EVT_start' );
93
+	public function set_start_date($date) {
94
+		$this->_set_date_for($date, 'DTT_EVT_start');
95 95
 	}
96 96
 
97 97
 
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
105 105
 	 */
106
-	public function set_start_time( $time ) {
107
-		$this->_set_time_for( $time, 'DTT_EVT_start' );
106
+	public function set_start_time($time) {
107
+		$this->_set_time_for($time, 'DTT_EVT_start');
108 108
 	}
109 109
 
110 110
 
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
118 118
 	 */
119
-	public function set_end_date( $date ) {
120
-		$this->_set_date_for( $date, 'DTT_EVT_end' );
119
+	public function set_end_date($date) {
120
+		$this->_set_date_for($date, 'DTT_EVT_end');
121 121
 	}
122 122
 
123 123
 
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
131 131
 	 */
132
-	public function set_end_time( $time ) {
133
-		$this->_set_time_for( $time, 'DTT_EVT_end' );
132
+	public function set_end_time($time) {
133
+		$this->_set_time_for($time, 'DTT_EVT_end');
134 134
 	}
135 135
 
136 136
 
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @param        int $reg_limit
144 144
 	 */
145
-	public function set_reg_limit( $reg_limit ) {
146
-		$this->set( 'DTT_reg_limit', $reg_limit );
145
+	public function set_reg_limit($reg_limit) {
146
+		$this->set('DTT_reg_limit', $reg_limit);
147 147
 	}
148 148
 
149 149
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @return        mixed        int on success, FALSE on fail
156 156
 	 */
157 157
 	public function sold() {
158
-		return $this->get_raw( 'DTT_sold' );
158
+		return $this->get_raw('DTT_sold');
159 159
 	}
160 160
 
161 161
 
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @param        int $sold
167 167
 	 */
168
-	public function set_sold( $sold ) {
168
+	public function set_sold($sold) {
169 169
 		// sold can not go below zero
170
-		$sold = max( 0, $sold );
171
-		$this->set( 'DTT_sold', $sold );
170
+		$sold = max(0, $sold);
171
+		$this->set('DTT_sold', $sold);
172 172
 	}
173 173
 
174 174
 
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 	 * increments sold by amount passed by $qty
178 178
 	 * @param int $qty
179 179
 	 */
180
-	public function increase_sold( $qty = 1 ) {
180
+	public function increase_sold($qty = 1) {
181 181
 		$sold = $this->sold() + $qty;
182 182
 		// remove ticket reservation
183
-		$this->decrease_reserved( $qty );
184
-		$this->set_sold( $sold );
183
+		$this->decrease_reserved($qty);
184
+		$this->set_sold($sold);
185 185
 	}
186 186
 
187 187
 
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	 * decrements (subtracts) sold amount passed by $qty
191 191
 	 * @param int $qty
192 192
 	 */
193
-	public function decrease_sold( $qty = 1 ) {
193
+	public function decrease_sold($qty = 1) {
194 194
 		$sold = $this->sold() - $qty;
195
-		$this->set_sold( $sold );
195
+		$this->set_sold($sold);
196 196
 	}
197 197
 
198 198
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * @return int
204 204
 	 */
205 205
 	public function reserved() {
206
-		return $this->get_raw( 'DTT_reserved' );
206
+		return $this->get_raw('DTT_reserved');
207 207
 	}
208 208
 
209 209
 
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
 	 *
214 214
 	 * @param int $reserved
215 215
 	 */
216
-	public function set_reserved( $reserved ) {
216
+	public function set_reserved($reserved) {
217 217
 		// reserved can not go below zero
218
-		$reserved = max( 0, (int) $reserved );
219
-		$this->set( 'DTT_reserved', $reserved );
218
+		$reserved = max(0, (int) $reserved);
219
+		$this->set('DTT_reserved', $reserved);
220 220
 	}
221 221
 
222 222
 
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 	 * @param int $qty
228 228
 	 * @return boolean
229 229
 	 */
230
-	public function increase_reserved( $qty = 1 ) {
231
-		$reserved = $this->reserved() + absint( $qty );
232
-		return $this->set_reserved( $reserved );
230
+	public function increase_reserved($qty = 1) {
231
+		$reserved = $this->reserved() + absint($qty);
232
+		return $this->set_reserved($reserved);
233 233
 	}
234 234
 
235 235
 
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
 	 * @param int $qty
241 241
 	 * @return boolean
242 242
 	 */
243
-	public function decrease_reserved( $qty = 1 ) {
244
-		$reserved = $this->reserved() - absint( $qty );
245
-		return $this->set_reserved( $reserved );
243
+	public function decrease_reserved($qty = 1) {
244
+		$reserved = $this->reserved() - absint($qty);
245
+		return $this->set_reserved($reserved);
246 246
 	}
247 247
 
248 248
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 * @return string
264 264
 	 */
265 265
 	public function name() {
266
-		return $this->get( 'DTT_name' );
266
+		return $this->get('DTT_name');
267 267
 	}
268 268
 
269 269
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @return string
274 274
 	 */
275 275
 	public function description() {
276
-		return $this->get( 'DTT_description' );
276
+		return $this->get('DTT_description');
277 277
 	}
278 278
 
279 279
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 * @return boolean          TRUE if is primary, FALSE if not.
284 284
 	 */
285 285
 	public function is_primary() {
286
-		return $this->get( 'DTT_is_primary' );
286
+		return $this->get('DTT_is_primary');
287 287
 	}
288 288
 
289 289
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	 * @return int         The order of the datetime for this event.
294 294
 	 */
295 295
 	public function order() {
296
-		return $this->get( 'DTT_order' );
296
+		return $this->get('DTT_order');
297 297
 	}
298 298
 
299 299
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 * @return int
304 304
 	 */
305 305
 	public function parent() {
306
-		return $this->get( 'DTT_parent' );
306
+		return $this->get('DTT_parent');
307 307
 	}
308 308
 
309 309
 
@@ -319,10 +319,10 @@  discard block
 block discarded – undo
319 319
 	 * @param    bool   $echo         - whether we echo or return (note echoing uses "pretty" formats, otherwise we use the standard formats)
320 320
 	 * @return    string|bool  string on success, FALSE on fail
321 321
 	 */
322
-	private function _show_datetime( $date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE ) {
322
+	private function _show_datetime($date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE) {
323 323
 		$field_name = "DTT_EVT_{$start_or_end}";
324
-		$dtt = $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo );
325
-		if ( ! $echo ) {
324
+		$dtt = $this->_get_datetime($field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo);
325
+		if ( ! $echo) {
326 326
 			return $dtt;
327 327
 		}
328 328
 		return '';
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
      * @param string $dt_frmt - string representation of date format defaults to 'F j, Y'
338 338
      * @return        mixed        string on success, FALSE on fail
339 339
      */
340
-	public function start_date( $dt_frmt = '' ) {
341
-		return $this->_show_datetime( 'D', 'start', $dt_frmt );
340
+	public function start_date($dt_frmt = '') {
341
+		return $this->_show_datetime('D', 'start', $dt_frmt);
342 342
 	}
343 343
 
344 344
 
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
 	 * Echoes start_date()
348 348
 	 * @param string $dt_frmt
349 349
 	 */
350
-	public function e_start_date( $dt_frmt = '' ) {
351
-		$this->_show_datetime( 'D', 'start', $dt_frmt, NULL, TRUE );
350
+	public function e_start_date($dt_frmt = '') {
351
+		$this->_show_datetime('D', 'start', $dt_frmt, NULL, TRUE);
352 352
 	}
353 353
 
354 354
 
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
      * @param string $dt_frmt - string representation of date format defaults to 'F j, Y'
361 361
      * @return        mixed        string on success, FALSE on fail
362 362
      */
363
-	public function end_date( $dt_frmt = '' ) {
364
-		return $this->_show_datetime( 'D', 'end', $dt_frmt );
363
+	public function end_date($dt_frmt = '') {
364
+		return $this->_show_datetime('D', 'end', $dt_frmt);
365 365
 	}
366 366
 
367 367
 
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 	 * Echoes the end date. See end_date()
371 371
 	 * @param string $dt_frmt
372 372
 	 */
373
-	public function e_end_date( $dt_frmt = '' ) {
374
-		$this->_show_datetime( 'D', 'end', $dt_frmt, NULL, TRUE );
373
+	public function e_end_date($dt_frmt = '') {
374
+		$this->_show_datetime('D', 'end', $dt_frmt, NULL, TRUE);
375 375
 	}
376 376
 
377 377
 
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
 	 * @return mixed        string on success, FALSE on fail
387 387
 	 * @throws \EE_Error
388 388
 	 */
389
-	public function date_range( $dt_frmt = '', $conjunction = ' - ' ) {
390
-		$dt_frmt = ! empty( $dt_frmt ) ? $dt_frmt : $this->_dt_frmt;
391
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $dt_frmt ) );
392
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end', $dt_frmt ) );
393
-		return $start !== $end ? $start . $conjunction . $end : $start;
389
+	public function date_range($dt_frmt = '', $conjunction = ' - ') {
390
+		$dt_frmt = ! empty($dt_frmt) ? $dt_frmt : $this->_dt_frmt;
391
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $dt_frmt));
392
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $dt_frmt));
393
+		return $start !== $end ? $start.$conjunction.$end : $start;
394 394
 	}
395 395
 
396 396
 
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
 	 * @param string $conjunction
401 401
 	 * @throws \EE_Error
402 402
 	 */
403
-	public function e_date_range( $dt_frmt = '', $conjunction = ' - ' ) {
404
-		echo $this->date_range( $dt_frmt, $conjunction );
403
+	public function e_date_range($dt_frmt = '', $conjunction = ' - ') {
404
+		echo $this->date_range($dt_frmt, $conjunction);
405 405
 	}
406 406
 
407 407
 
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
 	 * @param string $tm_format - string representation of time format defaults to 'g:i a'
413 413
 	 * @return mixed        string on success, FALSE on fail
414 414
 	 */
415
-	public function start_time( $tm_format = '' ) {
416
-		return $this->_show_datetime( 'T', 'start', NULL, $tm_format );
415
+	public function start_time($tm_format = '') {
416
+		return $this->_show_datetime('T', 'start', NULL, $tm_format);
417 417
 	}
418 418
 
419 419
 
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 	/**
422 422
 	 * @param string $tm_format
423 423
 	 */
424
-	public function e_start_time( $tm_format = '' ) {
425
-		$this->_show_datetime( 'T', 'start', NULL, $tm_format, TRUE );
424
+	public function e_start_time($tm_format = '') {
425
+		$this->_show_datetime('T', 'start', NULL, $tm_format, TRUE);
426 426
 	}
427 427
 
428 428
 
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 	 * @param string $tm_format - string representation of time format defaults to 'g:i a'
434 434
 	 * @return mixed        string on success, FALSE on fail
435 435
 	 */
436
-	public function end_time( $tm_format = '' ) {
437
-		return $this->_show_datetime( 'T', 'end', NULL, $tm_format );
436
+	public function end_time($tm_format = '') {
437
+		return $this->_show_datetime('T', 'end', NULL, $tm_format);
438 438
 	}
439 439
 
440 440
 
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
 	/**
443 443
 	 * @param string $tm_format
444 444
 	 */
445
-	public function e_end_time( $tm_format = '' ) {
446
-		$this->_show_datetime( 'T', 'end', NULL, $tm_format, TRUE );
445
+	public function e_end_time($tm_format = '') {
446
+		$this->_show_datetime('T', 'end', NULL, $tm_format, TRUE);
447 447
 	}
448 448
 
449 449
 
@@ -458,11 +458,11 @@  discard block
 block discarded – undo
458 458
 	 * @return mixed              string on success, FALSE on fail
459 459
 	 * @throws \EE_Error
460 460
 	 */
461
-	public function time_range( $tm_format = '', $conjunction = ' - ' ) {
462
-		$tm_format = ! empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
463
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $tm_format ) );
464
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end',  $tm_format ) );
465
-		return $start !== $end ? $start . $conjunction . $end : $start;
461
+	public function time_range($tm_format = '', $conjunction = ' - ') {
462
+		$tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt;
463
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $tm_format));
464
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $tm_format));
465
+		return $start !== $end ? $start.$conjunction.$end : $start;
466 466
 	}
467 467
 
468 468
 
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 	 * @param string $conjunction
473 473
 	 * @throws \EE_Error
474 474
 	 */
475
-	public function e_time_range( $tm_format = '', $conjunction = ' - ' ) {
476
-		echo $this->time_range( $tm_format, $conjunction );
475
+	public function e_time_range($tm_format = '', $conjunction = ' - ') {
476
+		echo $this->time_range($tm_format, $conjunction);
477 477
 	}
478 478
 
479 479
 
@@ -495,30 +495,30 @@  discard block
 block discarded – undo
495 495
 	public function date_and_time_range(
496 496
 	    $dt_format = '',
497 497
         $tm_format = '',
498
-        $conjunction = ' - ' ,
498
+        $conjunction = ' - ',
499 499
         $separator = ' '
500 500
     ) {
501
-		$dt_format = ! empty( $dt_format ) ? $dt_format : $this->_dt_frmt;
502
-		$tm_format = ! empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
503
-		$full_format = $dt_format . $separator . $tm_format;
501
+		$dt_format = ! empty($dt_format) ? $dt_format : $this->_dt_frmt;
502
+		$tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt;
503
+		$full_format = $dt_format.$separator.$tm_format;
504 504
 
505 505
 		//the range output depends on various conditions
506
-		switch ( true ) {
506
+		switch (true) {
507 507
 			//start date timestamp and end date timestamp are the same.
508
-			case ( $this->get_raw( 'DTT_EVT_start' ) === $this->get_raw( 'DTT_EVT_end' ) ) :
509
-				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format );
508
+			case ($this->get_raw('DTT_EVT_start') === $this->get_raw('DTT_EVT_end')) :
509
+				$output = $this->get_i18n_datetime('DTT_EVT_start', $full_format);
510 510
 				break;
511 511
 			//start and end date are the same but times are different
512
-			case ( $this->start_date() === $this->end_date() ) :
513
-				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format )
512
+			case ($this->start_date() === $this->end_date()) :
513
+				$output = $this->get_i18n_datetime('DTT_EVT_start', $full_format)
514 514
 				          . $conjunction
515
-				          . $this->get_i18n_datetime( 'DTT_EVT_end', $tm_format );
515
+				          . $this->get_i18n_datetime('DTT_EVT_end', $tm_format);
516 516
 				break;
517 517
 			//all other conditions
518 518
 			default :
519
-				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format )
519
+				$output = $this->get_i18n_datetime('DTT_EVT_start', $full_format)
520 520
 				          . $conjunction
521
-				          . $this->get_i18n_datetime( 'DTT_EVT_end', $full_format );
521
+				          . $this->get_i18n_datetime('DTT_EVT_end', $full_format);
522 522
 				break;
523 523
 		}
524 524
 		return $output;
@@ -536,8 +536,8 @@  discard block
 block discarded – undo
536 536
 	 * @return void
537 537
 	 * @throws \EE_Error
538 538
 	 */
539
-	public function e_date_and_time_range( $dt_format = '', $tm_format = '', $conjunction = ' - ' ) {
540
-		echo $this->date_and_time_range( $dt_format, $tm_format, $conjunction );
539
+	public function e_date_and_time_range($dt_format = '', $tm_format = '', $conjunction = ' - ') {
540
+		echo $this->date_and_time_range($dt_format, $tm_format, $conjunction);
541 541
 	}
542 542
 
543 543
 
@@ -549,8 +549,8 @@  discard block
 block discarded – undo
549 549
 	 * @param 	string 	$tm_format - string representation of time format defaults to 'g:i a'
550 550
 	 * @return 	mixed 	string on success, FALSE on fail
551 551
 	 */
552
-	public function start_date_and_time( $dt_format = '', $tm_format = '' ) {
553
-		return $this->_show_datetime( '', 'start', $dt_format, $tm_format );
552
+	public function start_date_and_time($dt_format = '', $tm_format = '') {
553
+		return $this->_show_datetime('', 'start', $dt_format, $tm_format);
554 554
 	}
555 555
 
556 556
 
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
 	 * @param string $dt_frmt
560 560
 	 * @param string $tm_format
561 561
 	 */
562
-	public function e_start_date_and_time( $dt_frmt = '', $tm_format = '' ) {
563
-		$this->_show_datetime( '', 'start', $dt_frmt, $tm_format, TRUE );
562
+	public function e_start_date_and_time($dt_frmt = '', $tm_format = '') {
563
+		$this->_show_datetime('', 'start', $dt_frmt, $tm_format, TRUE);
564 564
 	}
565 565
 
566 566
 
@@ -574,11 +574,11 @@  discard block
 block discarded – undo
574 574
 	 * @param bool   $round_up
575 575
 	 * @return float|int|mixed
576 576
 	 */
577
-	public function length( $units = 'seconds', $round_up = FALSE ) {
578
-		$start = $this->get_raw( 'DTT_EVT_start' );
579
-		$end = $this->get_raw( 'DTT_EVT_end' );
577
+	public function length($units = 'seconds', $round_up = FALSE) {
578
+		$start = $this->get_raw('DTT_EVT_start');
579
+		$end = $this->get_raw('DTT_EVT_end');
580 580
 		$length_in_units = $end - $start;
581
-		switch ( $units ) {
581
+		switch ($units) {
582 582
 			//NOTE: We purposefully don't use "break;" in order to chain the divisions
583 583
 			/** @noinspection PhpMissingBreakStatementInspection */
584 584
 			case 'days':
@@ -591,10 +591,10 @@  discard block
 block discarded – undo
591 591
 				$length_in_units /= 60;
592 592
 			case 'seconds':
593 593
 			default:
594
-				$length_in_units = ceil( $length_in_units );
594
+				$length_in_units = ceil($length_in_units);
595 595
 		}
596
-		if ( $round_up ) {
597
-			$length_in_units = max( $length_in_units, 1 );
596
+		if ($round_up) {
597
+			$length_in_units = max($length_in_units, 1);
598 598
 		}
599 599
 		return $length_in_units;
600 600
 	}
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
      * @return    mixed                string on success, FALSE on fail
610 610
      */
611 611
     public function end_date_and_time($dt_frmt = '', $tm_format = '') {
612
-		return $this->_show_datetime( '', 'end', $dt_frmt, $tm_format );
612
+		return $this->_show_datetime('', 'end', $dt_frmt, $tm_format);
613 613
 	}
614 614
 
615 615
 
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
 	 * @param string $dt_frmt
619 619
 	 * @param string $tm_format
620 620
 	 */
621
-	public function e_end_date_and_time( $dt_frmt = '', $tm_format = '' ) {
622
-		$this->_show_datetime( '', 'end', $dt_frmt, $tm_format, TRUE );
621
+	public function e_end_date_and_time($dt_frmt = '', $tm_format = '') {
622
+		$this->_show_datetime('', 'end', $dt_frmt, $tm_format, TRUE);
623 623
 	}
624 624
 
625 625
 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 	 * @return        int
631 631
 	 */
632 632
 	public function start() {
633
-		return $this->get_raw( 'DTT_EVT_start' );
633
+		return $this->get_raw('DTT_EVT_start');
634 634
 	}
635 635
 
636 636
 
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 	 * @return        int
642 642
 	 */
643 643
 	public function end() {
644
-		return $this->get_raw( 'DTT_EVT_end' );
644
+		return $this->get_raw('DTT_EVT_end');
645 645
 	}
646 646
 
647 647
 
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 	 * @return        mixed        int on success, FALSE on fail
653 653
 	 */
654 654
 	public function reg_limit() {
655
-		return $this->get_raw( 'DTT_reg_limit' );
655
+		return $this->get_raw('DTT_reg_limit');
656 656
 	}
657 657
 
658 658
 
@@ -680,15 +680,15 @@  discard block
 block discarded – undo
680 680
 	 * 																	the spaces remaining for this particular datetime, hence the flag.
681 681
 	 * @return 	int
682 682
 	 */
683
-	public function spaces_remaining( $consider_tickets = FALSE ) {
683
+	public function spaces_remaining($consider_tickets = FALSE) {
684 684
 		// tickets remaining available for purchase
685 685
 		//no need for special checks for infinite, because if DTT_reg_limit == EE_INF, then EE_INF - x = EE_INF
686 686
 		$dtt_remaining = $this->reg_limit() - $this->sold_and_reserved();
687
-		if ( ! $consider_tickets ) {
687
+		if ( ! $consider_tickets) {
688 688
 			return $dtt_remaining;
689 689
 		}
690 690
 		$tickets_remaining = $this->tickets_remaining();
691
-		return min( $dtt_remaining, $tickets_remaining );
691
+		return min($dtt_remaining, $tickets_remaining);
692 692
 	}
693 693
 
694 694
 
@@ -699,19 +699,19 @@  discard block
 block discarded – undo
699 699
 	 * @param array $query_params like EEM_Base::get_all's
700 700
 	 * @return int
701 701
 	 */
702
-	public function tickets_remaining( $query_params = array() ) {
702
+	public function tickets_remaining($query_params = array()) {
703 703
 		$sum = 0;
704
-		$tickets = $this->tickets( $query_params );
705
-		if ( ! empty( $tickets ) ) {
706
-			foreach ( $tickets as $ticket ) {
707
-				if ( $ticket instanceof EE_Ticket ) {
704
+		$tickets = $this->tickets($query_params);
705
+		if ( ! empty($tickets)) {
706
+			foreach ($tickets as $ticket) {
707
+				if ($ticket instanceof EE_Ticket) {
708 708
 					// get the actual amount of tickets that can be sold
709
-					$qty = $ticket->qty( 'saleable' );
710
-					if ( $qty === EE_INF ) {
709
+					$qty = $ticket->qty('saleable');
710
+					if ($qty === EE_INF) {
711 711
 						return EE_INF;
712 712
 					}
713 713
 					// no negative ticket quantities plz
714
-					if ( $qty > 0 ) {
714
+					if ($qty > 0) {
715 715
 						$sum += $qty;
716 716
 					}
717 717
 				}
@@ -728,8 +728,8 @@  discard block
 block discarded – undo
728 728
 	 * @param array $query_params like EEM_Base::get_all's
729 729
 	 * @return int
730 730
 	 */
731
-	public function sum_tickets_initially_available( $query_params = array() ) {
732
-		return $this->sum_related( 'Ticket', $query_params, 'TKT_qty' );
731
+	public function sum_tickets_initially_available($query_params = array()) {
732
+		return $this->sum_related('Ticket', $query_params, 'TKT_qty');
733 733
 	}
734 734
 
735 735
 
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 	 * @return int
742 742
 	 */
743 743
 	public function total_tickets_available_at_this_datetime() {
744
-		return $this->spaces_remaining( true );
744
+		return $this->spaces_remaining(true);
745 745
 	}
746 746
 
747 747
 
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 	 * @return boolean
753 753
 	 */
754 754
 	public function is_upcoming() {
755
-		return ( $this->get_raw( 'DTT_EVT_start' ) > time() );
755
+		return ($this->get_raw('DTT_EVT_start') > time());
756 756
 	}
757 757
 
758 758
 
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 	 * @return boolean
763 763
 	 */
764 764
 	public function is_active() {
765
-		return ( $this->get_raw( 'DTT_EVT_start' ) < time() && $this->get_raw( 'DTT_EVT_end' ) > time() );
765
+		return ($this->get_raw('DTT_EVT_start') < time() && $this->get_raw('DTT_EVT_end') > time());
766 766
 	}
767 767
 
768 768
 
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 	 * @return boolean
773 773
 	 */
774 774
 	public function is_expired() {
775
-		return ( $this->get_raw( 'DTT_EVT_end' ) < time() );
775
+		return ($this->get_raw('DTT_EVT_end') < time());
776 776
 	}
777 777
 
778 778
 
@@ -783,16 +783,16 @@  discard block
 block discarded – undo
783 783
 	 */
784 784
 	public function get_active_status() {
785 785
 		$total_tickets_for_this_dtt = $this->total_tickets_available_at_this_datetime();
786
-		if ( $total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1 ) {
786
+		if ($total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1) {
787 787
 			return EE_Datetime::sold_out;
788 788
 		}
789
-		if ( $this->is_expired() ) {
789
+		if ($this->is_expired()) {
790 790
 			return EE_Datetime::expired;
791 791
 		}
792
-		if ( $this->is_upcoming() ) {
792
+		if ($this->is_upcoming()) {
793 793
 			return EE_Datetime::upcoming;
794 794
 		}
795
-		if ( $this->is_active() ) {
795
+		if ($this->is_active()) {
796 796
 			return EE_Datetime::active;
797 797
 		}
798 798
 		return NULL;
@@ -806,24 +806,24 @@  discard block
 block discarded – undo
806 806
 	 * @param  boolean $use_dtt_name if TRUE then we'll use DTT->name() if its not empty.
807 807
 	 * @return string
808 808
 	 */
809
-	public function get_dtt_display_name( $use_dtt_name = FALSE ) {
810
-		if ( $use_dtt_name ) {
809
+	public function get_dtt_display_name($use_dtt_name = FALSE) {
810
+		if ($use_dtt_name) {
811 811
 			$dtt_name = $this->name();
812
-			if ( !empty( $dtt_name ) ) {
812
+			if ( ! empty($dtt_name)) {
813 813
 				return $dtt_name;
814 814
 			}
815 815
 		}
816 816
 		//first condition is to see if the months are different
817
-		if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) ) {
818
-			$display_date = $this->start_date( 'M j\, Y g:i a' ) . ' - ' . $this->end_date( 'M j\, Y g:i a' );
817
+		if (date('m', $this->get_raw('DTT_EVT_start')) != date('m', $this->get_raw('DTT_EVT_end'))) {
818
+			$display_date = $this->start_date('M j\, Y g:i a').' - '.$this->end_date('M j\, Y g:i a');
819 819
 			//next condition is if its the same month but different day
820 820
 		}
821 821
 		else {
822
-			if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) == date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) && date( 'd', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'd', $this->get_raw( 'DTT_EVT_end' ) ) ) {
823
-				$display_date = $this->start_date( 'M j\, g:i a' ) . ' - ' . $this->end_date( 'M j\, g:i a Y' );
822
+			if (date('m', $this->get_raw('DTT_EVT_start')) == date('m', $this->get_raw('DTT_EVT_end')) && date('d', $this->get_raw('DTT_EVT_start')) != date('d', $this->get_raw('DTT_EVT_end'))) {
823
+				$display_date = $this->start_date('M j\, g:i a').' - '.$this->end_date('M j\, g:i a Y');
824 824
 			}
825 825
 			else {
826
-				$display_date = $this->start_date( 'F j\, Y' ) . ' @ ' . $this->start_date( 'g:i a' ) . ' - ' . $this->end_date( 'g:i a' );
826
+				$display_date = $this->start_date('F j\, Y').' @ '.$this->start_date('g:i a').' - '.$this->end_date('g:i a');
827 827
 			}
828 828
 		}
829 829
 		return $display_date;
@@ -837,8 +837,8 @@  discard block
 block discarded – undo
837 837
 *@param array $query_params see EEM_Base::get_all()
838 838
 	 * @return EE_Ticket[]
839 839
 	 */
840
-	public function tickets( $query_params = array() ) {
841
-		return $this->get_many_related( 'Ticket', $query_params );
840
+	public function tickets($query_params = array()) {
841
+		return $this->get_many_related('Ticket', $query_params);
842 842
 	}
843 843
 
844 844
 
@@ -848,21 +848,21 @@  discard block
 block discarded – undo
848 848
 	 * @param array $query_params like EEM_Base::get_all's
849 849
 	 * @return EE_Ticket[]
850 850
 	 */
851
-	public function ticket_types_available_for_purchase( $query_params = array() ) {
851
+	public function ticket_types_available_for_purchase($query_params = array()) {
852 852
 		// first check if datetime is valid
853
-		if ( ! ( $this->is_upcoming() || $this->is_active() ) || $this->sold_out() ) {
853
+		if ( ! ($this->is_upcoming() || $this->is_active()) || $this->sold_out()) {
854 854
 			return array();
855 855
 		}
856
-		if ( empty( $query_params ) ) {
856
+		if (empty($query_params)) {
857 857
 			$query_params = array(
858 858
 				array(
859
-					'TKT_start_date' => array( '<=', EEM_Ticket::instance()->current_time_for_query( 'TKT_start_date' ) ),
860
-					'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
859
+					'TKT_start_date' => array('<=', EEM_Ticket::instance()->current_time_for_query('TKT_start_date')),
860
+					'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
861 861
 					'TKT_deleted'    => false
862 862
 				)
863 863
 			);
864 864
 		}
865
-		return $this->tickets( $query_params );
865
+		return $this->tickets($query_params);
866 866
 	}
867 867
 
868 868
 
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
 	 * @return EE_Event
873 873
 	 */
874 874
 	public function event() {
875
-		return $this->get_first_related( 'Event' );
875
+		return $this->get_first_related('Event');
876 876
 	}
877 877
 
878 878
 
@@ -886,11 +886,11 @@  discard block
 block discarded – undo
886 886
      */
887 887
 	public function update_sold() {
888 888
 		$count_regs_for_this_datetime = EEM_Registration::instance()->count(
889
-			array( array(
889
+			array(array(
890 890
 				'STS_ID' 					=> EEM_Registration::status_id_approved,
891 891
 				'REG_deleted' 				=> 0,
892 892
 				'Ticket.Datetime.DTT_ID' 	=> $this->ID(),
893
-			) )
893
+			))
894 894
 		);
895 895
         $sold = $this->sold();
896 896
         if ($count_regs_for_this_datetime > $sold) {
Please login to merge, or discard this patch.
core/db_classes/EE_Event_Message_Template.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 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
  * Contains definition for EE_Event_Message_Template model object
4 6
  * @package 		Event Espresso
Please login to merge, or discard this patch.
core/db_classes/EE_Question_Group.class.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -252,8 +252,9 @@
 block discarded – undo
252 252
 		$has_answers = FALSE;
253 253
 		$questions = $this->get_many_related( 'Question' );
254 254
 		foreach ( $questions as $question ) {
255
-			if ( $question->count_related( 'Answer' ) > 0 )
256
-				$has_answers = TRUE;
255
+			if ( $question->count_related( 'Answer' ) > 0 ) {
256
+							$has_answers = TRUE;
257
+			}
257 258
 		}
258 259
 		return $has_answers;
259 260
 	}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	/**
214 214
 	 * Adds the question to this question group
215 215
 	 * @param EE_Question || int $question object or ID
216
-	 * @return boolean if successful
216
+	 * @return EE_Base_Class if successful
217 217
 	 */
218 218
 	public function add_question( $questionObjectOrID ) {
219 219
 		return $this->_add_relation_to( $questionObjectOrID, 'Question' );
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	/**
225 225
 	 * Removes the question from this question group
226 226
 	 * @param EE_Question || int $question object or ID
227
-	 * @return boolean of success
227
+	 * @return EE_Base_Class of success
228 228
 	 */
229 229
 	public function remove_question( $questionObjectOrID ) {
230 230
 		return $this->_remove_relation_to( $questionObjectOrID, 'Question' );
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 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,8 +35,8 @@  discard block
 block discarded – undo
35 35
 	 * @param bool $pretty
36 36
 	 * @return string
37 37
 	 */
38
-	public function name( $pretty = FALSE ) {
39
-		return $pretty ? $this->get_pretty( 'QSG_name' ) : $this->get( 'QSG_name' );
38
+	public function name($pretty = FALSE) {
39
+		return $pretty ? $this->get_pretty('QSG_name') : $this->get('QSG_name');
40 40
 	}
41 41
 
42 42
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @return string
49 49
 	 */
50 50
 	public function identifier() {
51
-		return $this->get( 'QSG_identifier' );
51
+		return $this->get('QSG_identifier');
52 52
 	}
53 53
 
54 54
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 	 * @param bool $pretty
60 60
 	 * @return string
61 61
 	 */
62
-	public function desc( $pretty = FALSE ) {
63
-		return $pretty ? $this->get_pretty( 'QSG_desc' ) : $this->get( 'QSG_desc' );
62
+	public function desc($pretty = FALSE) {
63
+		return $pretty ? $this->get_pretty('QSG_desc') : $this->get('QSG_desc');
64 64
 	}
65 65
 
66 66
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @return int
73 73
 	 */
74 74
 	public function order() {
75
-		return $this->get( 'QSG_order' );
75
+		return $this->get('QSG_order');
76 76
 	}
77 77
 
78 78
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @return boolean
84 84
 	 */
85 85
 	public function show_group_name() {
86
-		return $this->get( 'QSG_show_group_name' );
86
+		return $this->get('QSG_show_group_name');
87 87
 	}
88 88
 
89 89
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return boolean
96 96
 	 */
97 97
 	public function show_group_desc() {
98
-		return $this->get( 'QSG_show_group_desc' );
98
+		return $this->get('QSG_show_group_desc');
99 99
 	}
100 100
 
101 101
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @return boolean
109 109
 	 */
110 110
 	public function system_group() {
111
-		return $this->get( 'QSG_system' );
111
+		return $this->get('QSG_system');
112 112
 	}
113 113
 
114 114
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return boolean
134 134
 	 */
135 135
 	public function deleted() {
136
-		return $this->get( 'QST_deleted' );
136
+		return $this->get('QST_deleted');
137 137
 	}
138 138
 
139 139
 
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function questions_in_and_not_in_group() {
146 146
 		$questions_in_group = $this->questions();
147
-		$exclude_question_ids = ! empty( $questions_in_group ) ? array_keys( $questions_in_group ) : array();
148
-		$questions_not_in_group = $this->questions_not_in_group( $exclude_question_ids );
147
+		$exclude_question_ids = ! empty($questions_in_group) ? array_keys($questions_in_group) : array();
148
+		$questions_not_in_group = $this->questions_not_in_group($exclude_question_ids);
149 149
 		return $questions_in_group + $questions_not_in_group;
150 150
 	}
151 151
 
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 	 * @param array $query_params
157 157
 	 * @return EE_Question[]
158 158
 	 */
159
-	public function questions( $query_params = array() ) {
160
-		$query_params = ! empty( $query_params ) ? $query_params : array( 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' ) );
161
-		return $this->ID() ? $this->get_many_related( 'Question', $query_params ) : array();
159
+	public function questions($query_params = array()) {
160
+		$query_params = ! empty($query_params) ? $query_params : array('order_by' => array('Question_Group_Question.QGQ_order' => 'ASC'));
161
+		return $this->ID() ? $this->get_many_related('Question', $query_params) : array();
162 162
 	}
163 163
 
164 164
 
@@ -168,14 +168,14 @@  discard block
 block discarded – undo
168 168
 	 * @param  mixed $question_IDS_in_group if empty array then all questions returned.  if FALSE then we first get questions in this group and exclude them from questions get all. IF empty array then we just return all questions.
169 169
 	 * @return EE_Question[]
170 170
 	 */
171
-	public function questions_not_in_group( $question_IDS_in_group = FALSE ) {
172
-		if ( $question_IDS_in_group === FALSE ) {
171
+	public function questions_not_in_group($question_IDS_in_group = FALSE) {
172
+		if ($question_IDS_in_group === FALSE) {
173 173
 			$questions = $this->questions();
174
-			$question_IDS_in_group = ! empty( $questions ) ? array_keys( $questions ) : array();
174
+			$question_IDS_in_group = ! empty($questions) ? array_keys($questions) : array();
175 175
 		}
176
-		$_where = ! empty( $question_IDS_in_group ) ? array( 'QST_ID' => array( 'not_in', $question_IDS_in_group ) ) : array();
176
+		$_where = ! empty($question_IDS_in_group) ? array('QST_ID' => array('not_in', $question_IDS_in_group)) : array();
177 177
 
178
-		return EEM_Question::instance()->get_all( array( $_where, 'order_by' => array( 'QST_ID' => 'ASC' ) ) );
178
+		return EEM_Question::instance()->get_all(array($_where, 'order_by' => array('QST_ID' => 'ASC')));
179 179
 	}
180 180
 
181 181
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 * @return EE_Event[]
186 186
 	 */
187 187
 	public function events() {
188
-		return $this->get_many_related( 'Event' );
188
+		return $this->get_many_related('Event');
189 189
 	}
190 190
 
191 191
 
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 	 * @param EE_Question || int $question object or ID
196 196
 	 * @return boolean if successful
197 197
 	 */
198
-	public function add_question( $questionObjectOrID ) {
199
-		return $this->_add_relation_to( $questionObjectOrID, 'Question' );
198
+	public function add_question($questionObjectOrID) {
199
+		return $this->_add_relation_to($questionObjectOrID, 'Question');
200 200
 	}
201 201
 
202 202
 
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 	 * @param EE_Question || int $question object or ID
207 207
 	 * @return boolean of success
208 208
 	 */
209
-	public function remove_question( $questionObjectOrID ) {
210
-		return $this->_remove_relation_to( $questionObjectOrID, 'Question' );
209
+	public function remove_question($questionObjectOrID) {
210
+		return $this->_remove_relation_to($questionObjectOrID, 'Question');
211 211
 	}
212 212
 
213 213
 
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
 	 * @param $qst_order
218 218
 	 * @return int
219 219
 	 */
220
-	public function update_question_order( $questionObjectOrID, $qst_order ) {
221
-		$qst_ID = $questionObjectOrID instanceof EE_Question ? $questionObjectOrID->ID() : (int)$questionObjectOrID;
222
-		return EEM_Question_Group_Question::instance()->update( array( 'QGQ_order' => $qst_order ), array( array( 'QST_ID' => $qst_ID, 'QSG_ID' => $this->ID() ) ) );
220
+	public function update_question_order($questionObjectOrID, $qst_order) {
221
+		$qst_ID = $questionObjectOrID instanceof EE_Question ? $questionObjectOrID->ID() : (int) $questionObjectOrID;
222
+		return EEM_Question_Group_Question::instance()->update(array('QGQ_order' => $qst_order), array(array('QST_ID' => $qst_ID, 'QSG_ID' => $this->ID())));
223 223
 	}
224 224
 
225 225
 
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	public function has_questions_with_answers() {
232 232
 		$has_answers = FALSE;
233
-		$questions = $this->get_many_related( 'Question' );
234
-		foreach ( $questions as $question ) {
235
-			if ( $question->count_related( 'Answer' ) > 0 )
233
+		$questions = $this->get_many_related('Question');
234
+		foreach ($questions as $question) {
235
+			if ($question->count_related('Answer') > 0)
236 236
 				$has_answers = TRUE;
237 237
 		}
238 238
 		return $has_answers;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	public function set_order_to_latest() {
250 250
 		$latest_order = $this->get_model()->get_latest_question_group_order();
251
-		$latest_order ++;
252
-		$this->set( 'QSG_order', $latest_order );
251
+		$latest_order++;
252
+		$this->set('QSG_order', $latest_order);
253 253
 	}
254 254
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Transaction.class.php 4 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   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 	 * Gets all the attendees for this transaction (handy for use with EE_Attendee's get_registrations_for_event function
428 428
 	 * for getting attendees and how many registrations they each have for an event)
429 429
 	 *
430
-	 * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT'
430
+	 * @return EE_Base_Class[] EE_Attendee[] by default, int if $output is set to 'COUNT'
431 431
 	 * @throws \EE_Error
432 432
 	 */
433 433
 	public function attendees() {
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 
465 465
     /**
466 466
      * Gets all payments which have not been approved
467
-     * @return \EEI_Payment[]
467
+     * @return EE_Base_Class[]
468 468
      * @throws EE_Error if a model is misconfigured somehow
469 469
      */
470 470
 	public function pending_payments()
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 * Gets all the extra meta info on this payment
710 710
 	 *
711 711
 	 * @param array $query_params like EEM_Base::get_all
712
-	 * @return EE_Extra_Meta
712
+	 * @return EE_Base_Class[]
713 713
 	 * @throws \EE_Error
714 714
 	 */
715 715
 	public function extra_meta( $query_params = array() ) {
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 	 * Sets PMD_ID
887 887
 	 *
888 888
 	 * @param int $PMD_ID
889
-	 * @return boolean
889
+	 * @return boolean|null
890 890
 	 * @throws \EE_Error
891 891
 	 */
892 892
 	public function set_payment_method_ID($PMD_ID) {
Please login to merge, or discard this patch.
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -462,29 +462,29 @@  discard block
 block discarded – undo
462 462
 
463 463
 
464 464
 
465
-    /**
466
-     * Gets all payments which have not been approved
467
-     * @return \EEI_Payment[]
468
-     * @throws EE_Error if a model is misconfigured somehow
469
-     */
465
+	/**
466
+	 * Gets all payments which have not been approved
467
+	 * @return \EEI_Payment[]
468
+	 * @throws EE_Error if a model is misconfigured somehow
469
+	 */
470 470
 	public function pending_payments()
471
-    {
472
-        return $this->get_many_related(
473
-            'Payment',
474
-            array(
475
-                array(
476
-                    'STS_ID' => EEM_Payment::status_id_pending
477
-                ),
478
-                'order_by' => array(
479
-                    'PAY_timestamp' => 'DESC'
480
-                )
481
-            )
482
-        );
483
-    }
484
-
485
-
486
-
487
-    /**
471
+	{
472
+		return $this->get_many_related(
473
+			'Payment',
474
+			array(
475
+				array(
476
+					'STS_ID' => EEM_Payment::status_id_pending
477
+				),
478
+				'order_by' => array(
479
+					'PAY_timestamp' => 'DESC'
480
+				)
481
+			)
482
+		);
483
+	}
484
+
485
+
486
+
487
+	/**
488 488
 	 * echoes $this->pretty_status()
489 489
 	 *
490 490
 	 * @param bool $show_icons
@@ -645,20 +645,20 @@  discard block
 block discarded – undo
645 645
 	 * @throws \EE_Error
646 646
 	 */
647 647
 	public function primary_registration() {
648
-        $registrations = (array) $this->get_many_related(
649
-            'Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT))
650
-        );
651
-        foreach ($registrations as $registration) {
652
-            // valid registration that is NOT cancelled or declined ?
653
-            if(
654
-                $registration instanceof EE_Registration
655
-                && ! in_array($registration->status_ID(), EEM_Registration::closed_reg_statuses(), true)
656
-            ) {
657
-                return $registration;
658
-            }
659
-        }
660
-        // nothing valid found, so just return first thing from array of results
661
-        return reset($registrations);
648
+		$registrations = (array) $this->get_many_related(
649
+			'Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT))
650
+		);
651
+		foreach ($registrations as $registration) {
652
+			// valid registration that is NOT cancelled or declined ?
653
+			if(
654
+				$registration instanceof EE_Registration
655
+				&& ! in_array($registration->status_ID(), EEM_Registration::closed_reg_statuses(), true)
656
+			) {
657
+				return $registration;
658
+			}
659
+		}
660
+		// nothing valid found, so just return first thing from array of results
661
+		return reset($registrations);
662 662
 	}
663 663
 
664 664
 
Please login to merge, or discard this patch.
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * EE_Transaction class
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	 * @throws \EE_Error
42 42
 	 * @throws \Exception
43 43
 	 */
44
-	public function __construct( array $fieldValues, $bydb, $timezone, array $date_formats ) {
45
-		parent::__construct( $fieldValues, $bydb, $timezone, $date_formats );
46
-		$this->set_old_txn_status( $this->status_ID() );
44
+	public function __construct(array $fieldValues, $bydb, $timezone, array $date_formats) {
45
+		parent::__construct($fieldValues, $bydb, $timezone, $date_formats);
46
+		$this->set_old_txn_status($this->status_ID());
47 47
 	}
48 48
 
49 49
 
@@ -59,16 +59,16 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function lock() {
61 61
 		// attempt to set lock, but if that fails...
62
-		if ( ! $this->add_extra_meta( 'lock', time(), true )  ) {
62
+		if ( ! $this->add_extra_meta('lock', time(), true)) {
63 63
 			// then attempt to remove the lock in case it is expired
64
-			if ( $this->_remove_expired_lock() ) {
64
+			if ($this->_remove_expired_lock()) {
65 65
 				// if removal was successful, then try setting lock again
66 66
 				$this->lock();
67 67
 			} else {
68 68
 				// but if the lock can not be removed, then throw an exception
69 69
 				throw new EE_Error(
70 70
 					sprintf(
71
-						__( 'Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso' ),
71
+						__('Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso'),
72 72
 						$this->ID()
73 73
 					)
74 74
 				);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @throws \EE_Error
88 88
 	 */
89 89
 	public function unlock() {
90
-		return $this->delete_extra_meta( 'lock' );
90
+		return $this->delete_extra_meta('lock');
91 91
 	}
92 92
 
93 93
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function is_locked() {
110 110
 		// if TXN is not locked, then return false immediately
111
-		if ( ! $this->_get_lock() ) {
111
+		if ( ! $this->_get_lock()) {
112 112
 			return false;
113 113
 		}
114 114
 		// if not, then let's try and remove the lock in case it's expired...
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * @throws \EE_Error
130 130
 	 */
131 131
 	protected function _get_lock() {
132
-		return (int)$this->get_extra_meta( 'lock', true, 0 );
132
+		return (int) $this->get_extra_meta('lock', true, 0);
133 133
 	}
134 134
 
135 135
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	protected function _remove_expired_lock() {
146 146
 		$locked = $this->_get_lock();
147
-		if ( $locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked ) {
147
+		if ($locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked) {
148 148
 			return $this->unlock();
149 149
 		}
150 150
 		return 0;
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 * @param        float $total total value of transaction
160 160
 	 * @throws \EE_Error
161 161
 	 */
162
-	public function set_total( $total = 0.00 ) {
163
-		$this->set( 'TXN_total', (float)$total );
162
+	public function set_total($total = 0.00) {
163
+		$this->set('TXN_total', (float) $total);
164 164
 	}
165 165
 
166 166
 
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	 * @param        float $total_paid total amount paid to date (sum of all payments)
173 173
 	 * @throws \EE_Error
174 174
 	 */
175
-	public function set_paid( $total_paid = 0.00 ) {
176
-		$this->set( 'TXN_paid', (float)$total_paid );
175
+	public function set_paid($total_paid = 0.00) {
176
+		$this->set('TXN_paid', (float) $total_paid);
177 177
 	}
178 178
 
179 179
 
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 	 * @param        string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set
186 186
 	 * @throws \EE_Error
187 187
 	 */
188
-	public function set_status( $status = '' ) {
189
-		$this->set( 'STS_ID', $status );
188
+	public function set_status($status = '') {
189
+		$this->set('STS_ID', $status);
190 190
 	}
191 191
 
192 192
 
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 	 * @param        string $hash_salt required for some payment gateways
199 199
 	 * @throws \EE_Error
200 200
 	 */
201
-	public function set_hash_salt( $hash_salt = '' ) {
202
-		$this->set( 'TXN_hash_salt', $hash_salt );
201
+	public function set_hash_salt($hash_salt = '') {
202
+		$this->set('TXN_hash_salt', $hash_salt);
203 203
 	}
204 204
 
205 205
 
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
 	 * @param array $txn_reg_steps
211 211
 	 * @throws \EE_Error
212 212
 	 */
213
-	public function set_reg_steps( array $txn_reg_steps ) {
214
-		$this->set( 'TXN_reg_steps', $txn_reg_steps );
213
+	public function set_reg_steps(array $txn_reg_steps) {
214
+		$this->set('TXN_reg_steps', $txn_reg_steps);
215 215
 	}
216 216
 
217 217
 
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 	 * @throws \EE_Error
224 224
 	 */
225 225
 	public function reg_steps() {
226
-		$TXN_reg_steps = $this->get( 'TXN_reg_steps' );
227
-		return is_array( $TXN_reg_steps ) ? (array)$TXN_reg_steps : array();
226
+		$TXN_reg_steps = $this->get('TXN_reg_steps');
227
+		return is_array($TXN_reg_steps) ? (array) $TXN_reg_steps : array();
228 228
 	}
229 229
 
230 230
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 * @throws \EE_Error
235 235
 	 */
236 236
 	public function pretty_total() {
237
-		return $this->get_pretty( 'TXN_total' );
237
+		return $this->get_pretty('TXN_total');
238 238
 	}
239 239
 
240 240
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * @throws \EE_Error
247 247
 	 */
248 248
 	public function pretty_paid() {
249
-		return $this->get_pretty( 'TXN_paid' );
249
+		return $this->get_pretty('TXN_paid');
250 250
 	}
251 251
 
252 252
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 * @throws \EE_Error
260 260
 	 */
261 261
 	public function remaining() {
262
-		return (float)( $this->total() - $this->paid() );
262
+		return (float) ($this->total() - $this->paid());
263 263
 	}
264 264
 
265 265
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 * @throws \EE_Error
273 273
 	 */
274 274
 	public function total() {
275
-		return (float)$this->get( 'TXN_total' );
275
+		return (float) $this->get('TXN_total');
276 276
 	}
277 277
 
278 278
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	 * @throws \EE_Error
286 286
 	 */
287 287
 	public function paid() {
288
-		return (float)$this->get( 'TXN_paid' );
288
+		return (float) $this->get('TXN_paid');
289 289
 	}
290 290
 
291 291
 
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
 	 * @throws \EE_Error
298 298
 	 */
299 299
 	public function get_cart_session() {
300
-		$session_data = (array)$this->get( 'TXN_session_data' );
301
-		return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart
302
-			? $session_data[ 'cart' ]
300
+		$session_data = (array) $this->get('TXN_session_data');
301
+		return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart
302
+			? $session_data['cart']
303 303
 			: null;
304 304
 	}
305 305
 
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
 	 * @throws \EE_Error
313 313
 	 */
314 314
 	public function session_data() {
315
-		$session_data = $this->get( 'TXN_session_data' );
316
-		if ( empty( $session_data ) ) {
315
+		$session_data = $this->get('TXN_session_data');
316
+		if (empty($session_data)) {
317 317
 			$session_data = array(
318 318
 				'id'            => null,
319 319
 				'user_id'       => null,
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
 	 * @param        EE_Session|array $session_data
337 337
 	 * @throws \EE_Error
338 338
 	 */
339
-	public function set_txn_session_data( $session_data ) {
340
-		if ( $session_data instanceof EE_Session ) {
341
-			$this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE ));
339
+	public function set_txn_session_data($session_data) {
340
+		if ($session_data instanceof EE_Session) {
341
+			$this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE));
342 342
 		} else {
343
-			$this->set( 'TXN_session_data', $session_data );
343
+			$this->set('TXN_session_data', $session_data);
344 344
 		}
345 345
 	}
346 346
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 	 * @throws \EE_Error
354 354
 	 */
355 355
 	public function hash_salt_() {
356
-		return $this->get( 'TXN_hash_salt' );
356
+		return $this->get('TXN_hash_salt');
357 357
 	}
358 358
 
359 359
 
@@ -373,13 +373,13 @@  discard block
 block discarded – undo
373 373
 	 * @return    string | int
374 374
 	 * @throws \EE_Error
375 375
 	 */
376
-	public function datetime( $format = FALSE, $gmt = FALSE ) {
377
-		if ( $format ) {
378
-			return $this->get_pretty( 'TXN_timestamp' );
379
-		} else if ( $gmt ) {
380
-			return $this->get_raw( 'TXN_timestamp' );
376
+	public function datetime($format = FALSE, $gmt = FALSE) {
377
+		if ($format) {
378
+			return $this->get_pretty('TXN_timestamp');
379
+		} else if ($gmt) {
380
+			return $this->get_raw('TXN_timestamp');
381 381
 		} else {
382
-			return $this->get( 'TXN_timestamp' );
382
+			return $this->get('TXN_timestamp');
383 383
 		}
384 384
 	}
385 385
 
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
 	 * @return EE_Registration[]
394 394
 	 * @throws \EE_Error
395 395
 	 */
396
-	public function registrations( $query_params = array(), $get_cached = FALSE ) {
397
-		$query_params = ( empty( $query_params ) || ! is_array( $query_params ) )
396
+	public function registrations($query_params = array(), $get_cached = FALSE) {
397
+		$query_params = (empty($query_params) || ! is_array($query_params))
398 398
 			? array(
399 399
 				'order_by' => array(
400 400
 					'Event.EVT_name' => 'ASC',
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 			)
405 405
 			: $query_params;
406 406
 		$query_params = $get_cached ? array() : $query_params;
407
-		return $this->get_many_related( 'Registration', $query_params );
407
+		return $this->get_many_related('Registration', $query_params);
408 408
 	}
409 409
 
410 410
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	 * @throws \EE_Error
418 418
 	 */
419 419
 	public function attendees() {
420
-		return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) );
420
+		return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID())));
421 421
 	}
422 422
 
423 423
 
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 	 * @return EE_Payment[]
430 430
 	 * @throws \EE_Error
431 431
 	 */
432
-	public function payments( $query_params = array() ) {
433
-		return $this->get_many_related( 'Payment', $query_params );
432
+	public function payments($query_params = array()) {
433
+		return $this->get_many_related('Payment', $query_params);
434 434
 	}
435 435
 
436 436
 
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
 	 * @throws \EE_Error
443 443
 	 */
444 444
 	public function approved_payments() {
445
-		EE_Registry::instance()->load_model( 'Payment' );
446
-		return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) );
445
+		EE_Registry::instance()->load_model('Payment');
446
+		return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC')));
447 447
 	}
448 448
 
449 449
 
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
 	 * @return string
478 478
 	 * @throws \EE_Error
479 479
 	 */
480
-	public function e_pretty_status( $show_icons = FALSE ) {
481
-		echo $this->pretty_status( $show_icons );
480
+	public function e_pretty_status($show_icons = FALSE) {
481
+		echo $this->pretty_status($show_icons);
482 482
 	}
483 483
 
484 484
 
@@ -490,10 +490,10 @@  discard block
 block discarded – undo
490 490
 	 * @return string
491 491
 	 * @throws \EE_Error
492 492
 	 */
493
-	public function pretty_status( $show_icons = FALSE ) {
494
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
493
+	public function pretty_status($show_icons = FALSE) {
494
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
495 495
 		$icon = '';
496
-		switch ( $this->status_ID() ) {
496
+		switch ($this->status_ID()) {
497 497
 			case EEM_Transaction::complete_status_code:
498 498
 				$icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : '';
499 499
 				break;
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 				$icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : '';
511 511
 				break;
512 512
 		}
513
-		return $icon . $status[ $this->status_ID() ];
513
+		return $icon.$status[$this->status_ID()];
514 514
 	}
515 515
 
516 516
 
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 	 * @throws \EE_Error
523 523
 	 */
524 524
 	public function status_ID() {
525
-		return $this->get( 'STS_ID' );
525
+		return $this->get('STS_ID');
526 526
 	}
527 527
 
528 528
 
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 	 * @throws \EE_Error
535 535
 	 */
536 536
 	public function is_free() {
537
-		return EEH_Money::compare_floats( $this->get( 'TXN_total' ), 0, '==' );
537
+		return EEH_Money::compare_floats($this->get('TXN_total'), 0, '==');
538 538
 	}
539 539
 
540 540
 
@@ -614,12 +614,12 @@  discard block
 block discarded – undo
614 614
 	 * @return string
615 615
 	 * @throws \EE_Error
616 616
 	 */
617
-	public function invoice_url( $type = 'html' ) {
617
+	public function invoice_url($type = 'html') {
618 618
 		$REG = $this->primary_registration();
619
-		if ( ! $REG instanceof EE_Registration ) {
619
+		if ( ! $REG instanceof EE_Registration) {
620 620
 			return '';
621 621
 		}
622
-		return $REG->invoice_url( $type );
622
+		return $REG->invoice_url($type);
623 623
 	}
624 624
 
625 625
 
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
         );
637 637
         foreach ($registrations as $registration) {
638 638
             // valid registration that is NOT cancelled or declined ?
639
-            if(
639
+            if (
640 640
                 $registration instanceof EE_Registration
641 641
                 && ! in_array($registration->status_ID(), EEM_Registration::closed_reg_statuses(), true)
642 642
             ) {
@@ -656,12 +656,12 @@  discard block
 block discarded – undo
656 656
 	 * @return string
657 657
 	 * @throws \EE_Error
658 658
 	 */
659
-	public function receipt_url( $type = 'html' ) {
659
+	public function receipt_url($type = 'html') {
660 660
 		$REG = $this->primary_registration();
661
-		if ( ! $REG instanceof EE_Registration ) {
661
+		if ( ! $REG instanceof EE_Registration) {
662 662
 			return '';
663 663
 		}
664
-		return $REG->receipt_url( $type );
664
+		return $REG->receipt_url($type);
665 665
 	}
666 666
 
667 667
 
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 	 * @throws \EE_Error
687 687
 	 */
688 688
 	public function gateway_response_on_transaction() {
689
-		$payment = $this->get_first_related( 'Payment' );
689
+		$payment = $this->get_first_related('Payment');
690 690
 		return $payment instanceof EE_Payment ? $payment->gateway_response() : '';
691 691
 	}
692 692
 
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 	 * @throws \EE_Error
700 700
 	 */
701 701
 	public function status_obj() {
702
-		return $this->get_first_related( 'Status' );
702
+		return $this->get_first_related('Status');
703 703
 	}
704 704
 
705 705
 
@@ -711,8 +711,8 @@  discard block
 block discarded – undo
711 711
 	 * @return EE_Extra_Meta
712 712
 	 * @throws \EE_Error
713 713
 	 */
714
-	public function extra_meta( $query_params = array() ) {
715
-		return $this->get_many_related( 'Extra_Meta', $query_params );
714
+	public function extra_meta($query_params = array()) {
715
+		return $this->get_many_related('Extra_Meta', $query_params);
716 716
 	}
717 717
 
718 718
 
@@ -724,8 +724,8 @@  discard block
 block discarded – undo
724 724
 	 * @return EE_Base_Class the relation was added to
725 725
 	 * @throws \EE_Error
726 726
 	 */
727
-	public function add_registration( EE_Registration $registration ) {
728
-		return $this->_add_relation_to( $registration, 'Registration' );
727
+	public function add_registration(EE_Registration $registration) {
728
+		return $this->_add_relation_to($registration, 'Registration');
729 729
 	}
730 730
 
731 731
 
@@ -738,8 +738,8 @@  discard block
 block discarded – undo
738 738
 	 * @return EE_Base_Class that was removed from being related
739 739
 	 * @throws \EE_Error
740 740
 	 */
741
-	public function remove_registration_with_id( $registration_or_id ) {
742
-		return $this->_remove_relation_to( $registration_or_id, 'Registration' );
741
+	public function remove_registration_with_id($registration_or_id) {
742
+		return $this->_remove_relation_to($registration_or_id, 'Registration');
743 743
 	}
744 744
 
745 745
 
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
 	 * @throws \EE_Error
752 752
 	 */
753 753
 	public function items_purchased() {
754
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) );
754
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item)));
755 755
 	}
756 756
 
757 757
 
@@ -763,8 +763,8 @@  discard block
 block discarded – undo
763 763
 	 * @return EE_Base_Class the relation was added to
764 764
 	 * @throws \EE_Error
765 765
 	 */
766
-	public function add_line_item( EE_Line_Item $line_item ) {
767
-		return $this->_add_relation_to( $line_item, 'Line_Item' );
766
+	public function add_line_item(EE_Line_Item $line_item) {
767
+		return $this->_add_relation_to($line_item, 'Line_Item');
768 768
 	}
769 769
 
770 770
 
@@ -776,8 +776,8 @@  discard block
 block discarded – undo
776 776
 	 * @return EE_Line_Item[]
777 777
 	 * @throws \EE_Error
778 778
 	 */
779
-	public function line_items( $query_params = array() ) {
780
-		return $this->get_many_related( 'Line_Item', $query_params );
779
+	public function line_items($query_params = array()) {
780
+		return $this->get_many_related('Line_Item', $query_params);
781 781
 	}
782 782
 
783 783
 
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 	 * @throws \EE_Error
790 790
 	 */
791 791
 	public function tax_items() {
792
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) );
792
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax)));
793 793
 	}
794 794
 
795 795
 
@@ -802,10 +802,10 @@  discard block
 block discarded – undo
802 802
 	 * @return \EE_Line_Item
803 803
 	 * @throws \EE_Error
804 804
 	 */
805
-	public function total_line_item( $create_if_not_found = true ) {
806
-		$item =  $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) );
807
-		if( ! $item && $create_if_not_found ){
808
-			$item = EEH_Line_Item::create_total_line_item( $this );
805
+	public function total_line_item($create_if_not_found = true) {
806
+		$item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total)));
807
+		if ( ! $item && $create_if_not_found) {
808
+			$item = EEH_Line_Item::create_total_line_item($this);
809 809
 		}
810 810
 		return $item;
811 811
 	}
@@ -821,10 +821,10 @@  discard block
 block discarded – undo
821 821
 	 */
822 822
 	public function tax_total() {
823 823
 		$tax_line_item = $this->tax_total_line_item();
824
-		if ( $tax_line_item ) {
825
-			return (float)$tax_line_item->total();
824
+		if ($tax_line_item) {
825
+			return (float) $tax_line_item->total();
826 826
 		} else {
827
-			return (float)0;
827
+			return (float) 0;
828 828
 		}
829 829
 	}
830 830
 
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 	 * @throws \EE_Error
838 838
 	 */
839 839
 	public function tax_total_line_item() {
840
-		return EEH_Line_Item::get_taxes_subtotal( $this->total_line_item() );
840
+		return EEH_Line_Item::get_taxes_subtotal($this->total_line_item());
841 841
 	}
842 842
 
843 843
 
@@ -848,20 +848,20 @@  discard block
 block discarded – undo
848 848
 	 * @return EE_Form_Section_Proper
849 849
 	 * @throws \EE_Error
850 850
 	 */
851
-	public function billing_info(){
851
+	public function billing_info() {
852 852
 		$payment_method = $this->payment_method();
853
-		if ( !$payment_method){
853
+		if ( ! $payment_method) {
854 854
 			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__);
855 855
 			return false;
856 856
 		}
857 857
 		$primary_reg = $this->primary_registration();
858
-		if ( ! $primary_reg ) {
859
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
858
+		if ( ! $primary_reg) {
859
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
860 860
 			return FALSE;
861 861
 		}
862 862
 		$attendee = $primary_reg->attendee();
863
-		if ( ! $attendee ) {
864
-			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__ );
863
+		if ( ! $attendee) {
864
+			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__);
865 865
 			return FALSE;
866 866
 		}
867 867
 		return $attendee->billing_info_for_payment_method($payment_method);
@@ -902,15 +902,15 @@  discard block
 block discarded – undo
902 902
 	 * @return EE_Payment_Method
903 903
 	 * @throws \EE_Error
904 904
 	 */
905
-	public function payment_method(){
905
+	public function payment_method() {
906 906
 		$pm = $this->get_first_related('Payment_Method');
907
-		if( $pm instanceof EE_Payment_Method ){
907
+		if ($pm instanceof EE_Payment_Method) {
908 908
 			return $pm;
909
-		}else{
909
+		} else {
910 910
 			$last_payment = $this->last_payment();
911
-			if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){
911
+			if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) {
912 912
 				return $last_payment->payment_method();
913
-			}else{
913
+			} else {
914 914
 				return NULL;
915 915
 			}
916 916
 		}
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 	 * @throws \EE_Error
926 926
 	 */
927 927
 	public function last_payment() {
928
-		return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) );
928
+		return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc')));
929 929
 	}
930 930
 
931 931
 
@@ -936,8 +936,8 @@  discard block
 block discarded – undo
936 936
 	 * @return EE_Line_Item[]
937 937
 	 * @throws \EE_Error
938 938
 	 */
939
-	public function non_ticket_line_items(){
940
-		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() );
939
+	public function non_ticket_line_items() {
940
+		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID());
941 941
 	}
942 942
 
943 943
 
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 	public function update_based_on_payments()
986 986
 	{
987 987
 		EE_Error::doing_it_wrong(
988
-			__CLASS__ . '::' . __FUNCTION__,
988
+			__CLASS__.'::'.__FUNCTION__,
989 989
 			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
990 990
 				'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
991 991
 			'4.6.0'
@@ -1009,9 +1009,9 @@  discard block
 block discarded – undo
1009 1009
 	/**
1010 1010
 	 * @param string $old_txn_status
1011 1011
 	 */
1012
-	public function set_old_txn_status( $old_txn_status ) {
1012
+	public function set_old_txn_status($old_txn_status) {
1013 1013
 		// only set the first time
1014
-		if ( $this->_old_txn_status === null ) {
1014
+		if ($this->_old_txn_status === null) {
1015 1015
 			$this->_old_txn_status = $old_txn_status;
1016 1016
 		}
1017 1017
 	}
@@ -1040,17 +1040,17 @@  discard block
 block discarded – undo
1040 1040
 	 * @param bool           $check_all
1041 1041
 	 * @return boolean | int
1042 1042
 	 */
1043
-	private function _reg_steps_completed( $reg_step_slug = '', $check_all = true ) {
1043
+	private function _reg_steps_completed($reg_step_slug = '', $check_all = true) {
1044 1044
 		$reg_steps = $this->reg_steps();
1045
-		if ( ! is_array( $reg_steps ) || empty( $reg_steps ) ) {
1045
+		if ( ! is_array($reg_steps) || empty($reg_steps)) {
1046 1046
 			return false;
1047 1047
 		}
1048 1048
 		// loop thru reg steps array)
1049
-		foreach ( $reg_steps as $slug => $reg_step_completed ) {
1049
+		foreach ($reg_steps as $slug => $reg_step_completed) {
1050 1050
 			// if NOT checking ALL steps (only checking one step)
1051
-			if ( ! $check_all ) {
1051
+			if ( ! $check_all) {
1052 1052
 				// and this is the one
1053
-				if ( $slug === $reg_step_slug ) {
1053
+				if ($slug === $reg_step_slug) {
1054 1054
 					return $reg_step_completed;
1055 1055
 				} else {
1056 1056
 					// skip to next reg step in loop
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
 				}
1059 1059
 			}
1060 1060
 			// $check_all must be true, else we would never have gotten to this point
1061
-			if ( $slug === $reg_step_slug ) {
1061
+			if ($slug === $reg_step_slug) {
1062 1062
 				// if we reach this point, then we are testing either:
1063 1063
 				// all_reg_steps_completed_except() or
1064 1064
 				// all_reg_steps_completed_except_final_step(),
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 				// ie: "is everything completed except the final step?"
1068 1068
 				// "that is correct... the final step is not completed, but all others are."
1069 1069
 				return $reg_step_completed !== true ? true : false;
1070
-			} else if ( $reg_step_completed !== true ) {
1070
+			} else if ($reg_step_completed !== true) {
1071 1071
 				// if any reg step is NOT completed, then ALL steps are not completed
1072 1072
 				return false;
1073 1073
 			}
@@ -1101,8 +1101,8 @@  discard block
 block discarded – undo
1101 1101
 	 * @param string         $exception
1102 1102
 	 * @return boolean
1103 1103
 	 */
1104
-	public function all_reg_steps_completed_except( $exception = '' ) {
1105
-		return $this->_reg_steps_completed( $exception );
1104
+	public function all_reg_steps_completed_except($exception = '') {
1105
+		return $this->_reg_steps_completed($exception);
1106 1106
 	}
1107 1107
 
1108 1108
 
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 	 * @return boolean
1118 1118
 	 */
1119 1119
 	public function all_reg_steps_completed_except_final_step() {
1120
-		return $this->_reg_steps_completed( 'finalize_registration' );
1120
+		return $this->_reg_steps_completed('finalize_registration');
1121 1121
 	}
1122 1122
 
1123 1123
 
@@ -1132,8 +1132,8 @@  discard block
 block discarded – undo
1132 1132
 	 * @param string         $reg_step_slug
1133 1133
 	 * @return boolean | int
1134 1134
 	 */
1135
-	public function reg_step_completed( $reg_step_slug ) {
1136
-		return $this->_reg_steps_completed( $reg_step_slug, false );
1135
+	public function reg_step_completed($reg_step_slug) {
1136
+		return $this->_reg_steps_completed($reg_step_slug, false);
1137 1137
 	}
1138 1138
 
1139 1139
 
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 	 * @return boolean | int
1149 1149
 	 */
1150 1150
 	public function final_reg_step_completed() {
1151
-		return $this->_reg_steps_completed( 'finalize_registration', false );
1151
+		return $this->_reg_steps_completed('finalize_registration', false);
1152 1152
 	}
1153 1153
 
1154 1154
 
@@ -1162,8 +1162,8 @@  discard block
 block discarded – undo
1162 1162
 	 * @return boolean
1163 1163
 	 * @throws \EE_Error
1164 1164
 	 */
1165
-	public function set_reg_step_initiated( $reg_step_slug ) {
1166
-		return $this->_set_reg_step_completed_status( $reg_step_slug, time() );
1165
+	public function set_reg_step_initiated($reg_step_slug) {
1166
+		return $this->_set_reg_step_completed_status($reg_step_slug, time());
1167 1167
 	}
1168 1168
 
1169 1169
 
@@ -1177,8 +1177,8 @@  discard block
 block discarded – undo
1177 1177
 	 * @return boolean
1178 1178
 	 * @throws \EE_Error
1179 1179
 	 */
1180
-	public function set_reg_step_completed( $reg_step_slug ) {
1181
-		return $this->_set_reg_step_completed_status( $reg_step_slug, true );
1180
+	public function set_reg_step_completed($reg_step_slug) {
1181
+		return $this->_set_reg_step_completed_status($reg_step_slug, true);
1182 1182
 	}
1183 1183
 
1184 1184
 
@@ -1192,8 +1192,8 @@  discard block
 block discarded – undo
1192 1192
 	 * @return boolean
1193 1193
 	 * @throws \EE_Error
1194 1194
 	 */
1195
-	public function set_reg_step_not_completed( $reg_step_slug ) {
1196
-		return $this->_set_reg_step_completed_status( $reg_step_slug, false );
1195
+	public function set_reg_step_not_completed($reg_step_slug) {
1196
+		return $this->_set_reg_step_completed_status($reg_step_slug, false);
1197 1197
 	}
1198 1198
 
1199 1199
 
@@ -1208,37 +1208,37 @@  discard block
 block discarded – undo
1208 1208
 	 * @return boolean
1209 1209
 	 * @throws \EE_Error
1210 1210
 	 */
1211
-	private function _set_reg_step_completed_status( $reg_step_slug, $status ) {
1211
+	private function _set_reg_step_completed_status($reg_step_slug, $status) {
1212 1212
 		// validate status
1213
-		$status = is_bool( $status ) || is_int( $status ) ? $status : false;
1213
+		$status = is_bool($status) || is_int($status) ? $status : false;
1214 1214
 		// get reg steps array
1215 1215
 		$txn_reg_steps = $this->reg_steps();
1216 1216
 		// if reg step does NOT exist
1217
-		if ( ! isset( $txn_reg_steps[ $reg_step_slug ] ) ) {
1217
+		if ( ! isset($txn_reg_steps[$reg_step_slug])) {
1218 1218
 			return false;
1219 1219
 		}
1220 1220
 		// if  we're trying to complete a step that is already completed
1221
-		if ( $txn_reg_steps[ $reg_step_slug ] === true ) {
1221
+		if ($txn_reg_steps[$reg_step_slug] === true) {
1222 1222
 			return true;
1223 1223
 		}
1224 1224
 		// if  we're trying to complete a step that hasn't even started
1225
-		if ( $status === true && $txn_reg_steps[ $reg_step_slug ] === false ) {
1225
+		if ($status === true && $txn_reg_steps[$reg_step_slug] === false) {
1226 1226
 			return false;
1227 1227
 		}
1228 1228
 		// if current status value matches the incoming value (no change)
1229 1229
 		// type casting as int means values should collapse to either 0, 1, or a timestamp like 1234567890
1230
-		if ( (int) $txn_reg_steps[ $reg_step_slug ] === (int) $status ) {
1230
+		if ((int) $txn_reg_steps[$reg_step_slug] === (int) $status) {
1231 1231
 			// this will happen in cases where multiple AJAX requests occur during the same step
1232 1232
 			return true;
1233 1233
 		}
1234 1234
 		// if we're trying to set a start time, but it has already been set...
1235
-		if ( is_numeric( $status ) && is_numeric( $txn_reg_steps[ $reg_step_slug ] ) ) {
1235
+		if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) {
1236 1236
 			// skip the update below, but don't return FALSE so that errors won't be displayed
1237 1237
 			return true;
1238 1238
 		}
1239 1239
 		// update completed status
1240
-		$txn_reg_steps[ $reg_step_slug ] = $status;
1241
-		$this->set_reg_steps( $txn_reg_steps );
1240
+		$txn_reg_steps[$reg_step_slug] = $status;
1241
+		$this->set_reg_steps($txn_reg_steps);
1242 1242
 		$this->save();
1243 1243
 		return true;
1244 1244
 	}
@@ -1254,11 +1254,11 @@  discard block
 block discarded – undo
1254 1254
 	 * @param string          $reg_step_slug
1255 1255
 	 * @return void
1256 1256
 	 */
1257
-	public function remove_reg_step( $reg_step_slug ) {
1257
+	public function remove_reg_step($reg_step_slug) {
1258 1258
 		// get reg steps array
1259 1259
 		$txn_reg_steps = $this->reg_steps();
1260
-		unset( $txn_reg_steps[ $reg_step_slug ] );
1261
-		$this->set_reg_steps( $txn_reg_steps );
1260
+		unset($txn_reg_steps[$reg_step_slug]);
1261
+		$this->set_reg_steps($txn_reg_steps);
1262 1262
 	}
1263 1263
 
1264 1264
 
@@ -1272,11 +1272,11 @@  discard block
 block discarded – undo
1272 1272
 	 * @param bool $save
1273 1273
 	 * @return bool
1274 1274
 	 */
1275
-	public function toggle_failed_transaction_status( $save = true ) {
1275
+	public function toggle_failed_transaction_status($save = true) {
1276 1276
 		// if TXN status is still set as "failed"...
1277
-		if ( $this->status_ID() === EEM_Transaction::failed_status_code ) {
1278
-			$this->set_status( EEM_Transaction::abandoned_status_code );
1279
-			if ( $save ) {
1277
+		if ($this->status_ID() === EEM_Transaction::failed_status_code) {
1278
+			$this->set_status(EEM_Transaction::abandoned_status_code);
1279
+			if ($save) {
1280 1280
 				$this->save();
1281 1281
 			}
1282 1282
 			return true;
@@ -1305,10 +1305,10 @@  discard block
 block discarded – undo
1305 1305
 				$this->primary_registration() instanceof EE_Registration
1306 1306
 				&& $this->primary_registration()->attendee() instanceof EE_Attendee
1307 1307
 			) {
1308
-				$this->set_status( EEM_Transaction::incomplete_status_code );
1308
+				$this->set_status(EEM_Transaction::incomplete_status_code);
1309 1309
 			} else {
1310 1310
 				// no contact record? yer abandoned!
1311
-				$this->set_status( EEM_Transaction::abandoned_status_code );
1311
+				$this->set_status(EEM_Transaction::abandoned_status_code);
1312 1312
 			}
1313 1313
 			return true;
1314 1314
 		}
@@ -1322,16 +1322,16 @@  discard block
 block discarded – undo
1322 1322
 	 * updates the TXN status based on the amount paid
1323 1323
 	 */
1324 1324
 	public function verify_abandoned_transaction_status() {
1325
-		if ( $this->status_ID() !== EEM_Transaction::abandoned_status_code ) {
1325
+		if ($this->status_ID() !== EEM_Transaction::abandoned_status_code) {
1326 1326
 			return;
1327 1327
 		}
1328
-		$payments = $this->get_many_related( 'Payment' );
1329
-		if ( ! empty( $payments ) ) {
1330
-			foreach ( $payments as $payment ) {
1331
-				if ( $payment instanceof EE_Payment ) {
1328
+		$payments = $this->get_many_related('Payment');
1329
+		if ( ! empty($payments)) {
1330
+			foreach ($payments as $payment) {
1331
+				if ($payment instanceof EE_Payment) {
1332 1332
 					// kk this TXN should NOT be abandoned
1333 1333
 					$this->update_status_based_on_total_paid();
1334
-					if ( is_admin() && ! ( defined('DOING_AJAX') && DOING_AJAX ) ) {
1334
+					if (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)) {
1335 1335
 						EE_Error::add_attention(
1336 1336
 							sprintf(
1337 1337
 								esc_html__(
@@ -1347,8 +1347,8 @@  discard block
 block discarded – undo
1347 1347
 					$finalized = $this->final_reg_step_completed();
1348 1348
 					// if the 'finalize_registration' step has been initiated (has a timestamp)
1349 1349
 					// but has not yet been fully completed (TRUE)
1350
-					if ( is_int( $finalized ) && $finalized !== false && $finalized !== true ) {
1351
-						$this->set_reg_step_completed( 'finalize_registration' );
1350
+					if (is_int($finalized) && $finalized !== false && $finalized !== true) {
1351
+						$this->set_reg_step_completed('finalize_registration');
1352 1352
 						$this->save();
1353 1353
 					}
1354 1354
 				}
Please login to merge, or discard this patch.
core/db_models/EEM_Country.model.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 
84 84
 
85 85
 	/**
86
-	*		_get_countries
87
-	*
88
-	* 		@access		public
89
-	*		@return 		array
90
-	*/
86
+	 *		_get_countries
87
+	 *
88
+	 * 		@access		public
89
+	 *		@return 		array
90
+	 */
91 91
 	public function get_all_countries() {
92 92
 		if ( ! self::$_all_countries ) {
93 93
 			self::$_all_countries = $this->get_all( array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 
98 98
 	/**
99
-	*		_get_countries
100
-	*		Gets and caches the list of active countries. If you know the list of active countries
101
-	*		has changed during this request, first use EEM_Country::reset() to flush the cache
102
-	* 		@access		public
103
-	*		@return 		array
104
-	*/
99
+	 *		_get_countries
100
+	 *		Gets and caches the list of active countries. If you know the list of active countries
101
+	 *		has changed during this request, first use EEM_Country::reset() to flush the cache
102
+	 * 		@access		public
103
+	 *		@return 		array
104
+	 */
105 105
 	public function get_all_active_countries() {
106 106
 		if ( ! self::$_active_countries ) {
107 107
 			self::$_active_countries =  $this->get_all( array( array( 'CNT_active' => TRUE ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
 	 * Resets the country
37 37
 	 * @return EEM_Country
38 38
 	 */
39
-	public static function reset( $timezone = NULL ){
39
+	public static function reset($timezone = NULL) {
40 40
 		self::$_active_countries = NULL;
41 41
 		self::$_all_countries = NULL;
42
-		return parent::reset( $timezone );
42
+		return parent::reset($timezone);
43 43
 	}
44 44
 
45
-	protected function __construct( $timezone = NULL ){
46
-		$this->singular_item = __('Country','event_espresso');
47
-		$this->plural_item = __('Countries','event_espresso');
45
+	protected function __construct($timezone = NULL) {
46
+		$this->singular_item = __('Country', 'event_espresso');
47
+		$this->plural_item = __('Countries', 'event_espresso');
48 48
 
49 49
 
50 50
 		$this->_tables = array(
@@ -52,21 +52,21 @@  discard block
 block discarded – undo
52 52
 		);
53 53
 		$this->_fields = array(
54 54
 			'Country'=>array(
55
-				'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists','event_espresso'), false, true),
56
-				'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code','event_espresso')),
57
-				'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code','event_espresso'), false,''),
58
-				'RGN_ID'=>new EE_Integer_Field('RGN_ID', __('Region ID','event_espresso'), false,0),//should be a foreign key, but no region table exists yet
59
-				'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name','event_espresso'), false,''),
60
-				'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code','event_espresso'), false),
61
-				'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular','event_espresso'), false),
62
-				'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural','event_espresso'), false),
63
-				'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign','event_espresso'), false),
64
-				'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number','event_espresso'), false, true),
65
-				'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places','event_espresso'), false, 2),
66
-				'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark','event_espresso'), false, '.'),
67
-				'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator','event_espresso'), false, ','),
68
-				'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code','event_espresso'), false, ''),
69
-				'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU','event_espresso'), false, false)
55
+				'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists', 'event_espresso'), false, true),
56
+				'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code', 'event_espresso')),
57
+				'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code', 'event_espresso'), false, ''),
58
+				'RGN_ID'=>new EE_Integer_Field('RGN_ID', __('Region ID', 'event_espresso'), false, 0), //should be a foreign key, but no region table exists yet
59
+				'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name', 'event_espresso'), false, ''),
60
+				'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code', 'event_espresso'), false),
61
+				'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular', 'event_espresso'), false),
62
+				'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural', 'event_espresso'), false),
63
+				'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign', 'event_espresso'), false),
64
+				'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number', 'event_espresso'), false, true),
65
+				'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2),
66
+				'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark', 'event_espresso'), false, '.'),
67
+				'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator', 'event_espresso'), false, ','),
68
+				'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code', 'event_espresso'), false, ''),
69
+				'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU', 'event_espresso'), false, false)
70 70
 			));
71 71
 		$this->_model_relations = array(
72 72
 			'Attendee'=>new EE_Has_Many_Relation(),
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 			'Venue'=>new EE_Has_Many_Relation(),
75 75
 		);
76 76
 		//only anyone to view, but only those with the default role can do anything
77
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
77
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
78 78
 
79
-		parent::__construct( $timezone );
79
+		parent::__construct($timezone);
80 80
 	}
81 81
 
82 82
 
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 	*		@return 		array
90 90
 	*/
91 91
 	public function get_all_countries() {
92
-		if ( ! self::$_all_countries ) {
93
-			self::$_all_countries = $this->get_all( array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
92
+		if ( ! self::$_all_countries) {
93
+			self::$_all_countries = $this->get_all(array('order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array(0, 99999)));
94 94
 		}
95 95
 		return self::$_all_countries;
96 96
 	}
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	*		@return 		array
104 104
 	*/
105 105
 	public function get_all_active_countries() {
106
-		if ( ! self::$_active_countries ) {
107
-			self::$_active_countries =  $this->get_all( array( array( 'CNT_active' => TRUE ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
106
+		if ( ! self::$_active_countries) {
107
+			self::$_active_countries = $this->get_all(array(array('CNT_active' => TRUE), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array(0, 99999)));
108 108
 		}
109 109
 		return self::$_active_countries;
110 110
 	}
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 	 * @param string $country_ISO
115 115
 	 * @return string
116 116
 	 */
117
-	public function get_country_name_by_ISO( $country_ISO ){
118
-		if( isset( self::$_all_countries[ $country_ISO ] ) &&
119
-				self::$_all_countries[ $country_ISO ] instanceof EE_Country ){
120
-			return self::$_all_countries[ $country_ISO ]->name();
117
+	public function get_country_name_by_ISO($country_ISO) {
118
+		if (isset(self::$_all_countries[$country_ISO]) &&
119
+				self::$_all_countries[$country_ISO] instanceof EE_Country) {
120
+			return self::$_all_countries[$country_ISO]->name();
121 121
 		}
122
-		$names = $this->get_col( array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name' );
123
-		if( is_array( $names ) && ! empty( $names ) ){
124
-			return reset( $names );
125
-		}else{
122
+		$names = $this->get_col(array(array('CNT_ISO' => $country_ISO), 'limit' => 1), 'CNT_name');
123
+		if (is_array($names) && ! empty($names)) {
124
+			return reset($names);
125
+		} else {
126 126
 			return '';
127 127
 		}
128 128
 	}
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 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
  *
@@ -122,7 +124,7 @@  discard block
 block discarded – undo
122 124
 		$names = $this->get_col( array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name' );
123 125
 		if( is_array( $names ) && ! empty( $names ) ){
124 126
 			return reset( $names );
125
-		}else{
127
+		} else{
126 128
 			return '';
127 129
 		}
128 130
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Currency.model.php 2 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -75,12 +76,12 @@  discard block
 block discarded – undo
75 76
 		if($payment_method_type instanceof EE_PMT_Base &&
76 77
 				$payment_method_type->get_gateway()){
77 78
 			$currencies_supported = $payment_method_type->get_gateway()->currencies_supported();
78
-		}else{
79
+		} else{
79 80
 			$currencies_supported = EE_Gateway::all_currencies_supported;
80 81
 		}
81 82
 		if($currencies_supported == EE_Gateway::all_currencies_supported || empty( $currencies_supported ) ) {
82 83
 			$currencies = $this->get_all_active();
83
-		}else{
84
+		} else{
84 85
 			$currencies = $this->get_all_active(array(array('CUR_code'=>array('IN',$currencies_supported))));
85 86
 		}
86 87
 		return $currencies;
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,32 +25,32 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEM_Currency extends EEM_Base{
28
+class EEM_Currency extends EEM_Base {
29 29
 		// private instance of the Attendee object
30 30
 	protected static $_instance = NULL;
31 31
 
32
-	protected function __construct( $timezone = NULL ) {
33
-		$this->singular_item = __('Currency','event_espresso');
34
-		$this->plural_item = __('Currencies','event_espresso');
32
+	protected function __construct($timezone = NULL) {
33
+		$this->singular_item = __('Currency', 'event_espresso');
34
+		$this->plural_item = __('Currencies', 'event_espresso');
35 35
 		$this->_tables = array(
36 36
 			'Currency'=> new EE_Primary_Table('esp_currency', 'CUR_code')
37 37
 		);
38 38
 		$this->_fields = array(
39 39
 			'Currency'=>array(
40
-				'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency Code','event_espresso')),
41
-				'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular','event_espresso'), false),
42
-				'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural','event_espresso'), false),
43
-				'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign','event_espresso'), false),
44
-				'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places','event_espresso'), false, 2),
45
-				'CUR_active'=>new EE_Boolean_Field('CUR_active', __('Active?', 'event_espresso'), false,true),
40
+				'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency Code', 'event_espresso')),
41
+				'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular', 'event_espresso'), false),
42
+				'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural', 'event_espresso'), false),
43
+				'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign', 'event_espresso'), false),
44
+				'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2),
45
+				'CUR_active'=>new EE_Boolean_Field('CUR_active', __('Active?', 'event_espresso'), false, true),
46 46
 			));
47 47
 		$this->_model_relations = array(
48 48
 			'Payment_Method'=>new EE_HABTM_Relation('Currency_Payment_Method'),
49 49
 		);
50 50
 		//this model is generally available for reading
51
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
51
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
52 52
 
53
-		parent::__construct( $timezone );
53
+		parent::__construct($timezone);
54 54
 	}
55 55
 
56 56
 	/**
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 	 * @param array $query_params see EEM_Base::get_all
60 60
 	 * @return EE_Currency[]
61 61
 	 */
62
-	public function get_all_active($query_params = array()){
62
+	public function get_all_active($query_params = array()) {
63 63
 		$query_params[0]['CUR_active'] = true;
64
-		if( ! isset($query_params['order_by'])){
65
-			$query_params['order_by'] = array('CUR_code'=>'ASC','CUR_single'=>'ASC');
64
+		if ( ! isset($query_params['order_by'])) {
65
+			$query_params['order_by'] = array('CUR_code'=>'ASC', 'CUR_single'=>'ASC');
66 66
 		}
67 67
 		return $this->get_all($query_params);
68 68
 	}
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
 	 * @param EE_PMT_Base $payment_method_type
72 72
 	 * @return EE_Currency[]
73 73
 	 */
74
-	public function get_all_currencies_usable_by($payment_method_type){
75
-		if($payment_method_type instanceof EE_PMT_Base &&
76
-				$payment_method_type->get_gateway()){
74
+	public function get_all_currencies_usable_by($payment_method_type) {
75
+		if ($payment_method_type instanceof EE_PMT_Base &&
76
+				$payment_method_type->get_gateway()) {
77 77
 			$currencies_supported = $payment_method_type->get_gateway()->currencies_supported();
78
-		}else{
78
+		} else {
79 79
 			$currencies_supported = EE_Gateway::all_currencies_supported;
80 80
 		}
81
-		if($currencies_supported == EE_Gateway::all_currencies_supported || empty( $currencies_supported ) ) {
81
+		if ($currencies_supported == EE_Gateway::all_currencies_supported || empty($currencies_supported)) {
82 82
 			$currencies = $this->get_all_active();
83
-		}else{
84
-			$currencies = $this->get_all_active(array(array('CUR_code'=>array('IN',$currencies_supported))));
83
+		} else {
84
+			$currencies = $this->get_all_active(array(array('CUR_code'=>array('IN', $currencies_supported))));
85 85
 		}
86 86
 		return $currencies;
87 87
 	}
Please login to merge, or discard this patch.