Completed
Branch BUG-10375-migrations-not-repor... (1e9646)
by
unknown
62:53 queued 49:42
created
core/helpers/EEH_Export.helper.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -87,13 +87,13 @@
 block discarded – undo
87 87
 
88 88
 	 /**
89 89
 	  *
90
-	 *	Writes a row to the csv file
91
-	 *	@param array $row - individual row of csv data
92
-	 *	@param string $delimiter - csv delimiter
93
-	 *	@param string $enclosure - csv enclosure
94
-	 *	@param bool $mysql_null - allows php NULL to be overridden with MySQl's insertable NULL value
95
-	 *	@return string of text for teh csv file
96
-	 */
90
+	  *	Writes a row to the csv file
91
+	  *	@param array $row - individual row of csv data
92
+	  *	@param string $delimiter - csv delimiter
93
+	  *	@param string $enclosure - csv enclosure
94
+	  *	@param bool $mysql_null - allows php NULL to be overridden with MySQl's insertable NULL value
95
+	  *	@return string of text for teh csv file
96
+	  */
97 97
 	public static function get_csv_row ( array $row, $delimiter = ',', $enclosure = '"', $mysql_null = false ) {
98 98
 		//Allow user to filter the csv delimiter and enclosure for other countries csv standards
99 99
 		$delimiter = apply_filters( 'FHEE__EE_CSV__fputcsv2__delimiter', $delimiter );
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 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
  *
@@ -77,7 +79,7 @@  discard block
 block discarded – undo
77 79
 				$new_file_contents .= EEH_Export::get_csv_row( $data_row);
78 80
 			}
79 81
 			return EEH_File::write_to_file( $filepath, EEH_File::get_file_contents( $filepath ) . $new_file_contents );
80
-		}else{
82
+		} else{
81 83
 			//no data TO write... so we can assume that's a success
82 84
 			return true;
83 85
 		}
@@ -138,9 +140,9 @@  discard block
 block discarded – undo
138 140
 		}
139 141
 		if( $pretty_schema === true){
140 142
 			return $field_obj->prepare_for_pretty_echoing( $value_on_model_obj );
141
-		}elseif( is_string( $pretty_schema ) ) {
143
+		} elseif( is_string( $pretty_schema ) ) {
142 144
 			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema );
143
-		}else{
145
+		} else{
144 146
 			return $field_obj->prepare_for_get( $value_on_model_obj );
145 147
 		}
146 148
 	}
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @param EE_Model_Field_Base $field
31 31
 	 * @return string
32 32
 	 */
33
-	public static function get_column_name_for_field(EE_Model_Field_Base $field){
33
+	public static function get_column_name_for_field(EE_Model_Field_Base $field) {
34 34
 		return $field->get_nicename()."[".$field->get_name()."]";
35 35
 	}
36 36
 
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
 	 * 						we consider that a success (because we wrote everything there was...nothing)
53 53
 	 * @throws EE_Error
54 54
 	 */
55
-	public static function write_data_array_to_csv( $filepath, $data, $write_column_headers = true ){
55
+	public static function write_data_array_to_csv($filepath, $data, $write_column_headers = true) {
56 56
 
57 57
 		$new_file_contents = '';
58 58
 		//determine if $data is actually a 2d array
59
-		if ( $data && is_array($data) && is_array(EEH_Array::get_one_item_from_array($data))){
59
+		if ($data && is_array($data) && is_array(EEH_Array::get_one_item_from_array($data))) {
60 60
 			//make sure top level is numerically indexed,
61 61
 
62
-			if( EEH_Array::is_associative_array($data)){
63
-				throw new EE_Error(sprintf(__("top-level array must be numerically indexed. Does these look like numbers to you? %s","event_espresso"),implode(",",array_keys($data))));
62
+			if (EEH_Array::is_associative_array($data)) {
63
+				throw new EE_Error(sprintf(__("top-level array must be numerically indexed. Does these look like numbers to you? %s", "event_espresso"), implode(",", array_keys($data))));
64 64
 			}
65 65
 			$item_in_top_level_array = EEH_Array::get_one_item_from_array($data);
66 66
 			//now, is the last item in the top-level array of $data an associative or numeric array?
67
-			if( $write_column_headers &&
68
-					EEH_Array::is_associative_array($item_in_top_level_array)){
67
+			if ($write_column_headers &&
68
+					EEH_Array::is_associative_array($item_in_top_level_array)) {
69 69
 				//its associative, so we want to output its keys as column headers
70 70
 				$keys = array_keys($item_in_top_level_array);
71
-				$new_file_contents .=  EEH_Export::get_csv_row( $keys );
71
+				$new_file_contents .= EEH_Export::get_csv_row($keys);
72 72
 
73 73
 			}
74 74
 			//start writing data
75
-			foreach($data as $data_row){
76
-				$new_file_contents .= EEH_Export::get_csv_row( $data_row);
75
+			foreach ($data as $data_row) {
76
+				$new_file_contents .= EEH_Export::get_csv_row($data_row);
77 77
 			}
78
-			return EEH_File::write_to_file( $filepath, EEH_File::get_file_contents( $filepath ) . $new_file_contents );
79
-		}else{
78
+			return EEH_File::write_to_file($filepath, EEH_File::get_file_contents($filepath).$new_file_contents);
79
+		} else {
80 80
 			//no data TO write... so we can assume that's a success
81 81
 			return true;
82 82
 		}
@@ -93,29 +93,29 @@  discard block
 block discarded – undo
93 93
 	 *	@param bool $mysql_null - allows php NULL to be overridden with MySQl's insertable NULL value
94 94
 	 *	@return string of text for teh csv file
95 95
 	 */
96
-	public static function get_csv_row ( array $row, $delimiter = ',', $enclosure = '"', $mysql_null = false ) {
96
+	public static function get_csv_row(array $row, $delimiter = ',', $enclosure = '"', $mysql_null = false) {
97 97
 		//Allow user to filter the csv delimiter and enclosure for other countries csv standards
98
-		$delimiter = apply_filters( 'FHEE__EE_CSV__fputcsv2__delimiter', $delimiter );
99
-		$enclosure = apply_filters( 'FHEE__EE_CSV__fputcsv2__enclosure', $enclosure );
98
+		$delimiter = apply_filters('FHEE__EE_CSV__fputcsv2__delimiter', $delimiter);
99
+		$enclosure = apply_filters('FHEE__EE_CSV__fputcsv2__enclosure', $enclosure);
100 100
 
101 101
 		$delimiter_esc = preg_quote($delimiter, '/');
102 102
 		$enclosure_esc = preg_quote($enclosure, '/');
103 103
 
104 104
 		$output = array();
105 105
 		foreach ($row as $field_value) {
106
-			if(is_object($field_value) || is_array($field_value)){
106
+			if (is_object($field_value) || is_array($field_value)) {
107 107
 				$field_value = serialize($field_value);
108 108
 			}
109
-			if ($field_value === null && $mysql_null ) {
109
+			if ($field_value === null && $mysql_null) {
110 110
 				$output[] = 'NULL';
111 111
 				continue;
112 112
 			}
113 113
 
114 114
 			$output[] = preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field_value) ?
115
-				( $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field_value) . $enclosure ) : $field_value;
115
+				($enclosure.str_replace($enclosure, $enclosure.$enclosure, $field_value).$enclosure) : $field_value;
116 116
 		}
117 117
 
118
-		return  implode($delimiter, $output) . PHP_EOL;
118
+		return  implode($delimiter, $output).PHP_EOL;
119 119
 	}
120 120
 
121 121
 
@@ -128,19 +128,19 @@  discard block
 block discarded – undo
128 128
 	 * @param boolean|string $pretty_schema true to display pretty, a string to use a specific "Schema", or false to NOT display pretty
129 129
 	 * @return string
130 130
 	 */
131
-	public static function prepare_value_from_db_for_display( $model, $field_name,  $raw_db_value, $pretty_schema = true ) {
132
-		$field_obj = $model->field_settings_for( $field_name );
133
-		$value_on_model_obj = $field_obj->prepare_for_set_from_db( $raw_db_value );
134
-		if( $field_obj instanceof EE_Datetime_Field ) {
135
-			$field_obj->set_date_format( EEH_Export::get_date_format_for_export( $field_obj->get_date_format( $pretty_schema ) ), $pretty_schema );
136
-			$field_obj->set_time_format( EEH_Export::get_time_format_for_export( $field_obj->get_time_format( $pretty_schema ) ), $pretty_schema );
131
+	public static function prepare_value_from_db_for_display($model, $field_name, $raw_db_value, $pretty_schema = true) {
132
+		$field_obj = $model->field_settings_for($field_name);
133
+		$value_on_model_obj = $field_obj->prepare_for_set_from_db($raw_db_value);
134
+		if ($field_obj instanceof EE_Datetime_Field) {
135
+			$field_obj->set_date_format(EEH_Export::get_date_format_for_export($field_obj->get_date_format($pretty_schema)), $pretty_schema);
136
+			$field_obj->set_time_format(EEH_Export::get_time_format_for_export($field_obj->get_time_format($pretty_schema)), $pretty_schema);
137 137
 		}
138
-		if( $pretty_schema === true){
139
-			return $field_obj->prepare_for_pretty_echoing( $value_on_model_obj );
140
-		}elseif( is_string( $pretty_schema ) ) {
141
-			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema );
142
-		}else{
143
-			return $field_obj->prepare_for_get( $value_on_model_obj );
138
+		if ($pretty_schema === true) {
139
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj);
140
+		}elseif (is_string($pretty_schema)) {
141
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema);
142
+		} else {
143
+			return $field_obj->prepare_for_get($value_on_model_obj);
144 144
 		}
145 145
 	}
146 146
 
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	 * @param string $current_format
152 152
 	 * @return string
153 153
 	 */
154
-	public static function get_date_format_for_export( $current_format = null ) {
155
-		return apply_filters( 'FHEE__EE_CSV__get_date_format_for_csv__format', 'Y-m-d', $current_format );
154
+	public static function get_date_format_for_export($current_format = null) {
155
+		return apply_filters('FHEE__EE_CSV__get_date_format_for_csv__format', 'Y-m-d', $current_format);
156 156
 	}
157 157
 
158 158
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	 * @param string $current_format
163 163
 	 * @return string
164 164
 	 */
165
-	public static function get_time_format_for_export( $current_format = null ) {
166
-		return apply_filters( 'FHEE__EE_CSV__get_time_format_for_csv__format', 'H:i:s', $current_format );
165
+	public static function get_time_format_for_export($current_format = null) {
166
+		return apply_filters('FHEE__EE_CSV__get_time_format_for_csv__format', 'H:i:s', $current_format);
167 167
 	}
168 168
 
169 169
 
Please login to merge, or discard this patch.
core/libraries/batch/BatchRequestProcessor.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 use EventEspressoBatchRequest\Helpers\JobParameters;
24 24
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
25 25
 
26
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
27
-	exit( 'No direct script access allowed' );
26
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
27
+	exit('No direct script access allowed');
28 28
 }
29 29
 
30 30
 
@@ -50,32 +50,32 @@  discard block
 block discarded – undo
50 50
 	 * @param array $request_data to be used by the batch job handler
51 51
 	 * @return JobStepResponse
52 52
 	 */
53
-	public function create_job( $batch_job_handler_class, $request_data ) {
53
+	public function create_job($batch_job_handler_class, $request_data) {
54 54
 		try {
55
-			$this->_job_id = wp_generate_password( 15, false );
56
-			$obj = $this->instantiate_batch_job_handler_from_classname( $batch_job_handler_class );
57
-			$this->_job_parameters = new JobParameters( $this->_job_id, $batch_job_handler_class, $request_data );
58
-			$response = $obj->create_job( $this->_job_parameters );
59
-			if( ! $response instanceof JobStepResponse ) {
55
+			$this->_job_id = wp_generate_password(15, false);
56
+			$obj = $this->instantiate_batch_job_handler_from_classname($batch_job_handler_class);
57
+			$this->_job_parameters = new JobParameters($this->_job_id, $batch_job_handler_class, $request_data);
58
+			$response = $obj->create_job($this->_job_parameters);
59
+			if ( ! $response instanceof JobStepResponse) {
60 60
 				throw new BatchRequestException(
61 61
 					sprintf(
62
-						__( 'The class implementing JobHandlerInterface did not return a JobStepResponse when create_job was called with %1$s. It needs to return one or throw an Exception', 'event_espresso' ),
63
-						wp_json_encode( $request_data )
62
+						__('The class implementing JobHandlerInterface did not return a JobStepResponse when create_job was called with %1$s. It needs to return one or throw an Exception', 'event_espresso'),
63
+						wp_json_encode($request_data)
64 64
 					)
65 65
 				);
66 66
 			}
67
-			$success = $this->_job_parameters->save( true );
68
-			if( ! $success ) {
67
+			$success = $this->_job_parameters->save(true);
68
+			if ( ! $success) {
69 69
 				throw new BatchRequestException(
70 70
 					sprintf(
71 71
 						__('Could not save job %1$s to the Wordpress Options table. These were the arguments used: %2$s', 'event_espresso'),
72 72
 						$this->_job_id,
73
-						wp_json_encode( $request_data )
73
+						wp_json_encode($request_data)
74 74
 					)
75 75
 				);
76 76
 			}
77
-		} catch( \Exception $e ) {
78
-			$response = $this->_get_error_response( $e, 'create_job' );
77
+		} catch (\Exception $e) {
78
+			$response = $this->_get_error_response($e, 'create_job');
79 79
 		}
80 80
 		return $response;
81 81
 	}
@@ -88,26 +88,26 @@  discard block
 block discarded – undo
88 88
 	 * @param int $batch_size
89 89
 	 * @return JobStepResponse
90 90
 	 */
91
-	public function continue_job( $job_id, $batch_size = 50 ) {
91
+	public function continue_job($job_id, $batch_size = 50) {
92 92
 		try {
93 93
 			$this->_job_id = $job_id;
94
-			$batch_size = defined( 'EE_BATCHRUNNER_BATCH_SIZE' ) ? EE_BATCHRUNNER_BATCH_SIZE : $batch_size;
94
+			$batch_size = defined('EE_BATCHRUNNER_BATCH_SIZE') ? EE_BATCHRUNNER_BATCH_SIZE : $batch_size;
95 95
 			//get the corresponding WordPress option for the job
96
-			$this->_job_parameters = JobParameters::load( $this->_job_id );
97
-			$handler_obj = $this->instantiate_batch_job_handler_from_classname( $this->_job_parameters->classname() );
96
+			$this->_job_parameters = JobParameters::load($this->_job_id);
97
+			$handler_obj = $this->instantiate_batch_job_handler_from_classname($this->_job_parameters->classname());
98 98
 			//continue it
99
-			$response = $handler_obj->continue_job( $this->_job_parameters, $batch_size );
100
-			if( ! $response instanceof JobStepResponse ) {
99
+			$response = $handler_obj->continue_job($this->_job_parameters, $batch_size);
100
+			if ( ! $response instanceof JobStepResponse) {
101 101
 				throw new BatchRequestException(
102 102
 					sprintf(
103
-						__( 'The class implementing JobHandlerInterface did not return a JobStepResponse when continue_job was called with job %1$s. It needs to return one or throw an Exception', 'event_espresso' ),
103
+						__('The class implementing JobHandlerInterface did not return a JobStepResponse when continue_job was called with job %1$s. It needs to return one or throw an Exception', 'event_espresso'),
104 104
 						$this->_job_id
105 105
 					)
106 106
 				);
107 107
 			}
108 108
 			$this->_job_parameters->save();
109
-		} catch( \Exception $e ) {
110
-			$response = $this->_get_error_response( $e, 'continue_job' );
109
+		} catch (\Exception $e) {
110
+			$response = $this->_get_error_response($e, 'continue_job');
111 111
 		}
112 112
 		return $response;
113 113
 	}
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 * @return JobHandlerInterface
123 123
 	 * @throws BatchRequestException
124 124
 	 */
125
-	public function instantiate_batch_job_handler_from_classname( $classname ) {
126
-		if( ! class_exists( $classname ) ) {
125
+	public function instantiate_batch_job_handler_from_classname($classname) {
126
+		if ( ! class_exists($classname)) {
127 127
 			throw new BatchRequestException(
128 128
 				sprintf(
129 129
 					__('The class %1$s does not exist, and so could not be used for running a job. It should implement JobHandlerInterface.', 'event_espresso'),
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			);
133 133
 		}
134 134
 		$obj = new $classname;
135
-		if( ! $obj instanceof JobHandlerInterface ) {
135
+		if ( ! $obj instanceof JobHandlerInterface) {
136 136
 			throw new BatchRequestException(
137 137
 				sprintf(
138 138
 					__('The class %1$s does not implement JobHandlerInterface and so could not be used for running a job', 'event_espresso'),
@@ -152,26 +152,26 @@  discard block
 block discarded – undo
152 152
 	 * @return JobStepResponse
153 153
 	 * @throws BatchRequestException
154 154
 	 */
155
-	public function cleanup_job( $job_id ) {
156
-		try{
155
+	public function cleanup_job($job_id) {
156
+		try {
157 157
 			$this->_job_id = $job_id;
158
-			$job_parameters = JobParameters::load( $this->_job_id );
159
-			$handler_obj = $this->instantiate_batch_job_handler_from_classname( $job_parameters->classname() );
158
+			$job_parameters = JobParameters::load($this->_job_id);
159
+			$handler_obj = $this->instantiate_batch_job_handler_from_classname($job_parameters->classname());
160 160
 			//continue it
161
-			$response = $handler_obj->cleanup_job( $job_parameters );
162
-			if( ! $response instanceof JobStepResponse ) {
161
+			$response = $handler_obj->cleanup_job($job_parameters);
162
+			if ( ! $response instanceof JobStepResponse) {
163 163
 				throw new BatchRequestException(
164 164
 					sprintf(
165
-						__( 'The class implementing JobHandlerInterface did not return a JobStepResponse when cleanup_job was called with job %1$s. It needs to return one or throw an Exception', 'event_espresso' ),
165
+						__('The class implementing JobHandlerInterface did not return a JobStepResponse when cleanup_job was called with job %1$s. It needs to return one or throw an Exception', 'event_espresso'),
166 166
 						$this->_job_id
167 167
 					)
168 168
 				);
169 169
 			}
170
-			$job_parameters->set_status( JobParameters::status_cleaned_up );
170
+			$job_parameters->set_status(JobParameters::status_cleaned_up);
171 171
 			$job_parameters->delete();
172 172
 			return $response;
173
-		} catch( \Exception $e ) {
174
-			$response = $this->_get_error_response( $e, 'cleanup_job' );
173
+		} catch (\Exception $e) {
174
+			$response = $this->_get_error_response($e, 'cleanup_job');
175 175
 		}
176 176
 		return $response;
177 177
 	}
@@ -184,17 +184,17 @@  discard block
 block discarded – undo
184 184
 	 * @param string $method_name
185 185
 	 * @return JobStepResponse
186 186
 	 */
187
-	protected function _get_error_response( \Exception $exception, $method_name ) {
188
-		if( ! $this->_job_parameters instanceof JobParameters ) {
189
-			$this->_job_parameters = new JobParameters( $this->_job_id, __( '__Unknown__', 'event_espresso' ), array() );
187
+	protected function _get_error_response(\Exception $exception, $method_name) {
188
+		if ( ! $this->_job_parameters instanceof JobParameters) {
189
+			$this->_job_parameters = new JobParameters($this->_job_id, __('__Unknown__', 'event_espresso'), array());
190 190
 		}
191
-		$this->_job_parameters->set_status( JobParameters::status_error );
191
+		$this->_job_parameters->set_status(JobParameters::status_error);
192 192
 		return new JobStepResponse(
193 193
 			$this->_job_parameters,
194 194
 			sprintf(
195 195
 				__('An exception of type %1$s occurred while running %2$s. Its message was %3$s and had trace %4$s', 'event_espresso'),
196
-				get_class( $exception ),
197
-				'BatchRunner::' . $method_name . '()',
196
+				get_class($exception),
197
+				'BatchRunner::'.$method_name.'()',
198 198
 				$exception->getMessage(),
199 199
 				$exception->getTraceAsString()
200 200
 			)
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
  /**
3
- *
4
- * Class BatchRequetProcessor
3
+  *
4
+  * Class BatchRequetProcessor
5 5
   * 
6
- * Responsible for receiving a request to start a job and assign it a job Id.
7
- * Then when subsequent requests come in to continue that job, dispatches
8
- * the request to the appropriate JobHandler, which processes a step of the batch,
9
- * and then returns the job's new status.
10
- * This class is used by controller code, and the controller code is sent HTTP
11
- * requests from the batch_runner.js library
12
- *
13
- * @package         Event Espresso
14
- * @subpackage    batch
15
- * @author				Mike Nelson
16
- * @since		 	   4.8.26
17
- *
18
- */
6
+  * Responsible for receiving a request to start a job and assign it a job Id.
7
+  * Then when subsequent requests come in to continue that job, dispatches
8
+  * the request to the appropriate JobHandler, which processes a step of the batch,
9
+  * and then returns the job's new status.
10
+  * This class is used by controller code, and the controller code is sent HTTP
11
+  * requests from the batch_runner.js library
12
+  *
13
+  * @package         Event Espresso
14
+  * @subpackage    batch
15
+  * @author				Mike Nelson
16
+  * @since		 	   4.8.26
17
+  *
18
+  */
19 19
 namespace EventEspressoBatchRequest;
20 20
 
21 21
 use EventEspressoBatchRequest\JobHandlerBaseClasses\JobHandlerInterface;
Please login to merge, or discard this patch.
core/libraries/batch/Helpers/BatchRequestException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 namespace EventEspressoBatchRequest\Helpers;
16 16
 if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
17 17
 
18
-class BatchRequestException extends \Exception{
18
+class BatchRequestException extends \Exception {
19 19
 	//so far the same as exception
20 20
 }
21 21
 
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php 
2 2
  /**
3
- *
4
- * Class BatchRequestException
5
- *
6
- * Exception class for whenever we have trouble running start, continuing, or finishing
7
- * a batch job.
8
- *
9
- * @package         Event Espresso
10
- * @subpackage    batch
11
- * @author				Mike Nelson
12
- * @since		 	   4.8.26
13
- *
14
- */
3
+  *
4
+  * Class BatchRequestException
5
+  *
6
+  * Exception class for whenever we have trouble running start, continuing, or finishing
7
+  * a batch job.
8
+  *
9
+  * @package         Event Espresso
10
+  * @subpackage    batch
11
+  * @author				Mike Nelson
12
+  * @since		 	   4.8.26
13
+  *
14
+  */
15 15
 namespace EventEspressoBatchRequest\Helpers;
16 16
 if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
17 17
 
Please login to merge, or discard this patch.
core/libraries/batch/Helpers/JobStepResponse.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@
 block discarded – undo
43 43
 	 * @param string $update_text
44 44
 	 * @param array $extra_data
45 45
 	 */
46
-	public function __construct(JobParameters $job_parameters, $update_text, $extra_data = array() ) {
47
-		$this->_job_parameters 	= $job_parameters;
46
+	public function __construct(JobParameters $job_parameters, $update_text, $extra_data = array()) {
47
+		$this->_job_parameters = $job_parameters;
48 48
 		$this->_update_text 	= $update_text;
49
-		$this->_extra_data 		= (array)$extra_data;
49
+		$this->_extra_data 		= (array) $extra_data;
50 50
 	}
51 51
 
52 52
 
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlerBaseClasses/JobHandlerInterface.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 use EventEspressoBatchRequest\Helpers\JobParameters;
21 21
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
22 22
 
23
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
24
-	exit( 'No direct script access allowed' );
23
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
24
+	exit('No direct script access allowed');
25 25
 }
26 26
 
27 27
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @throws BatchRequestException
36 36
 	 * @return JobStepResponse
37 37
 	 */
38
-	public function create_job( JobParameters $job_parameters );
38
+	public function create_job(JobParameters $job_parameters);
39 39
 
40 40
 	/**
41 41
 	 * Performs another step of the job
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @return JobStepResponse
45 45
 	 * @throws BatchRequestException
46 46
 	 */
47
-	public function continue_job( JobParameters $job_parameters, $batch_size = 50 );
47
+	public function continue_job(JobParameters $job_parameters, $batch_size = 50);
48 48
 
49 49
 	/**
50 50
 	 * Performs any clean-up logic when we know the job is completed
@@ -52,5 +52,5 @@  discard block
 block discarded – undo
52 52
 	 * @return JobStepResponse
53 53
 	 * @throws BatchRequestException
54 54
 	 */
55
-	public function cleanup_job( JobParameters $job_parameters );
55
+	public function cleanup_job(JobParameters $job_parameters);
56 56
 }
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlers/AttendeesReport.php 3 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,10 +99,10 @@
 block discarded – undo
99 99
 				if( $field_name == 'STA_ID' ){
100 100
 					$state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' );
101 101
 					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
102
-				}elseif( $field_name == 'CNT_ISO' ){
102
+				} elseif( $field_name == 'CNT_ISO' ){
103 103
 					$country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' );
104 104
 					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
105
-				}else{
105
+				} else{
106 106
 					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
107 107
 				}
108 108
 			}
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use EventEspressoBatchRequest\Helpers\JobParameters;
19 19
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
20 20
 
21
-if (!defined('EVENT_ESPRESSO_VERSION')) {
21
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
22 22
 	exit('No direct script access allowed');
23 23
 }
24 24
 
@@ -27,84 +27,84 @@  discard block
 block discarded – undo
27 27
 
28 28
 
29 29
 	public function create_job(JobParameters $job_parameters) {
30
-		if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_contacts', 'generating_report' ) ) {
30
+		if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_contacts', 'generating_report')) {
31 31
 			throw new BatchRequestException(
32
-				__( 'You do not have permission to view contacts', 'event_espresso')
32
+				__('You do not have permission to view contacts', 'event_espresso')
33 33
 			);
34 34
 		}
35 35
 		$filepath = $this->create_file_from_job_with_name(
36 36
 			$job_parameters->job_id(),
37 37
 			__('contact-list-report.csv', 'event_espresso')
38 38
 		);
39
-		$job_parameters->add_extra_data( 'filepath', $filepath );
40
-		$job_parameters->set_job_size( $this->count_units_to_process() );
39
+		$job_parameters->add_extra_data('filepath', $filepath);
40
+		$job_parameters->set_job_size($this->count_units_to_process());
41 41
 		//we should also set the header columns
42
-		$csv_data_for_row = $this->get_csv_data( 0, 1 );
43
-		\EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true );
42
+		$csv_data_for_row = $this->get_csv_data(0, 1);
43
+		\EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
44 44
 		//if we actually processed a row there, record it
45
-		if( $job_parameters->job_size() ) {
46
-			$job_parameters->mark_processed( 1 );
45
+		if ($job_parameters->job_size()) {
46
+			$job_parameters->mark_processed(1);
47 47
 		}
48 48
 		return new JobStepResponse(
49 49
 			$job_parameters,
50
-			__( 'Contacts report started successfully...', 'event_espresso' )
50
+			__('Contacts report started successfully...', 'event_espresso')
51 51
 		);
52 52
 	}
53 53
 
54 54
 
55 55
 	public function continue_job(JobParameters $job_parameters, $batch_size = 50) {
56
-		$csv_data = $this->get_csv_data( $job_parameters->units_processed(), $batch_size );
57
-		\EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false );
58
-		$units_processed = count( $csv_data );
59
-		$job_parameters->mark_processed( $units_processed );
56
+		$csv_data = $this->get_csv_data($job_parameters->units_processed(), $batch_size);
57
+		\EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
58
+		$units_processed = count($csv_data);
59
+		$job_parameters->mark_processed($units_processed);
60 60
 		$extra_response_data = array(
61 61
 			'file_url' => ''
62 62
 		);
63
-		if( $units_processed < $batch_size ) {
64
-			$job_parameters->set_status( JobParameters::status_complete );
65
-			$extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) );
63
+		if ($units_processed < $batch_size) {
64
+			$job_parameters->set_status(JobParameters::status_complete);
65
+			$extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
66 66
 		}
67 67
 		return new JobStepResponse(
68 68
 				$job_parameters,
69 69
 				sprintf(
70
-					__( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ),
71
-					count( $csv_data ) ),
70
+					__('Wrote %1$s rows to report CSV file...', 'event_espresso'),
71
+					count($csv_data) ),
72 72
 				$extra_response_data );
73 73
 	}
74 74
 
75 75
 
76 76
 	public function cleanup_job(JobParameters $job_parameters) {
77 77
 		$this->_file_helper->delete(
78
-			\EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ),
78
+			\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
79 79
 			true,
80 80
 			'd'
81 81
 		);
82
-		return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) );
82
+		return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
83 83
 	}
84 84
 
85 85
 	public function count_units_to_process() {
86
-		return \EEM_Attendee::instance()->count( array( 'caps' => \EEM_Base::caps_read_admin ));
86
+		return \EEM_Attendee::instance()->count(array('caps' => \EEM_Base::caps_read_admin));
87 87
 	}
88
-	public function get_csv_data( $offset, $limit ) {
88
+	public function get_csv_data($offset, $limit) {
89 89
 		$attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( 
90 90
 			array( 
91
-				'limit' => array( $offset, $limit ),
92
-				'force_join' => array( 'State', 'Country' ),
91
+				'limit' => array($offset, $limit),
92
+				'force_join' => array('State', 'Country'),
93 93
 				'caps' => \EEM_Base::caps_read_admin
94 94
 			) 
95 95
 		);
96 96
 		$csv_data = array();
97
-		foreach( $attendee_rows as $attendee_row ){
97
+		foreach ($attendee_rows as $attendee_row) {
98 98
 			$csv_row = array();
99
-			foreach( \EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){
100
-				if( $field_name == 'STA_ID' ){
101
-					$state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' );
102
-					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
103
-				}elseif( $field_name == 'CNT_ISO' ){
104
-					$country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' );
105
-					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
106
-				}else{
107
-					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
99
+			foreach (\EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) {
100
+				if ($field_name == 'STA_ID') {
101
+					$state_name_field = \EEM_State::instance()->field_settings_for('STA_name');
102
+					$csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()];
103
+				}elseif ($field_name == 'CNT_ISO') {
104
+					$country_name_field = \EEM_Country::instance()->field_settings_for('CNT_name');
105
+					$csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()];
106
+				} else {
107
+					$csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()];
108 108
 				}
109 109
 			}
110 110
 			$csv_data[] = $csv_row;
Please login to merge, or discard this patch.
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -85,6 +85,11 @@
 block discarded – undo
85 85
 	public function count_units_to_process() {
86 86
 		return \EEM_Attendee::instance()->count( array( 'caps' => \EEM_Base::caps_read_admin ));
87 87
 	}
88
+
89
+	/**
90
+	 * @param integer $offset
91
+	 * @param integer $limit
92
+	 */
88 93
 	public function get_csv_data( $offset, $limit ) {
89 94
 		$attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( 
90 95
 			array( 
Please login to merge, or discard this patch.
core/db_classes/EE_Registration.class.php 4 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -649,8 +649,9 @@
 block discarded – undo
649 649
 	 * @return EE_Registration
650 650
 	 */
651 651
 	public function get_primary_registration()  {
652
-		if ( $this->is_primary_registrant() )
653
-			return $this;
652
+		if ( $this->is_primary_registrant() ) {
653
+					return $this;
654
+		}
654 655
 
655 656
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
656 657
 		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 	/**
922 922
 	 * Sets deleted
923 923
 	 * @param boolean $deleted
924
-	 * @return boolean
924
+	 * @return boolean|null
925 925
 	 */
926 926
 	public function set_deleted($deleted) {
927 927
 		$this->set( 'REG_deleted', $deleted );
@@ -965,6 +965,7 @@  discard block
 block discarded – undo
965 965
 	 *
966 966
 	 * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against
967 967
 	 * @param bool   $check_approved   This is used to indicate whether the caller wants can_checkin to also consider registration status as well as datetime access.
968
+	 * @param integer $DTT_OR_ID
968 969
 	 *
969 970
 	 * @return bool
970 971
 	 */
@@ -1103,7 +1104,7 @@  discard block
 block discarded – undo
1103 1104
      * Returns the latest datetime related to this registration (via the ticket attached to the registration).
1104 1105
      * "Latest" is defined by the `DTT_EVT_start` column.
1105 1106
      *
1106
-     * @return EE_Datetime|null
1107
+     * @return null|EE_Base_Class
1107 1108
      * @throws \EE_Error
1108 1109
      */
1109 1110
 	public function get_latest_related_datetime() {
@@ -1374,7 +1375,7 @@  discard block
 block discarded – undo
1374 1375
 	 * This grabs the payment method corresponding to the last payment made for the amount owing on the registration.
1375 1376
 	 * Note: if there are no payments on the registration there will be no payment method returned.
1376 1377
 	 *
1377
-	 * @return EE_Payment_Method|null
1378
+	 * @return null|EE_Base_Class
1378 1379
 	 */
1379 1380
 	public function payment_method() {
1380 1381
 		return EEM_Payment_Method::instance()->get_last_used_for_registration( $this );
Please login to merge, or discard this patch.
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -645,9 +645,9 @@  discard block
 block discarded – undo
645 645
 
646 646
 
647 647
 	/**
648
-	*		get  Attendee Number
649
-	* 		@access		public
650
-	*/
648
+	 *		get  Attendee Number
649
+	 * 		@access		public
650
+	 */
651 651
 	public function count() {
652 652
 		return $this->get( 'REG_count' );
653 653
 	}
@@ -1029,20 +1029,20 @@  discard block
 block discarded – undo
1029 1029
 
1030 1030
 
1031 1031
 
1032
-    /**
1033
-     * toggle Check-in status for this registration
1034
-     * Check-ins are toggled in the following order:
1035
-     * never checked in -> checked in
1036
-     * checked in -> checked out
1037
-     * checked out -> checked in
1038
-     *
1039
-     * @param  int $DTT_ID  include specific datetime to toggle Check-in for.
1040
-     *                      If not included or null, then it is assumed latest datetime is being toggled.
1041
-     * @param bool $verify  If true then can_checkin() is used to verify whether the person
1042
-     *                      can be checked in or not.  Otherwise this forces change in checkin status.
1043
-     * @return bool|int     the chk_in status toggled to OR false if nothing got changed.
1044
-     * @throws EE_Error
1045
-     */
1032
+	/**
1033
+	 * toggle Check-in status for this registration
1034
+	 * Check-ins are toggled in the following order:
1035
+	 * never checked in -> checked in
1036
+	 * checked in -> checked out
1037
+	 * checked out -> checked in
1038
+	 *
1039
+	 * @param  int $DTT_ID  include specific datetime to toggle Check-in for.
1040
+	 *                      If not included or null, then it is assumed latest datetime is being toggled.
1041
+	 * @param bool $verify  If true then can_checkin() is used to verify whether the person
1042
+	 *                      can be checked in or not.  Otherwise this forces change in checkin status.
1043
+	 * @return bool|int     the chk_in status toggled to OR false if nothing got changed.
1044
+	 * @throws EE_Error
1045
+	 */
1046 1046
 	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
1047 1047
 		if ( empty( $DTT_ID ) ) {
1048 1048
 			$datetime = $this->get_latest_related_datetime();
@@ -1099,13 +1099,13 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
 
1101 1101
 
1102
-    /**
1103
-     * Returns the latest datetime related to this registration (via the ticket attached to the registration).
1104
-     * "Latest" is defined by the `DTT_EVT_start` column.
1105
-     *
1106
-     * @return EE_Datetime|null
1107
-     * @throws \EE_Error
1108
-     */
1102
+	/**
1103
+	 * Returns the latest datetime related to this registration (via the ticket attached to the registration).
1104
+	 * "Latest" is defined by the `DTT_EVT_start` column.
1105
+	 *
1106
+	 * @return EE_Datetime|null
1107
+	 * @throws \EE_Error
1108
+	 */
1109 1109
 	public function get_latest_related_datetime() {
1110 1110
 		return EEM_Datetime::instance()->get_one(
1111 1111
 			array(
@@ -1119,12 +1119,12 @@  discard block
 block discarded – undo
1119 1119
 
1120 1120
 
1121 1121
 
1122
-    /**
1123
-     * Returns the earliest datetime related to this registration (via the ticket attached to the registration).
1124
-     * "Earliest" is defined by the `DTT_EVT_start` column.
1125
-     *
1126
-     * @throws \EE_Error
1127
-     */
1122
+	/**
1123
+	 * Returns the earliest datetime related to this registration (via the ticket attached to the registration).
1124
+	 * "Earliest" is defined by the `DTT_EVT_start` column.
1125
+	 *
1126
+	 * @throws \EE_Error
1127
+	 */
1128 1128
 	public function get_earliest_related_datetime() {
1129 1129
 		return EEM_Datetime::instance()->get_one(
1130 1130
 			array(
@@ -1138,18 +1138,18 @@  discard block
 block discarded – undo
1138 1138
 
1139 1139
 
1140 1140
 
1141
-    /**
1142
-     * This method simply returns the check-in status for this registration and the given datetime.
1143
-     * If neither the datetime nor the checkin values are provided as arguments,
1144
-     * then this will return the LATEST check-in status for the registration across all datetimes it belongs to.
1145
-     *
1146
-     * @param  int $DTT_ID        The ID of the datetime we're checking against
1147
-     *                            (if empty we'll get the primary datetime for
1148
-     *                            this registration (via event) and use it's ID);
1149
-     * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1150
-     * @return int                Integer representing Check-in status.
1151
-     * @throws \EE_Error
1152
-     */
1141
+	/**
1142
+	 * This method simply returns the check-in status for this registration and the given datetime.
1143
+	 * If neither the datetime nor the checkin values are provided as arguments,
1144
+	 * then this will return the LATEST check-in status for the registration across all datetimes it belongs to.
1145
+	 *
1146
+	 * @param  int $DTT_ID        The ID of the datetime we're checking against
1147
+	 *                            (if empty we'll get the primary datetime for
1148
+	 *                            this registration (via event) and use it's ID);
1149
+	 * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1150
+	 * @return int                Integer representing Check-in status.
1151
+	 * @throws \EE_Error
1152
+	 */
1153 1153
 	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = null ) {
1154 1154
 		$checkin_query_params = array(
1155 1155
 			'order_by' => array( 'CHK_timestamp' => 'DESC' )
@@ -1161,8 +1161,8 @@  discard block
 block discarded – undo
1161 1161
 
1162 1162
 		//get checkin object (if exists)
1163 1163
 		$checkin = $checkin instanceof EE_Checkin
1164
-            ? $checkin
1165
-            : $this->get_first_related( 'Checkin', $checkin_query_params );
1164
+			? $checkin
1165
+			: $this->get_first_related( 'Checkin', $checkin_query_params );
1166 1166
 		if ( $checkin instanceof EE_Checkin ) {
1167 1167
 			if ( $checkin->get( 'CHK_in' ) ) {
1168 1168
 				return EE_Registration::checkin_status_in; //checked in
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
 
1416 1416
 
1417 1417
 
1418
-    /*************************** DEPRECATED ***************************/
1418
+	/*************************** DEPRECATED ***************************/
1419 1419
 
1420 1420
 
1421 1421
 
@@ -1465,24 +1465,24 @@  discard block
 block discarded – undo
1465 1465
 
1466 1466
 
1467 1467
 
1468
-    /**
1469
-     * Gets the primary datetime related to this registration via the related Event to this registration
1470
-     *
1471
-     * @deprecated 4.9.17
1472
-     * @return EE_Datetime
1473
-     */
1474
-    public function get_related_primary_datetime() {
1475
-        EE_Error::doing_it_wrong(
1476
-            __METHOD__,
1477
-            esc_html__(
1478
-                'Use EE_Registration::get_latest_related_datetime() or EE_Registration::get_earliest_related_datetime()',
1479
-                'event_espresso'
1480
-            ),
1481
-            '4.9.17',
1482
-            '5.0.0'
1483
-        );
1484
-        return $this->event()->primary_datetime();
1485
-    }
1468
+	/**
1469
+	 * Gets the primary datetime related to this registration via the related Event to this registration
1470
+	 *
1471
+	 * @deprecated 4.9.17
1472
+	 * @return EE_Datetime
1473
+	 */
1474
+	public function get_related_primary_datetime() {
1475
+		EE_Error::doing_it_wrong(
1476
+			__METHOD__,
1477
+			esc_html__(
1478
+				'Use EE_Registration::get_latest_related_datetime() or EE_Registration::get_earliest_related_datetime()',
1479
+				'event_espresso'
1480
+			),
1481
+			'4.9.17',
1482
+			'5.0.0'
1483
+		);
1484
+		return $this->event()->primary_datetime();
1485
+	}
1486 1486
 
1487 1487
 
1488 1488
 }
Please login to merge, or discard this patch.
Spacing   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\exceptions\EntityNotFoundException;
2 2
 
3
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 /**
7 7
  * EE_Registration class
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	 *                             		    date_format and the second value is the time format
44 44
 	 * @return EE_Registration
45 45
 	 */
46
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
47
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
48
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
46
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
47
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
48
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
49 49
 	}
50 50
 
51 51
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 *                          		the website will be used.
57 57
 	 * @return EE_Registration
58 58
 	 */
59
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
60
-		return new self( $props_n_values, TRUE, $timezone );
59
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
60
+		return new self($props_n_values, TRUE, $timezone);
61 61
 	}
62 62
 
63 63
 
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @param        int $EVT_ID Event ID
69 69
 	 */
70
-	public function set_event( $EVT_ID = 0 ) {
71
-		$this->set( 'EVT_ID', $EVT_ID );
70
+	public function set_event($EVT_ID = 0) {
71
+		$this->set('EVT_ID', $EVT_ID);
72 72
 	}
73 73
 
74 74
 
@@ -79,18 +79,18 @@  discard block
 block discarded – undo
79 79
 	 * @param mixed  $field_value
80 80
 	 * @param bool   $use_default
81 81
 	 */
82
-	public function set( $field_name, $field_value, $use_default = FALSE ) {
83
-		switch( $field_name ) {
82
+	public function set($field_name, $field_value, $use_default = FALSE) {
83
+		switch ($field_name) {
84 84
 			case 'REG_code' :
85
-				if ( ! empty( $field_value ) && $this->reg_code() == '' ) {
86
-					$this->set_reg_code( $field_value, $use_default );
85
+				if ( ! empty($field_value) && $this->reg_code() == '') {
86
+					$this->set_reg_code($field_value, $use_default);
87 87
 				}
88 88
 				break;
89 89
 			case 'STS_ID' :
90
-				$this->set_status( $field_value, $use_default );
90
+				$this->set_status($field_value, $use_default);
91 91
 				break;
92 92
 			default :
93
-				parent::set( $field_name, $field_value, $use_default );
93
+				parent::set($field_name, $field_value, $use_default);
94 94
 		}
95 95
 	}
96 96
 
@@ -107,42 +107,42 @@  discard block
 block discarded – undo
107 107
 	 * @return bool
108 108
 	 * @throws \EE_Error
109 109
 	 */
110
-	public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) {
110
+	public function set_status($new_STS_ID = NULL, $use_default = FALSE) {
111 111
 		// get current REG_Status
112 112
 		$old_STS_ID = $this->status_ID();
113 113
 		// if status has changed
114 114
 		if (
115 115
 			$this->ID() // ensure registration is in the db
116 116
 			&& $old_STS_ID != $new_STS_ID // and that status has actually changed
117
-			&& ! empty( $old_STS_ID ) // and that old status is actually set
118
-			&& ! empty( $new_STS_ID ) // as well as the new status
117
+			&& ! empty($old_STS_ID) // and that old status is actually set
118
+			&& ! empty($new_STS_ID) // as well as the new status
119 119
 		) {
120 120
 			// TO approved
121
-			if ( $new_STS_ID === EEM_Registration::status_id_approved ) {
121
+			if ($new_STS_ID === EEM_Registration::status_id_approved) {
122 122
 				// reserve a space by incrementing ticket and datetime sold values
123 123
 				$this->_reserve_registration_space();
124
-				do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID );
124
+				do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID);
125 125
 			// OR FROM  approved
126
-			} else if ( $old_STS_ID === EEM_Registration::status_id_approved ) {
126
+			} else if ($old_STS_ID === EEM_Registration::status_id_approved) {
127 127
 				// release a space by decrementing ticket and datetime sold values
128 128
 				$this->_release_registration_space();
129
-				do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID );
129
+				do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID);
130 130
 			}
131 131
 			// update status
132
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
132
+			parent::set('STS_ID', $new_STS_ID, $use_default);
133 133
 			/** @type EE_Registration_Processor $registration_processor */
134
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
134
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
135 135
 			/** @type EE_Transaction_Processor $transaction_processor */
136
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
136
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
137 137
 			/** @type EE_Transaction_Payments $transaction_payments */
138
-			$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
138
+			$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
139 139
 			// these reg statuses should not be considered in any calculations involving monies owing
140
-			$closed_reg_statuses = ! empty( $closed_reg_statuses )
140
+			$closed_reg_statuses = ! empty($closed_reg_statuses)
141 141
 				? $closed_reg_statuses
142 142
 				: EEM_Registration::closed_reg_statuses();
143 143
 			if (
144
-				in_array( $new_STS_ID, $closed_reg_statuses )
145
-				&& ! in_array( $old_STS_ID, $closed_reg_statuses )
144
+				in_array($new_STS_ID, $closed_reg_statuses)
145
+				&& ! in_array($old_STS_ID, $closed_reg_statuses)
146 146
 			) {
147 147
 				// cancelled or declined registration
148 148
 				$registration_processor->update_registration_after_being_canceled_or_declined(
@@ -155,24 +155,24 @@  discard block
 block discarded – undo
155 155
 					false
156 156
 				);
157 157
 			} else if (
158
-				in_array( $old_STS_ID, $closed_reg_statuses )
159
-				&& ! in_array( $new_STS_ID, $closed_reg_statuses )
158
+				in_array($old_STS_ID, $closed_reg_statuses)
159
+				&& ! in_array($new_STS_ID, $closed_reg_statuses)
160 160
 			) {
161 161
 				// reinstating cancelled or declined registration
162 162
 				$registration_processor->update_canceled_or_declined_registration_after_being_reinstated(
163 163
 					$this,
164 164
 					$closed_reg_statuses
165 165
 				);
166
-				$transaction_processor->update_transaction_after_reinstating_canceled_registration( $this );
166
+				$transaction_processor->update_transaction_after_reinstating_canceled_registration($this);
167 167
 			}
168
-			$transaction_payments->recalculate_transaction_total( $this->transaction(), false );
169
-			$this->transaction()->update_status_based_on_total_paid( true );
170
-			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
168
+			$transaction_payments->recalculate_transaction_total($this->transaction(), false);
169
+			$this->transaction()->update_status_based_on_total_paid(true);
170
+			do_action('AHEE__EE_Registration__set_status__after_update', $this);
171 171
 			return TRUE;
172 172
 		} else {
173 173
 			//even though the old value matches the new value, it's still good to
174 174
 			//allow the parent set method to have a say
175
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
175
+			parent::set('STS_ID', $new_STS_ID, $use_default);
176 176
 			return TRUE;
177 177
 		}
178 178
 	}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 *        get Status ID
184 184
 	 */
185 185
 	public function status_ID() {
186
-		return $this->get( 'STS_ID' );
186
+		return $this->get('STS_ID');
187 187
 	}
188 188
 
189 189
 
@@ -208,12 +208,12 @@  discard block
 block discarded – undo
208 208
 	 * @param boolean $include_archived whether to include archived tickets or not.
209 209
 	 * @return EE_Ticket
210 210
 	 */
211
-	public function ticket( $include_archived = TRUE ) {
211
+	public function ticket($include_archived = TRUE) {
212 212
 		$query_params = array();
213
-		if ( $include_archived ) {
214
-			$query_params[ 'default_where_conditions' ] = 'none';
213
+		if ($include_archived) {
214
+			$query_params['default_where_conditions'] = 'none';
215 215
 		}
216
-		return $this->get_first_related( 'Ticket', $query_params );
216
+		return $this->get_first_related('Ticket', $query_params);
217 217
 	}
218 218
 
219 219
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public function wp_user() {
243 243
 		$event = $this->event();
244
-		if ( $event instanceof EE_Event ) {
244
+		if ($event instanceof EE_Event) {
245 245
 			return $event->wp_user();
246 246
 		}
247 247
 		return 0;
@@ -266,8 +266,8 @@  discard block
 block discarded – undo
266 266
 	 *
267 267
 	 * @param        int $ATT_ID Attendee ID
268 268
 	 */
269
-	public function set_attendee_id( $ATT_ID = 0 ) {
270
-		$this->set( 'ATT_ID', $ATT_ID );
269
+	public function set_attendee_id($ATT_ID = 0) {
270
+		$this->set('ATT_ID', $ATT_ID);
271 271
 	}
272 272
 
273 273
 
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 	 *
278 278
 	 * @param        int $TXN_ID Transaction ID
279 279
 	 */
280
-	public function set_transaction_id( $TXN_ID = 0 ) {
281
-		$this->set( 'TXN_ID', $TXN_ID );
280
+	public function set_transaction_id($TXN_ID = 0) {
281
+		$this->set('TXN_ID', $TXN_ID);
282 282
 	}
283 283
 
284 284
 
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 	 *
289 289
 	 * @param    string $REG_session PHP Session ID
290 290
 	 */
291
-	public function set_session( $REG_session = '' ) {
292
-		$this->set( 'REG_session', $REG_session );
291
+	public function set_session($REG_session = '') {
292
+		$this->set('REG_session', $REG_session);
293 293
 	}
294 294
 
295 295
 
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @param    string $REG_url_link Registration URL Link
301 301
 	 */
302
-	public function set_reg_url_link( $REG_url_link = '' ) {
303
-		$this->set( 'REG_url_link', $REG_url_link );
302
+	public function set_reg_url_link($REG_url_link = '') {
303
+		$this->set('REG_url_link', $REG_url_link);
304 304
 	}
305 305
 
306 306
 
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
 	 *
311 311
 	 * @param        int $REG_count Primary Attendee
312 312
 	 */
313
-	public function set_count( $REG_count = 1 ) {
314
-		$this->set( 'REG_count', $REG_count );
313
+	public function set_count($REG_count = 1) {
314
+		$this->set('REG_count', $REG_count);
315 315
 	}
316 316
 
317 317
 
@@ -321,8 +321,8 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @param        boolean $REG_group_size Group Registration
323 323
 	 */
324
-	public function set_group_size( $REG_group_size = FALSE ) {
325
-		$this->set( 'REG_group_size', $REG_group_size );
324
+	public function set_group_size($REG_group_size = FALSE) {
325
+		$this->set('REG_group_size', $REG_group_size);
326 326
 	}
327 327
 
328 328
 
@@ -398,8 +398,8 @@  discard block
 block discarded – undo
398 398
 	 *
399 399
 	 * @param        mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date
400 400
 	 */
401
-	public function set_reg_date( $REG_date = FALSE ) {
402
-		$this->set( 'REG_date', $REG_date );
401
+	public function set_reg_date($REG_date = FALSE) {
402
+		$this->set('REG_date', $REG_date);
403 403
 	}
404 404
 
405 405
 
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
 	 * @access    public
411 411
 	 * @param    float $REG_final_price
412 412
 	 */
413
-	public function set_final_price( $REG_final_price = 0.00 ) {
414
-		$this->set( 'REG_final_price', $REG_final_price );
413
+	public function set_final_price($REG_final_price = 0.00) {
414
+		$this->set('REG_final_price', $REG_final_price);
415 415
 	}
416 416
 
417 417
 
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
 	 * @access    public
423 423
 	 * @param    float $REG_paid
424 424
 	 */
425
-	public function set_paid( $REG_paid = 0.00 ) {
426
-		$this->set( 'REG_paid', $REG_paid );
425
+	public function set_paid($REG_paid = 0.00) {
426
+		$this->set('REG_paid', $REG_paid);
427 427
 	}
428 428
 
429 429
 
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 	 *
434 434
 	 * @param        boolean $REG_att_is_going Attendee Is Going
435 435
 	 */
436
-	public function set_att_is_going( $REG_att_is_going = FALSE ) {
437
-		$this->set( 'REG_att_is_going', $REG_att_is_going );
436
+	public function set_att_is_going($REG_att_is_going = FALSE) {
437
+		$this->set('REG_att_is_going', $REG_att_is_going);
438 438
 	}
439 439
 
440 440
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 * @return EE_Attendee
445 445
 	 */
446 446
 	public function attendee() {
447
-		return $this->get_first_related( 'Attendee' );
447
+		return $this->get_first_related('Attendee');
448 448
 	}
449 449
 
450 450
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 *        get Event ID
454 454
 	 */
455 455
 	public function event_ID() {
456
-		return $this->get( 'EVT_ID' );
456
+		return $this->get('EVT_ID');
457 457
 	}
458 458
 
459 459
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 	 */
464 464
 	public function event_name() {
465 465
 		$event = $this->event_obj();
466
-		if ( $event ) {
466
+		if ($event) {
467 467
 			return $event->name();
468 468
 		} else {
469 469
 			return NULL;
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @return EE_Event
478 478
 	 */
479 479
 	public function event_obj() {
480
-		return $this->get_first_related( 'Event' );
480
+		return $this->get_first_related('Event');
481 481
 	}
482 482
 
483 483
 
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 	 *        get Attendee ID
487 487
 	 */
488 488
 	public function attendee_ID() {
489
-		return $this->get( 'ATT_ID' );
489
+		return $this->get('ATT_ID');
490 490
 	}
491 491
 
492 492
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 *        get PHP Session ID
496 496
 	 */
497 497
 	public function session_ID() {
498
-		return $this->get( 'REG_session' );
498
+		return $this->get('REG_session');
499 499
 	}
500 500
 
501 501
 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
506 506
 	 * @return string
507 507
 	 */
508
-	public function receipt_url( $messenger = 'html' ) {
508
+	public function receipt_url($messenger = 'html') {
509 509
 
510 510
 		/**
511 511
 		 * The below will be deprecated one version after this.  We check first if there is a custom receipt template already in use on old system.  If there is then we just return the standard url for it.
@@ -513,12 +513,12 @@  discard block
 block discarded – undo
513 513
 		 * @since 4.5.0
514 514
 		 */
515 515
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php';
516
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
516
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
517 517
 
518
-		if ( $has_custom ) {
519
-			return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) );
518
+		if ($has_custom) {
519
+			return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch'));
520 520
 		}
521
-		return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' );
521
+		return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt');
522 522
 	}
523 523
 
524 524
 
@@ -529,28 +529,28 @@  discard block
 block discarded – undo
529 529
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
530 530
 	 * @return string
531 531
 	 */
532
-	public function invoice_url( $messenger = 'html' ) {
532
+	public function invoice_url($messenger = 'html') {
533 533
 		/**
534 534
 		 * The below will be deprecated one version after this.  We check first if there is a custom invoice template already in use on old system.  If there is then we just return the standard url for it.
535 535
 		 *
536 536
 		 * @since 4.5.0
537 537
 		 */
538 538
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php';
539
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
539
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
540 540
 
541
-		if ( $has_custom ) {
542
-			if ( $messenger == 'html' ) {
543
-				return $this->invoice_url( 'launch' );
541
+		if ($has_custom) {
542
+			if ($messenger == 'html') {
543
+				return $this->invoice_url('launch');
544 544
 			}
545 545
 			$route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice';
546 546
 
547
-			$query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() );
548
-			if ( $messenger == 'html' ) {
547
+			$query_args = array('ee' => $route, 'id' => $this->reg_url_link());
548
+			if ($messenger == 'html') {
549 549
 				$query_args['html'] = TRUE;
550 550
 			}
551
-			return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) );
551
+			return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
552 552
 		}
553
-		return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' );
553
+		return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice');
554 554
 	}
555 555
 
556 556
 
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	 * @throws \EE_Error
564 564
 	 */
565 565
 	public function reg_url_link() {
566
-		return (string)$this->get( 'REG_url_link' );
566
+		return (string) $this->get('REG_url_link');
567 567
 	}
568 568
 
569 569
 
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 	 * @param string $type 'download','launch', or 'html' (default is 'launch')
574 574
 	 * @return void
575 575
 	 */
576
-	public function e_invoice_url( $type = 'launch' ) {
577
-		echo $this->invoice_url( $type );
576
+	public function e_invoice_url($type = 'launch') {
577
+		echo $this->invoice_url($type);
578 578
 	}
579 579
 
580 580
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 	 * @return string
595 595
 	 */
596 596
 	public function payment_overview_url() {
597
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
597
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
598 598
 	}
599 599
 
600 600
 
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 	 * @return string
606 606
 	 */
607 607
 	public function edit_attendee_information_url() {
608
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
608
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
609 609
 	}
610 610
 
611 611
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 * @return string
616 616
 	 */
617 617
 	public function get_admin_edit_url() {
618
-		return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) );
618
+		return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php'));
619 619
 	}
620 620
 
621 621
 
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 	 *    is_primary_registrant?
625 625
 	 */
626 626
 	public function is_primary_registrant() {
627
-		return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE;
627
+		return $this->get('REG_count') == 1 ? TRUE : FALSE;
628 628
 	}
629 629
 
630 630
 
@@ -633,12 +633,12 @@  discard block
 block discarded – undo
633 633
 	 * This returns the primary registration object for this registration group (which may be this object).
634 634
 	 * @return EE_Registration
635 635
 	 */
636
-	public function get_primary_registration()  {
637
-		if ( $this->is_primary_registrant() )
636
+	public function get_primary_registration() {
637
+		if ($this->is_primary_registrant())
638 638
 			return $this;
639 639
 
640 640
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
641
-		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
641
+		$primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1)));
642 642
 		return $primary_registrant;
643 643
 	}
644 644
 
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 	* 		@access		public
650 650
 	*/
651 651
 	public function count() {
652
-		return $this->get( 'REG_count' );
652
+		return $this->get('REG_count');
653 653
 	}
654 654
 
655 655
 
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 	 *        get Group Size
659 659
 	 */
660 660
 	public function group_size() {
661
-		return $this->get( 'REG_group_size' );
661
+		return $this->get('REG_group_size');
662 662
 	}
663 663
 
664 664
 
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 	 *        get Registration Date
668 668
 	 */
669 669
 	public function date() {
670
-		return $this->get( 'REG_date' );
670
+		return $this->get('REG_date');
671 671
 	}
672 672
 
673 673
 
@@ -678,8 +678,8 @@  discard block
 block discarded – undo
678 678
 	 * @param string $time_format
679 679
 	 * @return string
680 680
 	 */
681
-	public function pretty_date( $date_format = NULL, $time_format = NULL ) {
682
-		return $this->get_datetime( 'REG_date', $date_format, $time_format );
681
+	public function pretty_date($date_format = NULL, $time_format = NULL) {
682
+		return $this->get_datetime('REG_date', $date_format, $time_format);
683 683
 	}
684 684
 
685 685
 
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	 * @return    float
692 692
 	 */
693 693
 	public function final_price() {
694
-		return $this->get( 'REG_final_price' );
694
+		return $this->get('REG_final_price');
695 695
 	}
696 696
 
697 697
 
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	 * @return string
703 703
 	 */
704 704
 	public function pretty_final_price() {
705
-		return $this->get_pretty( 'REG_final_price' );
705
+		return $this->get_pretty('REG_final_price');
706 706
 	}
707 707
 
708 708
 
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 	 * @return 	float
713 713
 	 */
714 714
 	public function paid() {
715
-		return $this->get( 'REG_paid' );
715
+		return $this->get('REG_paid');
716 716
 	}
717 717
 
718 718
 
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 	 * @return 	float
723 723
 	 */
724 724
 	public function pretty_paid() {
725
-		return $this->get_pretty( 'REG_paid' );
725
+		return $this->get_pretty('REG_paid');
726 726
 	}
727 727
 
728 728
 
@@ -733,11 +733,11 @@  discard block
 block discarded – undo
733 733
 	 * @param array $requires_payment
734 734
 	 * @return bool
735 735
 	 */
736
-	public function owes_monies_and_can_pay( $requires_payment = array()) {
736
+	public function owes_monies_and_can_pay($requires_payment = array()) {
737 737
 		// these reg statuses require payment (if event is not free)
738
-		$requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
738
+		$requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
739 739
 		if (
740
-			in_array( $this->status_ID(), $requires_payment ) &&
740
+			in_array($this->status_ID(), $requires_payment) &&
741 741
 			$this->final_price() != 0 &&
742 742
 			$this->final_price() != $this->paid()
743 743
 		) {
@@ -754,8 +754,8 @@  discard block
 block discarded – undo
754 754
 	 * @param bool $show_icons
755 755
 	 * @return void
756 756
 	 */
757
-	public function e_pretty_status( $show_icons = FALSE ) {
758
-		echo $this->pretty_status( $show_icons );
757
+	public function e_pretty_status($show_icons = FALSE) {
758
+		echo $this->pretty_status($show_icons);
759 759
 	}
760 760
 
761 761
 
@@ -766,10 +766,10 @@  discard block
 block discarded – undo
766 766
 	 * @param bool $show_icons
767 767
 	 * @return string
768 768
 	 */
769
-	public function pretty_status( $show_icons = FALSE ) {
770
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
769
+	public function pretty_status($show_icons = FALSE) {
770
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
771 771
 		$icon = '';
772
-		switch ( $this->status_ID() ) {
772
+		switch ($this->status_ID()) {
773 773
 			case EEM_Registration::status_id_approved:
774 774
 				$icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : '';
775 775
 				break;
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 				$icon = $show_icons ? '<span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>' : '';
793 793
 				break;
794 794
 		}
795
-		return $icon . $status[ $this->status_ID() ];
795
+		return $icon.$status[$this->status_ID()];
796 796
 	}
797 797
 
798 798
 
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	 *        get Attendee Is Going
802 802
 	 */
803 803
 	public function att_is_going() {
804
-		return $this->get( 'REG_att_is_going' );
804
+		return $this->get('REG_att_is_going');
805 805
 	}
806 806
 
807 807
 
@@ -811,8 +811,8 @@  discard block
 block discarded – undo
811 811
 	 * @param array $query_params like EEM_Base::get_all
812 812
 	 * @return EE_Answer[]
813 813
 	 */
814
-	public function answers( $query_params = NULL ) {
815
-		return $this->get_many_related( 'Answer', $query_params );
814
+	public function answers($query_params = NULL) {
815
+		return $this->get_many_related('Answer', $query_params);
816 816
 	}
817 817
 
818 818
 
@@ -826,9 +826,9 @@  discard block
 block discarded – undo
826 826
 	 * (because the answer might be an array of answer values, so passing pretty_value=true
827 827
 	 * will convert it into some kind of string)
828 828
 	 */
829
-	public function answer_value_to_question( $question, $pretty_value=true ) {
829
+	public function answer_value_to_question($question, $pretty_value = true) {
830 830
 		$question_id = EEM_Question::instance()->ensure_is_ID($question);
831
-		return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value);
831
+		return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value);
832 832
 	}
833 833
 
834 834
 
@@ -841,13 +841,13 @@  discard block
 block discarded – undo
841 841
 	 */
842 842
 	public function question_groups() {
843 843
 		$question_groups = array();
844
-		if ( $this->event() instanceof EE_Event ) {
844
+		if ($this->event() instanceof EE_Event) {
845 845
 			$question_groups = $this->event()->question_groups(
846 846
 				array(
847 847
 					array(
848 848
 						'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false
849 849
 					),
850
-					'order_by' => array( 'QSG_order' => 'ASC' )
850
+					'order_by' => array('QSG_order' => 'ASC')
851 851
 				)
852 852
 			);
853 853
 		}
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 	 */
865 865
 	public function count_question_groups() {
866 866
 		$qg_count = 0;
867
-		if ( $this->event() instanceof EE_Event ) {
867
+		if ($this->event() instanceof EE_Event) {
868 868
 			$qg_count = $this->event()->count_related(
869 869
 				'Question_Group',
870 870
 				array(
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 	 * @return string
886 886
 	 */
887 887
 	public function reg_date() {
888
-		return $this->get_datetime( 'REG_date' );
888
+		return $this->get_datetime('REG_date');
889 889
 	}
890 890
 
891 891
 
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 	 * @return EE_Datetime_Ticket
898 898
 	 */
899 899
 	public function datetime_ticket() {
900
-		return $this->get_first_related( 'Datetime_Ticket' );
900
+		return $this->get_first_related('Datetime_Ticket');
901 901
 	}
902 902
 
903 903
 
@@ -907,15 +907,15 @@  discard block
 block discarded – undo
907 907
 	 * @param EE_Datetime_Ticket $datetime_ticket
908 908
 	 * @return EE_Datetime_Ticket
909 909
 	 */
910
-	public function set_datetime_ticket( $datetime_ticket ) {
911
-		return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' );
910
+	public function set_datetime_ticket($datetime_ticket) {
911
+		return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket');
912 912
 	}
913 913
 	/**
914 914
 	 * Gets deleted
915 915
 	 * @return boolean
916 916
 	 */
917 917
 	public function deleted() {
918
-		return $this->get( 'REG_deleted' );
918
+		return $this->get('REG_deleted');
919 919
 	}
920 920
 
921 921
 	/**
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 	 * @return boolean
925 925
 	 */
926 926
 	public function set_deleted($deleted) {
927
-		$this->set( 'REG_deleted', $deleted );
927
+		$this->set('REG_deleted', $deleted);
928 928
 	}
929 929
 
930 930
 
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
 	 * @return EE_Status
935 935
 	 */
936 936
 	public function status_obj() {
937
-		return $this->get_first_related( 'Status' );
937
+		return $this->get_first_related('Status');
938 938
 	}
939 939
 
940 940
 
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 	 * @return int
946 946
 	 */
947 947
 	public function count_checkins() {
948
-		return $this->get_model()->count_related( $this, 'Checkin' );
948
+		return $this->get_model()->count_related($this, 'Checkin');
949 949
 	}
950 950
 
951 951
 
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
 	 * @return int
956 956
 	 */
957 957
 	public function count_checkins_not_checkedout() {
958
-		return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) );
958
+		return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1)));
959 959
 	}
960 960
 
961 961
 
@@ -968,20 +968,20 @@  discard block
 block discarded – undo
968 968
 	 *
969 969
 	 * @return bool
970 970
 	 */
971
-	public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) {
972
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
971
+	public function can_checkin($DTT_OR_ID, $check_approved = TRUE) {
972
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
973 973
 
974 974
 		//first check registration status
975
-		if (  ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) {
975
+		if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) {
976 976
 			return false;
977 977
 		}
978 978
 		//is there a datetime ticket that matches this dtt_ID?
979
-		if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) {
979
+		if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) {
980 980
 			return false;
981 981
 		}
982 982
 
983 983
 		//final check is against TKT_uses
984
-		return $this->verify_can_checkin_against_TKT_uses( $DTT_ID );
984
+		return $this->verify_can_checkin_against_TKT_uses($DTT_ID);
985 985
 	}
986 986
 
987 987
 
@@ -994,10 +994,10 @@  discard block
 block discarded – undo
994 994
 	 * @param int | EE_Datetime  $DTT_OR_ID  The datetime the registration is being checked against
995 995
 	 * @return bool   true means can checkin.  false means cannot checkin.
996 996
 	 */
997
-	public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) {
998
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
997
+	public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) {
998
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
999 999
 
1000
-		if ( ! $DTT_ID ) {
1000
+		if ( ! $DTT_ID) {
1001 1001
 			return false;
1002 1002
 		}
1003 1003
 
@@ -1005,23 +1005,23 @@  discard block
 block discarded – undo
1005 1005
 
1006 1006
 		// if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in
1007 1007
 		// or not.
1008
-		if ( ! $max_uses || $max_uses === EE_INF ) {
1008
+		if ( ! $max_uses || $max_uses === EE_INF) {
1009 1009
 			return true;
1010 1010
 		}
1011 1011
 
1012 1012
 		//does this datetime have a checkin record?  If so, then the dtt count has already been verified so we can just
1013 1013
 		//go ahead and toggle.
1014
-		if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) {
1014
+		if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) {
1015 1015
 			return true;
1016 1016
 		}
1017 1017
 
1018 1018
 		//made it here so the last check is whether the number of checkins per unique datetime on this registration
1019 1019
 		//disallows further check-ins.
1020
-		$count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true );
1020
+		$count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true);
1021 1021
 		// checkins have already reached their max number of uses
1022 1022
 		// so registrant can NOT checkin
1023
-		if ( $count_unique_dtt_checkins >= $max_uses ) {
1024
-			EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1023
+		if ($count_unique_dtt_checkins >= $max_uses) {
1024
+			EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1025 1025
 			return false;
1026 1026
 		}
1027 1027
 		return true;
@@ -1043,15 +1043,15 @@  discard block
 block discarded – undo
1043 1043
      * @return bool|int     the chk_in status toggled to OR false if nothing got changed.
1044 1044
      * @throws EE_Error
1045 1045
      */
1046
-	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
1047
-		if ( empty( $DTT_ID ) ) {
1046
+	public function toggle_checkin_status($DTT_ID = null, $verify = false) {
1047
+		if (empty($DTT_ID)) {
1048 1048
 			$datetime = $this->get_latest_related_datetime();
1049 1049
 			$DTT_ID = $datetime instanceof EE_Datetime ? $datetime->ID() : 0;
1050 1050
 		// verify the registration can checkin for the given DTT_ID
1051
-		} elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) {
1051
+		} elseif ( ! $this->can_checkin($DTT_ID, $verify)) {
1052 1052
 			EE_Error::add_error(
1053 1053
 					sprintf(
1054
-						__( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1054
+						__('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1055 1055
 						$this->ID(),
1056 1056
 						$DTT_ID
1057 1057
 					),
@@ -1065,8 +1065,8 @@  discard block
 block discarded – undo
1065 1065
 			EE_Registration::checkin_status_out => EE_Registration::checkin_status_in
1066 1066
 		);
1067 1067
 		//start by getting the current status so we know what status we'll be changing to.
1068
-		$cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL );
1069
-		$status_to = $status_paths[ $cur_status ];
1068
+		$cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL);
1069
+		$status_to = $status_paths[$cur_status];
1070 1070
 		// database only records true for checked IN or false for checked OUT
1071 1071
 		// no record ( null ) means checked in NEVER, but we obviously don't save that
1072 1072
 		$new_status = $status_to === EE_Registration::checkin_status_in ? true : false;
@@ -1074,24 +1074,24 @@  discard block
 block discarded – undo
1074 1074
 		// because we are keeping track of Check-ins over time.
1075 1075
 		// Eventually we'll probably want to show a list table
1076 1076
 		// for the individual Check-ins so that they can be managed.
1077
-		$checkin = EE_Checkin::new_instance( array(
1077
+		$checkin = EE_Checkin::new_instance(array(
1078 1078
 				'REG_ID' => $this->ID(),
1079 1079
 				'DTT_ID' => $DTT_ID,
1080 1080
 				'CHK_in' => $new_status
1081
-		) );
1081
+		));
1082 1082
 		// if the record could not be saved then return false
1083
-		if ( $checkin->save() === 0 ) {
1084
-			if ( WP_DEBUG ) {
1083
+		if ($checkin->save() === 0) {
1084
+			if (WP_DEBUG) {
1085 1085
 				global $wpdb;
1086 1086
 				$error = sprintf(
1087
-					__( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ),
1087
+					__('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'),
1088 1088
 					'<br />',
1089 1089
 					$wpdb->last_error
1090 1090
 				);
1091 1091
 			} else {
1092
-				$error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' );
1092
+				$error = __('Registration check in update failed because of an unknown database error', 'event_espresso');
1093 1093
 			}
1094
-			EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
1094
+			EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
1095 1095
 			return false;
1096 1096
 		}
1097 1097
 		return $status_to;
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 				array(
1113 1113
 					'Ticket.Registration.REG_ID' => $this->ID()
1114 1114
 				),
1115
-				'order_by' => array( 'DTT_EVT_start' => 'DESC' )
1115
+				'order_by' => array('DTT_EVT_start' => 'DESC')
1116 1116
 			)
1117 1117
 		);
1118 1118
 	}
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
 				array(
1132 1132
 					'Ticket.Registration.REG_ID' => $this->ID()
1133 1133
 				),
1134
-				'order_by' => array( 'DTT_EVT_start' => 'ASC' )
1134
+				'order_by' => array('DTT_EVT_start' => 'ASC')
1135 1135
 			)
1136 1136
 		);
1137 1137
 	}
@@ -1150,21 +1150,21 @@  discard block
 block discarded – undo
1150 1150
      * @return int                Integer representing Check-in status.
1151 1151
      * @throws \EE_Error
1152 1152
      */
1153
-	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = null ) {
1153
+	public function check_in_status_for_datetime($DTT_ID = 0, $checkin = null) {
1154 1154
 		$checkin_query_params = array(
1155
-			'order_by' => array( 'CHK_timestamp' => 'DESC' )
1155
+			'order_by' => array('CHK_timestamp' => 'DESC')
1156 1156
 		);
1157 1157
 
1158
-		if ( $DTT_ID > 0 ) {
1159
-			$checkin_query_params[0] = array( 'DTT_ID' => $DTT_ID );
1158
+		if ($DTT_ID > 0) {
1159
+			$checkin_query_params[0] = array('DTT_ID' => $DTT_ID);
1160 1160
 		}
1161 1161
 
1162 1162
 		//get checkin object (if exists)
1163 1163
 		$checkin = $checkin instanceof EE_Checkin
1164 1164
             ? $checkin
1165
-            : $this->get_first_related( 'Checkin', $checkin_query_params );
1166
-		if ( $checkin instanceof EE_Checkin ) {
1167
-			if ( $checkin->get( 'CHK_in' ) ) {
1165
+            : $this->get_first_related('Checkin', $checkin_query_params);
1166
+		if ($checkin instanceof EE_Checkin) {
1167
+			if ($checkin->get('CHK_in')) {
1168 1168
 				return EE_Registration::checkin_status_in; //checked in
1169 1169
 			}
1170 1170
 			return EE_Registration::checkin_status_out; //had checked in but is now checked out.
@@ -1180,28 +1180,28 @@  discard block
 block discarded – undo
1180 1180
 	 * @param bool $error  This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name.
1181 1181
 	 * @return string         internationalized message
1182 1182
 	 */
1183
-	public function get_checkin_msg( $DTT_ID, $error = FALSE ) {
1183
+	public function get_checkin_msg($DTT_ID, $error = FALSE) {
1184 1184
 		//let's get the attendee first so we can include the name of the attendee
1185
-		$attendee = $this->get_first_related( 'Attendee' );
1186
-		if ( $attendee instanceof EE_Attendee ) {
1187
-			if ( $error ) {
1188
-				return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() );
1185
+		$attendee = $this->get_first_related('Attendee');
1186
+		if ($attendee instanceof EE_Attendee) {
1187
+			if ($error) {
1188
+				return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name());
1189 1189
 			}
1190
-			$cur_status = $this->check_in_status_for_datetime( $DTT_ID );
1190
+			$cur_status = $this->check_in_status_for_datetime($DTT_ID);
1191 1191
 			//what is the status message going to be?
1192
-			switch ( $cur_status ) {
1192
+			switch ($cur_status) {
1193 1193
 				case EE_Registration::checkin_status_never :
1194
-					return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() );
1194
+					return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name());
1195 1195
 					break;
1196 1196
 				case EE_Registration::checkin_status_in :
1197
-					return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() );
1197
+					return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name());
1198 1198
 					break;
1199 1199
 				case EE_Registration::checkin_status_out :
1200
-					return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() );
1200
+					return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name());
1201 1201
 					break;
1202 1202
 			}
1203 1203
 		}
1204
-		return __( "The check-in status could not be determined.", "event_espresso" );
1204
+		return __("The check-in status could not be determined.", "event_espresso");
1205 1205
 	}
1206 1206
 
1207 1207
 
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
 	 *        get Registration Code
1226 1226
 	 */
1227 1227
 	public function reg_code() {
1228
-		return $this->get( 'REG_code' );
1228
+		return $this->get('REG_code');
1229 1229
 	}
1230 1230
 
1231 1231
 
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
 	 *        get Transaction ID
1235 1235
 	 */
1236 1236
 	public function transaction_ID() {
1237
-		return $this->get( 'TXN_ID' );
1237
+		return $this->get('TXN_ID');
1238 1238
 	}
1239 1239
 
1240 1240
 
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
 	 * @return int
1244 1244
 	 */
1245 1245
 	public function ticket_ID() {
1246
-		return $this->get( 'TKT_ID' );
1246
+		return $this->get('TKT_ID');
1247 1247
 	}
1248 1248
 
1249 1249
 
@@ -1255,17 +1255,17 @@  discard block
 block discarded – undo
1255 1255
 	 * @param    string $REG_code Registration Code
1256 1256
 	 * @param	boolean $use_default
1257 1257
 	 */
1258
-	public function set_reg_code( $REG_code, $use_default = FALSE ) {
1259
-		if ( empty( $REG_code )) {
1260
-			EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1258
+	public function set_reg_code($REG_code, $use_default = FALSE) {
1259
+		if (empty($REG_code)) {
1260
+			EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1261 1261
 			return;
1262 1262
 		}
1263
-		if ( ! $this->reg_code() ) {
1264
-			parent::set( 'REG_code', $REG_code, $use_default );
1263
+		if ( ! $this->reg_code()) {
1264
+			parent::set('REG_code', $REG_code, $use_default);
1265 1265
 		} else {
1266 1266
 			EE_Error::doing_it_wrong(
1267
-				__CLASS__ . '::' . __FUNCTION__,
1268
-				__( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ),
1267
+				__CLASS__.'::'.__FUNCTION__,
1268
+				__('Can not change a registration REG_code once it has been set.', 'event_espresso'),
1269 1269
 				'4.6.0'
1270 1270
 			);
1271 1271
 		}
@@ -1285,17 +1285,17 @@  discard block
 block discarded – undo
1285 1285
 	 * @return EE_Registration[]  or empty array if this isn't a group registration.
1286 1286
 	 */
1287 1287
 	public function get_all_other_registrations_in_group() {
1288
-		if ( $this->group_size() < 2 ) {
1288
+		if ($this->group_size() < 2) {
1289 1289
 			return array();
1290 1290
 		}
1291 1291
 
1292 1292
 		$query[0] = array(
1293 1293
 			'TXN_ID' => $this->transaction_ID(),
1294
-			'REG_ID' => array( '!=', $this->ID() ),
1294
+			'REG_ID' => array('!=', $this->ID()),
1295 1295
 			'TKT_ID' => $this->ticket_ID()
1296 1296
 			);
1297 1297
 
1298
-		$registrations = $this->get_model()->get_all( $query );
1298
+		$registrations = $this->get_model()->get_all($query);
1299 1299
 		return $registrations;
1300 1300
 	}
1301 1301
 
@@ -1304,14 +1304,14 @@  discard block
 block discarded – undo
1304 1304
 	 * @return string
1305 1305
 	 */
1306 1306
 	public function get_admin_details_link() {
1307
-		EE_Registry::instance()->load_helper( 'URL' );
1307
+		EE_Registry::instance()->load_helper('URL');
1308 1308
 		return EEH_URL::add_query_args_and_nonce(
1309 1309
 			array(
1310 1310
 				'page' => 'espresso_registrations',
1311 1311
 				'action' => 'view_registration',
1312 1312
 				'_REG_ID' => $this->ID()
1313 1313
 			),
1314
-			admin_url( 'admin.php' )
1314
+			admin_url('admin.php')
1315 1315
 		);
1316 1316
 	}
1317 1317
 
@@ -1336,12 +1336,12 @@  discard block
 block discarded – undo
1336 1336
 	 * @return string
1337 1337
 	 */
1338 1338
 	public function get_admin_overview_link() {
1339
-		EE_Registry::instance()->load_helper( 'URL' );
1339
+		EE_Registry::instance()->load_helper('URL');
1340 1340
 		return EEH_URL::add_query_args_and_nonce(
1341 1341
 			array(
1342 1342
 				'page' => 'espresso_registrations'
1343 1343
 			),
1344
-			admin_url( 'admin.php' )
1344
+			admin_url('admin.php')
1345 1345
 		);
1346 1346
 	}
1347 1347
 
@@ -1352,8 +1352,8 @@  discard block
 block discarded – undo
1352 1352
 	 * @return \EE_Registration[]
1353 1353
 	 * @throws \EE_Error
1354 1354
 	 */
1355
-	public function payments( $query_params = array() ) {
1356
-		return $this->get_many_related( 'Payment', $query_params );
1355
+	public function payments($query_params = array()) {
1356
+		return $this->get_many_related('Payment', $query_params);
1357 1357
 	}
1358 1358
 
1359 1359
 
@@ -1363,8 +1363,8 @@  discard block
 block discarded – undo
1363 1363
 	 * @return \EE_Registration_Payment[]
1364 1364
 	 * @throws \EE_Error
1365 1365
 	 */
1366
-	public function registration_payments( $query_params = array() ) {
1367
-		return $this->get_many_related( 'Registration_Payment', $query_params );
1366
+	public function registration_payments($query_params = array()) {
1367
+		return $this->get_many_related('Registration_Payment', $query_params);
1368 1368
 	}
1369 1369
 
1370 1370
 
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
 	 * @return EE_Payment_Method|null
1378 1378
 	 */
1379 1379
 	public function payment_method() {
1380
-		return EEM_Payment_Method::instance()->get_last_used_for_registration( $this );
1380
+		return EEM_Payment_Method::instance()->get_last_used_for_registration($this);
1381 1381
 	}
1382 1382
 
1383 1383
 
Please login to merge, or discard this patch.
core/helpers/EEH_Tabbed_Content.helper.php 2 patches
Spacing   +36 added lines, -36 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
 /**
@@ -46,22 +46,22 @@  discard block
 block discarded – undo
46 46
 	 * @return string the assembled html string containing the tabbed content for display.
47 47
 	 * @throws \EE_Error
48 48
 	 */
49
-	public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE ) {
49
+	public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE) {
50 50
 
51 51
 		//first check if $tabs_names is not empty then the count must match the count of $tabs_content otherwise we've got a problem houston
52
-		if ( !empty( $tabs_names) && ( count( (array) $tabs_names) != count( (array) $tabs_content) ) ) {
53
-			throw new EE_Error( __('The count for $tabs_names and $tabs_content does not match.', 'event_espresso') );
52
+		if ( ! empty($tabs_names) && (count((array) $tabs_names) != count((array) $tabs_content))) {
53
+			throw new EE_Error(__('The count for $tabs_names and $tabs_content does not match.', 'event_espresso'));
54 54
 		}
55 55
 
56 56
 		//make sure we've got incoming data setup properly
57
-		$tabs = !empty( $tabs_names ) ? (array) $tabs_names : array_keys( (array) $tabs_contents );
58
-		$tabs_content = !empty( $tabs_names ) ? array_combine( (array) $tabs_names, (array) $tabs_content ) : $tabs_contents;
57
+		$tabs = ! empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents);
58
+		$tabs_content = ! empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents;
59 59
 
60
-		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
60
+		$all_tabs = '<h2 class="nav-tab-wrapper">'."\n";
61 61
 		$all_tabs_content = '';
62 62
 
63 63
 		$index = 0;
64
-		foreach ( $tabs as $tab ) {
64
+		foreach ($tabs as $tab) {
65 65
 			$active = $index === 0 ? true : false;
66 66
 			$all_tabs .= self::tab($tab, $active);
67 67
 			$all_tabs_content .= self::tab_content($tab, $tabs_content[$tab], $active);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 		$tab_container_class = $small_tabs ? 'ee-nav-tabs ee-nav-tabs-small' : 'ee-nav-tabs';
80 80
 
81
-		return '<div class="'. $tab_container_class . '">' . "\n\t" . $all_tabs . $all_tabs_content . "\n" . '</div>';
81
+		return '<div class="'.$tab_container_class.'">'."\n\t".$all_tabs.$all_tabs_content."\n".'</div>';
82 82
 	}
83 83
 
84 84
 
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 	 * @throws \EE_Error
103 103
 	 */
104 104
 	public static function display_admin_nav_tabs($nav_tabs = array()) {
105
-		if ( empty($nav_tabs) )
106
-			throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
105
+		if (empty($nav_tabs))
106
+			throw new EE_Error(__('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso'));
107 107
 
108
-		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
109
-		foreach ( $nav_tabs as $slug => $tab ) {
108
+		$all_tabs = '<h2 class="nav-tab-wrapper">'."\n";
109
+		foreach ($nav_tabs as $slug => $tab) {
110 110
 			$all_tabs .= self::tab($slug, false, $tab['link_text'], $tab['url'], $tab['css_class']);
111 111
 		}
112 112
 		$all_tabs .= '</h2>';
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
 	 * @param bool|string $css If string given then the generated tab will include that as the class.
123 123
 	 * @return string          html for tab
124 124
 	 */
125
-	private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE ) {
125
+	private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE) {
126 126
 		$name = str_replace(' ', '-', $name);
127 127
 		$class = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
128
-		$class = $css ? $class . ' ' . $css : $class;
129
-		$nice_name = $nice_name ? $nice_name : ucwords( preg_replace('/(-|_)/', ' ', $name) );
130
-		$url = $url ? $url : '#' . $name;
131
-		$tab = '<a class="' . $class . '" rel="ee-tab-' . $name . '" href="' . $url . '">' . $nice_name . '</a>' . "\n\t";
128
+		$class = $css ? $class.' '.$css : $class;
129
+		$nice_name = $nice_name ? $nice_name : ucwords(preg_replace('/(-|_)/', ' ', $name));
130
+		$url = $url ? $url : '#'.$name;
131
+		$tab = '<a class="'.$class.'" rel="ee-tab-'.$name.'" href="'.$url.'">'.$nice_name.'</a>'."\n\t";
132 132
 		return $tab;
133 133
 	}
134 134
 
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	private static function tab_content($name, $tab_content, $active = false) {
146 146
 		$class = $active ? 'nav-tab-content' : 'nav-tab-content hidden';
147
-		$name = str_replace( ' ', '-', $name);
148
-		$content = "\t" . '<div class="'. $class . '" id="ee-tab-' . $name . '">' . "\n";
149
-		$content .= "\t" . $tab_content . "\n";
147
+		$name = str_replace(' ', '-', $name);
148
+		$content = "\t".'<div class="'.$class.'" id="ee-tab-'.$name.'">'."\n";
149
+		$content .= "\t".$tab_content."\n";
150 150
 		$content .= '<div style="clear:both"></div></div>';
151 151
 		return $content;
152 152
 	}
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 	 * @param string $default 			You can include a string for the item that will receive the "item_display" class for the js.
173 173
 	 * @return string                  a html snippet of of all the formatted link elements.
174 174
 	 */
175
-	public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) {
176
-		$item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class );
177
-		if ( !is_array($item_array) || empty( $item_array ) )
175
+	public static function tab_text_links($item_array, $container_class = '', $sep = '|', $default = '') {
176
+		$item_array = apply_filters('FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class);
177
+		if ( ! is_array($item_array) || empty($item_array))
178 178
 			return false; //get out we don't have even the basic thing we need!
179 179
 
180 180
 
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
 			'title' => esc_attr__('Link for Item', 'event_espresso'),
186 186
 			'slug' => 'item_slug'
187 187
 		);
188
-		$container_class = !empty($container_class) ? 'ee-text-links ' . $container_class : 'ee-text-links';
189
-		$list = '<ul class="' . $container_class . '">';
188
+		$container_class = ! empty($container_class) ? 'ee-text-links '.$container_class : 'ee-text-links';
189
+		$list = '<ul class="'.$container_class.'">';
190 190
 
191 191
 		$ci = 1;
192
-		foreach ( $item_array as $item ) {
193
-			$item = wp_parse_args( $item, $defaults );
194
-			$item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class'];
192
+		foreach ($item_array as $item) {
193
+			$item = wp_parse_args($item, $defaults);
194
+			$item['class'] = ! empty($default) && $default == $item['slug'] ? 'item_display '.$item['class'] : $item['class'];
195 195
 			$list .= self::_text_link_item($item);
196
-			if ( !empty($sep) && $ci != count($item_array) )
196
+			if ( ! empty($sep) && $ci != count($item_array))
197 197
 				$list .= self::_text_link_item($sep);
198 198
 			$ci++;
199 199
 		}
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 
205 205
 
206 206
 
207
-	private static function _text_link_item( $item ) {
207
+	private static function _text_link_item($item) {
208 208
 		//if this isn't an array then we're doing a separator
209
-		if ( !is_array( $item ) ) {
209
+		if ( ! is_array($item)) {
210 210
 			$label = $item;
211 211
 			$class = 'ee-text-link-sep';
212 212
 			$href = '';
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 			extract($item);
216 216
 		}
217 217
 
218
-		$class = $class != 'ee-text-link-sep'  ? 'class="ee-text-link-li ' . $class . '"' : 'class="ee-text-link-sep"';
218
+		$class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li '.$class.'"' : 'class="ee-text-link-sep"';
219 219
 
220
-		$content = '<li ' . $class . '>';
221
-		$content .= !empty($href) ? '<a class="ee-text-link" href="#' . $href . '" title="' . $title . '">' : '';
220
+		$content = '<li '.$class.'>';
221
+		$content .= ! empty($href) ? '<a class="ee-text-link" href="#'.$href.'" title="'.$title.'">' : '';
222 222
 		$content .= $label;
223
-		$content .= !empty($href) ? '</a>' : '';
223
+		$content .= ! empty($href) ? '</a>' : '';
224 224
 		$content .= '</li>';
225 225
 		return $content;
226 226
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -102,8 +103,9 @@  discard block
 block discarded – undo
102 103
 	 * @throws \EE_Error
103 104
 	 */
104 105
 	public static function display_admin_nav_tabs($nav_tabs = array()) {
105
-		if ( empty($nav_tabs) )
106
-			throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
106
+		if ( empty($nav_tabs) ) {
107
+					throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
108
+		}
107 109
 
108 110
 		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
109 111
 		foreach ( $nav_tabs as $slug => $tab ) {
@@ -174,8 +176,10 @@  discard block
 block discarded – undo
174 176
 	 */
175 177
 	public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) {
176 178
 		$item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class );
177
-		if ( !is_array($item_array) || empty( $item_array ) )
178
-			return false; //get out we don't have even the basic thing we need!
179
+		if ( !is_array($item_array) || empty( $item_array ) ) {
180
+					return false;
181
+		}
182
+		//get out we don't have even the basic thing we need!
179 183
 
180 184
 
181 185
 		$defaults = array(
@@ -193,8 +197,9 @@  discard block
 block discarded – undo
193 197
 			$item = wp_parse_args( $item, $defaults );
194 198
 			$item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class'];
195 199
 			$list .= self::_text_link_item($item);
196
-			if ( !empty($sep) && $ci != count($item_array) )
197
-				$list .= self::_text_link_item($sep);
200
+			if ( !empty($sep) && $ci != count($item_array) ) {
201
+							$list .= self::_text_link_item($sep);
202
+			}
198 203
 			$ci++;
199 204
 		}
200 205
 
Please login to merge, or discard this patch.
caffeinated/modules/recaptcha/ReCaptcha/RequestMethod/Post.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -34,37 +34,37 @@
 block discarded – undo
34 34
  */
35 35
 class Post implements RequestMethod
36 36
 {
37
-    /**
38
-     * URL to which requests are POSTed.
39
-     * @const string
40
-     */
41
-    const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify';
37
+	/**
38
+	 * URL to which requests are POSTed.
39
+	 * @const string
40
+	 */
41
+	const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify';
42 42
 
43
-    /**
44
-     * Submit the POST request with the specified parameters.
45
-     *
46
-     * @param RequestParameters $params Request parameters
47
-     * @return string Body of the reCAPTCHA response
48
-     */
49
-    public function submit(RequestParameters $params)
50
-    {
51
-        /**
52
-         * PHP 5.6.0 changed the way you specify the peer name for SSL context options.
53
-         * Using "CN_name" will still work, but it will raise deprecated errors.
54
-         */
55
-        $peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name';
56
-        $options = array(
57
-            'http' => array(
58
-                'header' => "Content-type: application/x-www-form-urlencoded\r\n",
59
-                'method' => 'POST',
60
-                'content' => $params->toQueryString(),
61
-                // Force the peer to validate (not needed in 5.6.0+, but still works
62
-                'verify_peer' => true,
63
-                // Force the peer validation to use www.google.com
64
-                $peer_key => 'www.google.com',
65
-            ),
66
-        );
67
-        $context = stream_context_create($options);
68
-        return file_get_contents(self::SITE_VERIFY_URL, false, $context);
69
-    }
43
+	/**
44
+	 * Submit the POST request with the specified parameters.
45
+	 *
46
+	 * @param RequestParameters $params Request parameters
47
+	 * @return string Body of the reCAPTCHA response
48
+	 */
49
+	public function submit(RequestParameters $params)
50
+	{
51
+		/**
52
+		 * PHP 5.6.0 changed the way you specify the peer name for SSL context options.
53
+		 * Using "CN_name" will still work, but it will raise deprecated errors.
54
+		 */
55
+		$peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name';
56
+		$options = array(
57
+			'http' => array(
58
+				'header' => "Content-type: application/x-www-form-urlencoded\r\n",
59
+				'method' => 'POST',
60
+				'content' => $params->toQueryString(),
61
+				// Force the peer to validate (not needed in 5.6.0+, but still works
62
+				'verify_peer' => true,
63
+				// Force the peer validation to use www.google.com
64
+				$peer_key => 'www.google.com',
65
+			),
66
+		);
67
+		$context = stream_context_create($options);
68
+		return file_get_contents(self::SITE_VERIFY_URL, false, $context);
69
+	}
70 70
 }
Please login to merge, or discard this patch.