Completed
Branch BUG-10526-failing-rest-unit-te... (4b9b86)
by
unknown
156:45 queued 144:18
created
4_9_0_stages/EE_DMS_4_9_0_Answers_With_No_Registration.dmsstage.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION')) {
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5 5
 }
6 6
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @author				Brent Christensen
15 15
  *
16 16
  */
17
-class EE_DMS_4_9_0_Answers_With_No_Registration extends EE_Data_Migration_Script_Stage{
17
+class EE_DMS_4_9_0_Answers_With_No_Registration extends EE_Data_Migration_Script_Stage {
18 18
 
19 19
 
20 20
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @return EE_DMS_4_9_0_Answers_With_No_Registration
25 25
 	 */
26 26
 	public function __construct() {
27
-		$this->_pretty_name = __( 'Answer Cleanup', 'event_espresso' );
27
+		$this->_pretty_name = __('Answer Cleanup', 'event_espresso');
28 28
 		parent::__construct();
29 29
 	}
30 30
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	protected function _migration_step($num_items_to_migrate = 50) {
49 49
 		global $wpdb;
50 50
 		$wpdb->delete(
51
-			$wpdb->prefix . 'esp_answer',
52
-			array( 'REG_ID' => 0 ),
53
-			array( '%d' )
51
+			$wpdb->prefix.'esp_answer',
52
+			array('REG_ID' => 0),
53
+			array('%d')
54 54
 		);
55 55
 		$this->set_completed();
56 56
 		return 1;
Please login to merge, or discard this patch.
core/db_models/EEM_Extra_Meta.model.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * ------------------------------------------------------------------------
28 28
  */
29
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
29
+require_once (EE_MODELS.'EEM_Base.model.php');
30 30
 
31 31
 class EEM_Extra_Meta extends EEM_Base {
32 32
 
33 33
   	// private instance of the Attendee object
34 34
 	protected static $_instance = NULL;
35 35
 
36
-	protected function __construct( $timezone = NULL ) {
37
-		$this->singular_item = __('Extra Meta','event_espresso');
38
-		$this->plural_item = __('Extra Metas','event_espresso');
36
+	protected function __construct($timezone = NULL) {
37
+		$this->singular_item = __('Extra Meta', 'event_espresso');
38
+		$this->plural_item = __('Extra Metas', 'event_espresso');
39 39
 		$this->_tables = array(
40 40
 			'Extra_Meta'=> new EE_Primary_Table('esp_extra_meta', 'EXM_ID')
41 41
 		);
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 
51 51
 			));
52 52
 		$this->_model_relations = array();
53
-		foreach($models_this_can_attach_to as $model){
53
+		foreach ($models_this_can_attach_to as $model) {
54 54
 			$this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
55 55
 		}
56
-		foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) {
57
-			$this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'EXM_key', 'EXM_value' );
56
+		foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
57
+			$this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value');
58 58
 		}
59
-		parent::__construct( $timezone );
59
+		parent::__construct($timezone);
60 60
 	}
61 61
 
62 62
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Post_Meta.model.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
  *
32 32
  * ------------------------------------------------------------------------
33 33
  */
34
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
34
+require_once (EE_MODELS.'EEM_Base.model.php');
35 35
 
36 36
 class EEM_Post_Meta extends EEM_Base {
37 37
 
38 38
   	// private instance of the EE_Post_Meta object
39 39
 	protected static $_instance = NULL;
40 40
 
41
-	protected function __construct( $timezone = NULL ) {
42
-		$this->singular_item = __('Post Meta','event_espresso');
43
-		$this->plural_item = __('Post Metas','event_espresso');
41
+	protected function __construct($timezone = NULL) {
42
+		$this->singular_item = __('Post Meta', 'event_espresso');
43
+		$this->plural_item = __('Post Metas', 'event_espresso');
44 44
 		$this->_tables = array(
45 45
 			'Post_Meta'=> new EE_Primary_Table('postmeta', 'meta_id')
46 46
 		);
47
-		$models_this_can_attach_to = array_keys( EE_Registry::instance()->cpt_models() );
47
+		$models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models());
48 48
 		$this->_fields = array(
49 49
 			'Post_Meta'=>array(
50 50
 				'meta_id'=>new EE_Primary_Key_Int_Field('meta_id', __("Meta ID", "event_espresso")),
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 				'meta_value'=>new EE_Maybe_Serialized_Text_Field('meta_value', __("Meta Value", "event_espresso"), true)
54 54
 			));
55 55
 		$this->_model_relations = array();
56
-		foreach($models_this_can_attach_to as $model){
56
+		foreach ($models_this_can_attach_to as $model) {
57 57
 			$this->_model_relations[$model] = new EE_Belongs_To_Relation();
58 58
 		}
59
-		foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) {
60
-			$this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'meta_key', 'meta_value' );
59
+		foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
60
+			$this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('meta_key', 'meta_value');
61 61
 		}
62
-		parent::__construct( $timezone );
62
+		parent::__construct($timezone);
63 63
 	}
64 64
 
65 65
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Restriction_Generator_Meta.strategy.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @author				Mike Nelson
15 15
  *
16 16
  */
17
-class EE_Restriction_Generator_Meta extends EE_Restriction_Generator_Base{
17
+class EE_Restriction_Generator_Meta extends EE_Restriction_Generator_Base {
18 18
 
19 19
 	/**
20 20
 	 *
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @param string $key_field_name
34 34
 	 * @param string $value_field_name
35 35
 	 */
36
-	public function __construct( $key_field_name, $value_field_name ) {
36
+	public function __construct($key_field_name, $value_field_name) {
37 37
 		$this->_key_field_name = $key_field_name;
38 38
 		$this->_value_field_name = $value_field_name;
39 39
 	}
@@ -45,21 +45,21 @@  discard block
 block discarded – undo
45 45
 	 * @throws EE_Error
46 46
 	 */
47 47
 	protected function _generate_restrictions() {
48
-		$whitelisted_meta_keys = apply_filters( 'FHEE__EE_Restriction_Generator_Meta___generate_restrictions__whitelisted_meta_keys', array() );
49
-		$blacklisted_meta_keys = apply_filters( 'FHEE__EE_Restriction_Generator_Meta___generate_restrictions__blacklisted_meta_keys', array() );
48
+		$whitelisted_meta_keys = apply_filters('FHEE__EE_Restriction_Generator_Meta___generate_restrictions__whitelisted_meta_keys', array());
49
+		$blacklisted_meta_keys = apply_filters('FHEE__EE_Restriction_Generator_Meta___generate_restrictions__blacklisted_meta_keys', array());
50 50
 		$conditions = array(
51
-			$this->_key_field_name => array( 'NOT_LIKE', "\\\\_%" ),//each slash is escaped because we are using double quotes, and 
51
+			$this->_key_field_name => array('NOT_LIKE', "\\\\_%"), //each slash is escaped because we are using double quotes, and 
52 52
 			//stripslashes will be called on this because the models assume this is from user input
53
-			$this->_value_field_name => array( 'NOT_REGEXP', '^[aOs]:[\d]:.*$')					
53
+			$this->_value_field_name => array('NOT_REGEXP', '^[aOs]:[\d]:.*$')					
54 54
 		);
55
-		if( ! empty( $blacklisted_meta_keys ) ) {
56
-			$conditions[ $this->_key_field_name . '*blacklisted' ] = array( 'NOT_IN', $blacklisted_meta_keys );
55
+		if ( ! empty($blacklisted_meta_keys)) {
56
+			$conditions[$this->_key_field_name.'*blacklisted'] = array('NOT_IN', $blacklisted_meta_keys);
57 57
 		}
58
-		if( ! empty( $whitelisted_meta_keys ) ) {
58
+		if ( ! empty($whitelisted_meta_keys)) {
59 59
 			$conditions = array(
60 60
 				'OR*whitelisted-or-normal' => array(
61 61
 					'AND' => $conditions,
62
-					$this->_key_field_name . '*whitelisted' => array( 'IN', $whitelisted_meta_keys ) 
62
+					$this->_key_field_name.'*whitelisted' => array('IN', $whitelisted_meta_keys) 
63 63
 				)
64 64
 			);
65 65
 		}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			//only allow access to non-protected metas if they're an admin
68 68
 			EE_Restriction_Generator_Base::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions(),
69 69
 			//don't allow access to protected metas to anyone. If they want that, don't apply caps to the query
70
-			'apply-to-all-queries-using-caps' => new EE_Default_Where_Conditions( $conditions ),
70
+			'apply-to-all-queries-using-caps' => new EE_Default_Where_Conditions($conditions),
71 71
 		);
72 72
 	}
73 73
 }
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/Base.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@
 block discarded – undo
129 129
 	 *
130 130
 	 * @param string $route
131 131
 	 * @param string $regex
132
-	 * @param array  $match_keys EXCLUDING matching the entire regex
132
+	 * @param string[]  $match_keys EXCLUDING matching the entire regex
133 133
 	 * @return array where  $match_keys are the keys (the first value of $match_keys
134 134
 	 * becomes the first key of the return value, etc. Eg passing in $match_keys of
135 135
 	 * array( 'model', 'id' ), will, if the regex is successful, will return
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\rest_api\controllers;
3 3
 use EventEspresso\core\libraries\rest_api\Rest_Exception;
4
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 /**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 	public function __construct() {
52
-		$this->_debug_mode = defined( 'EE_REST_API_DEBUG_MODE' ) ? EE_REST_API_DEBUG_MODE : false;
52
+		$this->_debug_mode = defined('EE_REST_API_DEBUG_MODE') ? EE_REST_API_DEBUG_MODE : false;
53 53
 	}
54 54
 
55 55
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * Sets the version the user requested
58 58
 	 * @param string $version eg '4.8'
59 59
 	 */
60
-	public function set_requested_version( $version ) {
60
+	public function set_requested_version($version) {
61 61
 		$this->_requested_version = $version;
62 62
 	}
63 63
 
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	 * @param string $key
67 67
 	 * @param string|array $info
68 68
 	 */
69
-	protected function _set_debug_info( $key, $info ){
70
-		$this->_debug_info[ $key ] = $info;
69
+	protected function _set_debug_info($key, $info) {
70
+		$this->_debug_info[$key] = $info;
71 71
 	}
72 72
 
73 73
 	/**
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
 	 * @param boolean      $use_ee_prefix whether to use the EE prefix on the header, or fallback to
80 80
 	 *                                    the standard WP one
81 81
 	 */
82
-	protected function _set_response_header( $header_key, $value, $use_ee_prefix = true ) {
83
-		if( is_array( $value ) ) {
84
-			foreach( $value as $value_key => $value_value ) {
85
-				$this->_set_response_header(  $header_key . '[' . $value_key . ']', $value_value );
82
+	protected function _set_response_header($header_key, $value, $use_ee_prefix = true) {
83
+		if (is_array($value)) {
84
+			foreach ($value as $value_key => $value_value) {
85
+				$this->_set_response_header($header_key.'['.$value_key.']', $value_value);
86 86
 			}
87 87
 		} else {
88 88
 			$prefix = $use_ee_prefix ? Base::header_prefix_for_ee : Base::header_prefix_for_wp;
89
-			$this->_response_headers[ $prefix . $header_key  ] = $value;
89
+			$this->_response_headers[$prefix.$header_key] = $value;
90 90
 		}
91 91
 	}
92 92
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return array
96 96
 	 */
97 97
 	protected function _get_response_headers() {
98
-		return apply_filters( 'FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_response_headers',
98
+		return apply_filters('FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_response_headers',
99 99
 			$this->_response_headers,
100 100
 			$this,
101 101
 			$this->_requested_version
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 	 * @param \WP_Error $wp_error_response
108 108
 	 * @return \WP_Error
109 109
 	 */
110
-	protected function _add_ee_errors_to_response( \WP_Error $wp_error_response ) {
110
+	protected function _add_ee_errors_to_response(\WP_Error $wp_error_response) {
111 111
 		$notices_during_checkin = \EE_Error::get_raw_notices();
112
-		if( ! empty( $notices_during_checkin[ 'errors' ] ) ) {
113
-			foreach( $notices_during_checkin[ 'errors' ] as $error_code => $error_message ) {
112
+		if ( ! empty($notices_during_checkin['errors'])) {
113
+			foreach ($notices_during_checkin['errors'] as $error_code => $error_message) {
114 114
 				$wp_error_response->add(
115
-					sanitize_key( $error_code ),
116
-					strip_tags( $error_message ) );
115
+					sanitize_key($error_code),
116
+					strip_tags($error_message) );
117 117
 			}
118 118
 		}
119 119
 		return $wp_error_response;
@@ -131,27 +131,27 @@  discard block
 block discarded – undo
131 131
 	 * @param array|\WP_Error|\Exception $response
132 132
 	 * @return \WP_REST_Response
133 133
 	 */
134
-	public function send_response( $response ) {
135
-		if( $response instanceof Rest_Exception ) {
136
-			$response = new \WP_Error( $response->get_string_code(), $response->getMessage(), $response->get_data() );
134
+	public function send_response($response) {
135
+		if ($response instanceof Rest_Exception) {
136
+			$response = new \WP_Error($response->get_string_code(), $response->getMessage(), $response->get_data());
137 137
 		}
138
-		if( $response instanceof \Exception ) {
138
+		if ($response instanceof \Exception) {
139 139
 			$code = $response->getCode() ? $response->getCode() : 'error_occurred';
140
-			$response = new \WP_Error( $code, $response->getMessage() );
140
+			$response = new \WP_Error($code, $response->getMessage());
141 141
 		}
142
-		if( $response instanceof \WP_Error ) {
143
-			$response = $this->_add_ee_errors_to_response( $response );
144
-			$rest_response = $this->_create_rest_response_from_wp_error( $response );
145
-		}else{
146
-			$rest_response = new \WP_REST_Response( $response, 200 );
142
+		if ($response instanceof \WP_Error) {
143
+			$response = $this->_add_ee_errors_to_response($response);
144
+			$rest_response = $this->_create_rest_response_from_wp_error($response);
145
+		} else {
146
+			$rest_response = new \WP_REST_Response($response, 200);
147 147
 		}
148 148
 		$headers = array();
149
-		if( $this->_debug_mode && is_array( $this->_debug_info ) ) {
150
-			foreach( $this->_debug_info  as $debug_key => $debug_info ) {
151
-				if( is_array( $debug_info ) ) {
152
-					$debug_info = wp_json_encode( $debug_info );
149
+		if ($this->_debug_mode && is_array($this->_debug_info)) {
150
+			foreach ($this->_debug_info  as $debug_key => $debug_info) {
151
+				if (is_array($debug_info)) {
152
+					$debug_info = wp_json_encode($debug_info);
153 153
 				}
154
-				$headers[ 'X-EE4-Debug-' . ucwords( $debug_key ) ] = $debug_info;
154
+				$headers['X-EE4-Debug-'.ucwords($debug_key)] = $debug_info;
155 155
 			}
156 156
 		}
157 157
 		$headers = array_merge(
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			$this->_get_headers_from_ee_notices()
161 161
 		);
162 162
 
163
-		$rest_response->set_headers( $headers );
163
+		$rest_response->set_headers($headers);
164 164
 		return $rest_response;
165 165
 	}
166 166
 
@@ -171,31 +171,31 @@  discard block
 block discarded – undo
171 171
 	 * @param \WP_Error $wp_error
172 172
 	 * @return \WP_REST_Response
173 173
 	 */
174
-	protected function _create_rest_response_from_wp_error( \WP_Error $wp_error ) {
174
+	protected function _create_rest_response_from_wp_error(\WP_Error $wp_error) {
175 175
 		$error_data = $wp_error->get_error_data();
176
-		if ( is_array( $error_data ) && isset( $error_data['status'] ) ) {
176
+		if (is_array($error_data) && isset($error_data['status'])) {
177 177
 			$status = $error_data['status'];
178 178
 		} else {
179 179
 			$status = 500;
180 180
 		}
181 181
 
182 182
 		$errors = array();
183
-		foreach ( (array) $wp_error->errors as $code => $messages ) {
184
-			foreach ( (array) $messages as $message ) {
183
+		foreach ((array) $wp_error->errors as $code => $messages) {
184
+			foreach ((array) $messages as $message) {
185 185
 				$errors[] = array(
186 186
 					'code'    => $code,
187 187
 					'message' => $message,
188
-					'data'    => $wp_error->get_error_data( $code )
188
+					'data'    => $wp_error->get_error_data($code)
189 189
 				);
190 190
 			}
191 191
 		}
192
-		$data = isset( $errors[0] ) ? $errors[0] : array();
193
-		if ( count( $errors ) > 1 ) {
192
+		$data = isset($errors[0]) ? $errors[0] : array();
193
+		if (count($errors) > 1) {
194 194
 			// Remove the primary error.
195
-			array_shift( $errors );
195
+			array_shift($errors);
196 196
 			$data['additional_errors'] = $errors;
197 197
 		}
198
-		return new \WP_REST_Response( $data, $status );
198
+		return new \WP_REST_Response($data, $status);
199 199
 	}
200 200
 
201 201
 	/**
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
 	protected function _get_headers_from_ee_notices() {
206 206
 		$headers = array();
207 207
 		$notices = \EE_Error::get_raw_notices();
208
-		foreach( $notices as $notice_type => $sub_notices ) {
209
-			if( ! is_array( $sub_notices ) ) {
208
+		foreach ($notices as $notice_type => $sub_notices) {
209
+			if ( ! is_array($sub_notices)) {
210 210
 				continue;
211 211
 			}
212
-			foreach( $sub_notices as $notice_code => $sub_notice ) {
213
-				$headers[ 'X-EE4-Notices-' . \EEH_Inflector::humanize( $notice_type ) . '[' . $notice_code . ']' ] = strip_tags( $sub_notice );
212
+			foreach ($sub_notices as $notice_code => $sub_notice) {
213
+				$headers['X-EE4-Notices-'.\EEH_Inflector::humanize($notice_type).'['.$notice_code.']'] = strip_tags($sub_notice);
214 214
 			}
215 215
 		}
216 216
 		return apply_filters(
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
 	 * @param string $route
229 229
 	 * @return string
230 230
 	 */
231
-	public function get_requested_version( $route = null ) {
231
+	public function get_requested_version($route = null) {
232 232
 		$matches = $this->parse_route(
233 233
 			$route,
234
-			'~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . '~',
235
-			array( 'version' )
234
+			'~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'~',
235
+			array('version')
236 236
 			);
237
-		if( isset( $matches[ 'version' ] ) ) {
238
-			return $matches[ 'version' ];
237
+		if (isset($matches['version'])) {
238
+			return $matches['version'];
239 239
 		} else {
240 240
 			return \EED_Core_Rest_Api::latest_rest_api_version();
241 241
 		}
@@ -260,23 +260,23 @@  discard block
 block discarded – undo
260 260
 	 * array( 'model' => 'foo', 'id' => 'bar' )
261 261
 	 * @throws \EE_Error if it couldn't be parsed
262 262
 	 */
263
-	public function parse_route( $route, $regex, $match_keys ) {
263
+	public function parse_route($route, $regex, $match_keys) {
264 264
 		$indexed_matches = array();
265
-		$success = preg_match( $regex, $route, $matches );
266
-		if(
267
-			is_array( $matches ) ) {
265
+		$success = preg_match($regex, $route, $matches);
266
+		if (
267
+			is_array($matches) ) {
268 268
 			//skip the overall regex match. Who cares
269
-			for( $i = 1; $i <= count( $match_keys ); $i++ ) {
270
-				if( ! isset( $matches[ $i ] ) ) {
269
+			for ($i = 1; $i <= count($match_keys); $i++) {
270
+				if ( ! isset($matches[$i])) {
271 271
 					$success = false;
272 272
 				} else {
273
-					$indexed_matches[ $match_keys[ $i - 1 ] ] = $matches[ $i ];
273
+					$indexed_matches[$match_keys[$i - 1]] = $matches[$i];
274 274
 				}
275 275
 			}
276 276
 		}
277
-		if( ! $success ) {
277
+		if ( ! $success) {
278 278
 			throw new \EE_Error(
279
-				__( 'We could not parse the URL. Please contact Event Espresso Support', 'event_espresso' ),
279
+				__('We could not parse the URL. Please contact Event Espresso Support', 'event_espresso'),
280 280
 				'endpoint_parsing_error'
281 281
 			);
282 282
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@
 block discarded – undo
142 142
 		if( $response instanceof \WP_Error ) {
143 143
 			$response = $this->_add_ee_errors_to_response( $response );
144 144
 			$rest_response = $this->_create_rest_response_from_wp_error( $response );
145
-		}else{
145
+		} else{
146 146
 			$rest_response = new \WP_REST_Response( $response, 200 );
147 147
 		}
148 148
 		$headers = array();
Please login to merge, or discard this patch.
core/db_models/strategies/EE_CPT_Minimum_Where_Conditions.strategy.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,6 +7,10 @@  discard block
 block discarded – undo
7 7
 
8 8
 	protected $_post_type;
9 9
 	protected $_meta_field;
10
+
11
+	/**
12
+	 * @param string $post_type
13
+	 */
10 14
 	function __construct($post_type, $meta_field_to_chk = ''){
11 15
 		$this->_post_type = $post_type;
12 16
 		$this->_meta_field = $meta_field_to_chk;
@@ -27,7 +31,6 @@  discard block
 block discarded – undo
27 31
 	}
28 32
 	/**
29 33
 	 * Gets the where default where conditions for a custom post type model
30
-	 * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment"
31 34
 	 * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)
32 35
 	 */
33 36
 	protected function _get_default_where_conditions() {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  *
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
  * @since		 	   4.8.29.rc.010
16 16
  *
17 17
  */
18
-class EE_CPT_Minimum_Where_Conditions extends EE_Default_Where_Conditions{
18
+class EE_CPT_Minimum_Where_Conditions extends EE_Default_Where_Conditions {
19 19
 
20 20
 	protected $_post_type;
21 21
 	protected $_meta_field;
22
-	function __construct($post_type, $meta_field_to_chk = ''){
22
+	function __construct($post_type, $meta_field_to_chk = '') {
23 23
 		$this->_post_type = $post_type;
24 24
 		$this->_meta_field = $meta_field_to_chk;
25 25
 	}
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	 * @param string $column column name
30 30
 	 * @return EE_Model_Field_Base
31 31
 	 */
32
-	protected function _get_field_on_column($column){
32
+	protected function _get_field_on_column($column) {
33 33
 		$all_fields = $this->_model->field_settings(true);
34
-		foreach($all_fields as $field_name => $field_obj){
35
-			if($column == $field_obj->get_table_column()){
34
+		foreach ($all_fields as $field_name => $field_obj) {
35
+			if ($column == $field_obj->get_table_column()) {
36 36
 				return $field_obj;
37 37
 			}
38 38
 		}
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 /**
6 6
  *
7 7
  * Class EE_CPT_Minimum_Where_Conditions
8
-  * 
8
+ * 
9 9
  * Strategy specifically for adding where conditions specific to CPT models.
10 10
  * But only sets the minimum, so any row of the right type will get used
11 11
  *
Please login to merge, or discard this patch.
core/db_models/strategies/EE_CPT_Where_Conditions.strategy.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,6 @@
 block discarded – undo
17 17
 class EE_CPT_Where_Conditions extends EE_CPT_Minimum_Where_Conditions{
18 18
 	/**
19 19
 	 * Gets the where default where conditions for a custom post type model
20
-	 * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment"
21 20
 	 * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions)
22 21
 	 */
23 22
 	protected function _get_default_where_conditions() {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  *
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * * @since		 	   4.6.0
15 15
  *
16 16
  */
17
-class EE_CPT_Where_Conditions extends EE_CPT_Minimum_Where_Conditions{
17
+class EE_CPT_Where_Conditions extends EE_CPT_Minimum_Where_Conditions {
18 18
 	/**
19 19
 	 * Gets the where default where conditions for a custom post type model
20 20
 	 * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment"
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		return array_merge( 
26 26
 			parent::_get_default_where_conditions(),
27 27
 			array( 
28
-				$status_field->get_name() => array('NOT IN',array('auto-draft','trash') )
28
+				$status_field->get_name() => array('NOT IN', array('auto-draft', 'trash'))
29 29
 			)
30 30
 		);
31 31
 	}
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 /**
6 6
  *
7 7
  * Class EE_Default_Where_Conditions
8
-  * 
8
+ * 
9 9
  * Strategy specifically for adding where conditions specific to CPT models.
10 10
  *
11 11
  * @package         Event Espresso
Please login to merge, or discard this patch.
modules/ticket_sales_monitor/EED_Ticket_Sales_Monitor.module.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @access    protected
239 239
 	 * @param    \EE_Ticket $ticket
240 240
 	 * @param int           $quantity
241
-	 * @return bool
241
+	 * @return integer
242 242
 	 * @throws \EE_Error
243 243
 	 */
244 244
 	protected function _reserve_ticket( EE_Ticket $ticket, $quantity = 1 ) {
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 * @access protected
258 258
 	 * @param  EE_Ticket $ticket
259 259
 	 * @param  int       $quantity
260
-	 * @return bool
260
+	 * @return integer
261 261
 	 * @throws \EE_Error
262 262
 	 */
263 263
 	protected function _release_reserved_ticket( EE_Ticket $ticket, $quantity = 1 ) {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @access 	protected
282 282
 	 * @param 	\EE_Ticket   $ticket
283
-	 * @return 	bool
283
+	 * @return 	boolean|null
284 284
 	 * @throws \EE_Error
285 285
 	 */
286 286
 	protected function _ticket_sold_out( EE_Ticket $ticket ) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @access    protected
301 301
 	 * @param    \EE_Ticket $ticket
302
-	 * @return bool
302
+	 * @return boolean|null
303 303
 	 */
304 304
 	protected function _ticket_quantity_decremented( EE_Ticket $ticket ) {
305 305
 		if ( self::debug ) {
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -399,13 +399,13 @@  discard block
 block discarded – undo
399 399
 		if ( self::debug ) {
400 400
 			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
401 401
 		}
402
-        $refresh_msg = '';
403
-        $none_added_msg = '';
402
+		$refresh_msg = '';
403
+		$none_added_msg = '';
404 404
 		if (defined('DOING_AJAX') && DOING_AJAX) {
405
-            $refresh_msg = __('Please refresh the page to view updated ticket quantities.',
406
-                'event_espresso');
407
-            $none_added_msg = __('No tickets were added for the event.', 'event_espresso');
408
-        }
405
+			$refresh_msg = __('Please refresh the page to view updated ticket quantities.',
406
+				'event_espresso');
407
+			$none_added_msg = __('No tickets were added for the event.', 'event_espresso');
408
+		}
409 409
 		if ( ! empty( $this->sold_out_tickets ) ) {
410 410
 			EE_Error::add_attention(
411 411
 				sprintf(
@@ -415,16 +415,16 @@  discard block
 block discarded – undo
415 415
 					),
416 416
 					'<br />',
417 417
 					implode( '<br />', $this->sold_out_tickets ),
418
-                    $none_added_msg,
419
-                    $refresh_msg
418
+					$none_added_msg,
419
+					$refresh_msg
420 420
 				)
421 421
 			);
422 422
 			// alter code flow in the Ticket Selector for better UX
423 423
 			add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', '__return_true' );
424 424
 			add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', '__return_false' );
425 425
 			$this->sold_out_tickets = array();
426
-            // and reset the cart
427
-            EED_Ticket_Sales_Monitor::session_cart_reset(EE_Registry::instance()->SSN);
426
+			// and reset the cart
427
+			EED_Ticket_Sales_Monitor::session_cart_reset(EE_Registry::instance()->SSN);
428 428
 		}
429 429
 		if ( ! empty( $this->decremented_tickets ) ) {
430 430
 			EE_Error::add_attention(
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 					),
436 436
 					'<br />',
437 437
 					implode( '<br />', $this->decremented_tickets ),
438
-                    $none_added_msg,
439
-                    $refresh_msg
438
+					$none_added_msg,
439
+					$refresh_msg
440 440
 				)
441 441
 			);
442 442
 			$this->decremented_tickets = array();
@@ -607,11 +607,11 @@  discard block
 block discarded – undo
607 607
 				}
608 608
 			}
609 609
 		}
610
-        if (self::debug) {
611
-            echo "<br /><br /> RESET COMPLETED ";
612
-        }
610
+		if (self::debug) {
611
+			echo "<br /><br /> RESET COMPLETED ";
612
+		}
613 613
 
614
-    }
614
+	}
615 615
 
616 616
 
617 617
 
Please login to merge, or discard this patch.
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  * Class EED_Ticket_Sales_Monitor
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class EED_Ticket_Sales_Monitor extends EED_Module {
19 19
 
20
-	const debug = false; 	//	true false
20
+	const debug = false; //	true false
21 21
 
22 22
 	/**
23 23
 	 * an array of raw ticket data from EED_Ticket_Selector
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public static function set_hooks() {
61 61
 		// check ticket reserves AFTER MER does it's check (hence priority 20)
62
-		add_filter( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty',
63
-			array( 'EED_Ticket_Sales_Monitor', 'validate_ticket_sale' ),
62
+		add_filter('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty',
63
+			array('EED_Ticket_Sales_Monitor', 'validate_ticket_sale'),
64 64
 			20, 3
65 65
 		);
66 66
 		// add notices for sold out tickets
67
-		add_action( 'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart',
68
-			array( 'EED_Ticket_Sales_Monitor', 'post_notices' ),
67
+		add_action('AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart',
68
+			array('EED_Ticket_Sales_Monitor', 'post_notices'),
69 69
 			10
70 70
 		);
71 71
 		// handle ticket quantities adjusted in cart
@@ -77,40 +77,40 @@  discard block
 block discarded – undo
77 77
 		// handle tickets deleted from cart
78 78
 		add_action(
79 79
 			'FHEE__EED_Multi_Event_Registration__delete_ticket__ticket_removed_from_cart',
80
-			array( 'EED_Ticket_Sales_Monitor', 'ticket_removed_from_cart' ),
80
+			array('EED_Ticket_Sales_Monitor', 'ticket_removed_from_cart'),
81 81
 			10, 2
82 82
 		);
83 83
 		// handle emptied carts
84 84
 		add_action(
85 85
 			'AHEE__EE_Session__reset_cart__before_reset',
86
-			array( 'EED_Ticket_Sales_Monitor', 'session_cart_reset' ),
86
+			array('EED_Ticket_Sales_Monitor', 'session_cart_reset'),
87 87
 			10, 1
88 88
 		);
89 89
 		add_action(
90 90
 			'AHEE__EED_Multi_Event_Registration__empty_event_cart__before_delete_cart',
91
-			array( 'EED_Ticket_Sales_Monitor', 'session_cart_reset' ),
91
+			array('EED_Ticket_Sales_Monitor', 'session_cart_reset'),
92 92
 			10, 1
93 93
 		);
94 94
 		// handle cancelled registrations
95 95
 		add_action(
96 96
 			'AHEE__EE_Session__reset_checkout__before_reset',
97
-			array( 'EED_Ticket_Sales_Monitor', 'session_checkout_reset' ),
97
+			array('EED_Ticket_Sales_Monitor', 'session_checkout_reset'),
98 98
 			10, 1
99 99
 		);
100 100
 		// cron tasks
101 101
 		add_action(
102 102
 			'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions__abandoned_transaction',
103
-			array( 'EED_Ticket_Sales_Monitor', 'process_abandoned_transactions' ),
103
+			array('EED_Ticket_Sales_Monitor', 'process_abandoned_transactions'),
104 104
 			10, 1
105 105
 		);
106 106
 		add_action(
107 107
 			'AHEE__EE_Cron_Tasks__process_expired_transactions__incomplete_transaction',
108
-			array( 'EED_Ticket_Sales_Monitor', 'process_abandoned_transactions' ),
108
+			array('EED_Ticket_Sales_Monitor', 'process_abandoned_transactions'),
109 109
 			10, 1
110 110
 		);
111 111
 		add_action(
112 112
 			'AHEE__EE_Cron_Tasks__process_expired_transactions__failed_transaction',
113
-			array( 'EED_Ticket_Sales_Monitor', 'process_failed_transactions' ),
113
+			array('EED_Ticket_Sales_Monitor', 'process_failed_transactions'),
114 114
 			10, 1
115 115
 		);
116 116
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @return EED_Ticket_Sales_Monitor
135 135
 	 */
136 136
 	public static function instance() {
137
-		return parent::get_instance( __CLASS__ );
137
+		return parent::get_instance(__CLASS__);
138 138
 	}
139 139
 
140 140
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @param WP_Query $WP_Query
147 147
 	 * @return    void
148 148
 	 */
149
-	public function run( $WP_Query ) {
149
+	public function run($WP_Query) {
150 150
 	}
151 151
 
152 152
 
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
 	 * @param \EE_Ticket $ticket
165 165
 	 * @return bool
166 166
 	 */
167
-	public static function validate_ticket_sale( $qty = 1, EE_Ticket $ticket  ) {
168
-		$qty = absint( $qty );
169
-		if ( $qty > 0 ) {
170
-			$qty = EED_Ticket_Sales_Monitor::instance()->_validate_ticket_sale( $ticket, $qty );
167
+	public static function validate_ticket_sale($qty = 1, EE_Ticket $ticket) {
168
+		$qty = absint($qty);
169
+		if ($qty > 0) {
170
+			$qty = EED_Ticket_Sales_Monitor::instance()->_validate_ticket_sale($ticket, $qty);
171 171
 		}
172
-		if ( self::debug ) {
173
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "()";
174
-			echo "<br /><br /><b> RETURNED QTY: " . $qty . '</b>';
172
+		if (self::debug) {
173
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."()";
174
+			echo "<br /><br /><b> RETURNED QTY: ".$qty.'</b>';
175 175
 		}
176 176
 		return $qty;
177 177
 	}
@@ -187,42 +187,42 @@  discard block
 block discarded – undo
187 187
 	 * @param int          $qty
188 188
 	 * @return int
189 189
 	 */
190
-	protected function _validate_ticket_sale( EE_Ticket $ticket, $qty = 1 ) {
191
-		if ( self::debug ) {
192
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
190
+	protected function _validate_ticket_sale(EE_Ticket $ticket, $qty = 1) {
191
+		if (self::debug) {
192
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
193 193
 		}
194
-		if ( ! $ticket instanceof EE_Ticket ) {
194
+		if ( ! $ticket instanceof EE_Ticket) {
195 195
 			return 0;
196 196
 		}
197
-		if ( self::debug ) {
198
-			echo "<br /><b> . ticket->ID: " . $ticket->ID() . '</b>';
199
-			echo "<br /> . original ticket->reserved: " . $ticket->reserved();
197
+		if (self::debug) {
198
+			echo "<br /><b> . ticket->ID: ".$ticket->ID().'</b>';
199
+			echo "<br /> . original ticket->reserved: ".$ticket->reserved();
200 200
 		}
201 201
 		$ticket->refresh_from_db();
202 202
 		// first let's determine the ticket availability based on sales
203
-		$available = $ticket->qty( 'saleable' );
204
-		if ( self::debug ) {
205
-			echo "<br /> . . . ticket->qty: " . $ticket->qty();
206
-			echo "<br /> . . . ticket->sold: " . $ticket->sold();
207
-			echo "<br /> . . . ticket->reserved: " . $ticket->reserved();
208
-			echo "<br /> . . . ticket->qty(saleable): " . $ticket->qty( 'saleable' );
209
-			echo "<br /> . . . available: " . $available;
210
-		}
211
-		if ( $available < 1 ) {
212
-			$this->_ticket_sold_out( $ticket );
203
+		$available = $ticket->qty('saleable');
204
+		if (self::debug) {
205
+			echo "<br /> . . . ticket->qty: ".$ticket->qty();
206
+			echo "<br /> . . . ticket->sold: ".$ticket->sold();
207
+			echo "<br /> . . . ticket->reserved: ".$ticket->reserved();
208
+			echo "<br /> . . . ticket->qty(saleable): ".$ticket->qty('saleable');
209
+			echo "<br /> . . . available: ".$available;
210
+		}
211
+		if ($available < 1) {
212
+			$this->_ticket_sold_out($ticket);
213 213
 			return 0;
214 214
 		}
215
-		if ( self::debug ) {
216
-			echo "<br /> . . . qty: " . $qty;
215
+		if (self::debug) {
216
+			echo "<br /> . . . qty: ".$qty;
217 217
 		}
218
-		if ( $available < $qty ) {
218
+		if ($available < $qty) {
219 219
 			$qty = $available;
220
-			if ( self::debug ) {
221
-				echo "<br /> . . . QTY ADJUSTED: " . $qty;
220
+			if (self::debug) {
221
+				echo "<br /> . . . QTY ADJUSTED: ".$qty;
222 222
 			}
223
-			$this->_ticket_quantity_decremented( $ticket );
223
+			$this->_ticket_quantity_decremented($ticket);
224 224
 		}
225
-		$this->_reserve_ticket( $ticket, $qty );
225
+		$this->_reserve_ticket($ticket, $qty);
226 226
 		return $qty;
227 227
 	}
228 228
 
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
 	 * @return bool
239 239
 	 * @throws \EE_Error
240 240
 	 */
241
-	protected function _reserve_ticket( EE_Ticket $ticket, $quantity = 1 ) {
242
-		if ( self::debug ) {
243
-			echo "<br /><br /> . . . INCREASE RESERVED: " . $quantity;
241
+	protected function _reserve_ticket(EE_Ticket $ticket, $quantity = 1) {
242
+		if (self::debug) {
243
+			echo "<br /><br /> . . . INCREASE RESERVED: ".$quantity;
244 244
 		}
245
-		$ticket->increase_reserved( $quantity );
245
+		$ticket->increase_reserved($quantity);
246 246
 		return $ticket->save();
247 247
 	}
248 248
 
@@ -257,14 +257,14 @@  discard block
 block discarded – undo
257 257
 	 * @return bool
258 258
 	 * @throws \EE_Error
259 259
 	 */
260
-	protected function _release_reserved_ticket( EE_Ticket $ticket, $quantity = 1 ) {
261
-		if ( self::debug ) {
262
-			echo "<br /> . . . ticket->ID: " . $ticket->ID();
263
-			echo "<br /> . . . ticket->reserved: " . $ticket->reserved();
260
+	protected function _release_reserved_ticket(EE_Ticket $ticket, $quantity = 1) {
261
+		if (self::debug) {
262
+			echo "<br /> . . . ticket->ID: ".$ticket->ID();
263
+			echo "<br /> . . . ticket->reserved: ".$ticket->reserved();
264 264
 		}
265
-		$ticket->decrease_reserved( $quantity );
266
-		if ( self::debug ) {
267
-			echo "<br /> . . . ticket->reserved: " . $ticket->reserved();
265
+		$ticket->decrease_reserved($quantity);
266
+		if (self::debug) {
267
+			echo "<br /> . . . ticket->reserved: ".$ticket->reserved();
268 268
 		}
269 269
 		return $ticket->save() ? 1 : 0;
270 270
 	}
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
 	 * @return 	bool
281 281
 	 * @throws \EE_Error
282 282
 	 */
283
-	protected function _ticket_sold_out( EE_Ticket $ticket ) {
284
-		if ( self::debug ) {
285
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
286
-			echo "<br /> . . ticket->name: " . $this->_get_ticket_and_event_name( $ticket );
283
+	protected function _ticket_sold_out(EE_Ticket $ticket) {
284
+		if (self::debug) {
285
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
286
+			echo "<br /> . . ticket->name: ".$this->_get_ticket_and_event_name($ticket);
287 287
 		}
288
-		$this->sold_out_tickets[] = $this->_get_ticket_and_event_name( $ticket );
288
+		$this->sold_out_tickets[] = $this->_get_ticket_and_event_name($ticket);
289 289
 	}
290 290
 
291 291
 
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
 	 * @param    \EE_Ticket $ticket
299 299
 	 * @return bool
300 300
 	 */
301
-	protected function _ticket_quantity_decremented( EE_Ticket $ticket ) {
302
-		if ( self::debug ) {
303
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
304
-			echo "<br /> . . ticket->name: " . $this->_get_ticket_and_event_name( $ticket );
301
+	protected function _ticket_quantity_decremented(EE_Ticket $ticket) {
302
+		if (self::debug) {
303
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
304
+			echo "<br /> . . ticket->name: ".$this->_get_ticket_and_event_name($ticket);
305 305
 		}
306
-		$this->decremented_tickets[] = $this->_get_ticket_and_event_name( $ticket );
306
+		$this->decremented_tickets[] = $this->_get_ticket_and_event_name($ticket);
307 307
 	}
308 308
 
309 309
 
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 	 * @param    \EE_Ticket $ticket
317 317
 	 * @return string
318 318
 	 */
319
-	protected function _get_ticket_and_event_name( EE_Ticket $ticket ) {
319
+	protected function _get_ticket_and_event_name(EE_Ticket $ticket) {
320 320
 		$event = $ticket->get_related_event();
321
-		if ( $event instanceof EE_Event ) {
321
+		if ($event instanceof EE_Event) {
322 322
 			$ticket_name = sprintf(
323
-				_x( '%1$s for %2$s', 'ticket name for event name', 'event_espresso' ),
323
+				_x('%1$s for %2$s', 'ticket name for event name', 'event_espresso'),
324 324
 				$ticket->name(),
325 325
 				$event->name()
326 326
 			);
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
 	 * @param  int          $quantity
346 346
 	 * @return void
347 347
 	 */
348
-	public static function ticket_quantity_updated( EE_Line_Item $line_item, $quantity = 1 ) {
349
-		$ticket = EEM_Ticket::instance()->get_one_by_ID( absint( $line_item->OBJ_ID() ) );
350
-		if ( $ticket instanceof EE_Ticket ) {
351
-			if ( $quantity > 0 ) {
352
-				EED_Ticket_Sales_Monitor::instance()->_reserve_ticket( $ticket, $quantity );
348
+	public static function ticket_quantity_updated(EE_Line_Item $line_item, $quantity = 1) {
349
+		$ticket = EEM_Ticket::instance()->get_one_by_ID(absint($line_item->OBJ_ID()));
350
+		if ($ticket instanceof EE_Ticket) {
351
+			if ($quantity > 0) {
352
+				EED_Ticket_Sales_Monitor::instance()->_reserve_ticket($ticket, $quantity);
353 353
 			} else {
354
-				EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket( $ticket, $quantity );
354
+				EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket($ticket, $quantity);
355 355
 			}
356 356
 		}
357 357
 	}
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 	 * @param  int       $quantity
368 368
 	 * @return void
369 369
 	 */
370
-	public static function ticket_removed_from_cart( EE_Ticket $ticket, $quantity = 1 ) {
371
-		EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket( $ticket, $quantity );
370
+	public static function ticket_removed_from_cart(EE_Ticket $ticket, $quantity = 1) {
371
+		EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket($ticket, $quantity);
372 372
 	}
373 373
 
374 374
 
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
 	 * @return    void
397 397
 	 */
398 398
 	protected function _post_notices() {
399
-		if ( self::debug ) {
400
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
399
+		if (self::debug) {
400
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
401 401
 		}
402 402
         $refresh_msg = '';
403 403
         $none_added_msg = '';
@@ -406,35 +406,35 @@  discard block
 block discarded – undo
406 406
                 'event_espresso');
407 407
             $none_added_msg = __('No tickets were added for the event.', 'event_espresso');
408 408
         }
409
-		if ( ! empty( $this->sold_out_tickets ) ) {
409
+		if ( ! empty($this->sold_out_tickets)) {
410 410
 			EE_Error::add_attention(
411 411
 				sprintf(
412 412
 					apply_filters(
413 413
 						'FHEE__EED_Ticket_Sales_Monitor___post_notices__sold_out_tickets_notice',
414
-						__( 'We\'re sorry...%1$sThe following items have sold out since you first viewed this page, and can no longer be registered for:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%1$s%1$s%3$s%1$s%4$s%1$s', 'event_espresso' )
414
+						__('We\'re sorry...%1$sThe following items have sold out since you first viewed this page, and can no longer be registered for:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%1$s%1$s%3$s%1$s%4$s%1$s', 'event_espresso')
415 415
 					),
416 416
 					'<br />',
417
-					implode( '<br />', $this->sold_out_tickets ),
417
+					implode('<br />', $this->sold_out_tickets),
418 418
                     $none_added_msg,
419 419
                     $refresh_msg
420 420
 				)
421 421
 			);
422 422
 			// alter code flow in the Ticket Selector for better UX
423
-			add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', '__return_true' );
424
-			add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', '__return_false' );
423
+			add_filter('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', '__return_true');
424
+			add_filter('FHEE__EED_Ticket_Selector__process_ticket_selections__success', '__return_false');
425 425
 			$this->sold_out_tickets = array();
426 426
             // and reset the cart
427 427
             EED_Ticket_Sales_Monitor::session_cart_reset(EE_Registry::instance()->SSN);
428 428
 		}
429
-		if ( ! empty( $this->decremented_tickets ) ) {
429
+		if ( ! empty($this->decremented_tickets)) {
430 430
 			EE_Error::add_attention(
431 431
 				sprintf(
432 432
 					apply_filters(
433 433
 						'FHEE__EED_Ticket_Sales_Monitor___ticket_quantity_decremented__notice',
434
-						__( 'We\'re sorry...%1$sDue to sales that have occurred since you first viewed the last page, the following items have had their quantities adjusted to match the current available amount:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%1$s%1$s%3$s%1$s%4$s%1$s', 'event_espresso' )
434
+						__('We\'re sorry...%1$sDue to sales that have occurred since you first viewed the last page, the following items have had their quantities adjusted to match the current available amount:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%1$s%1$s%3$s%1$s%4$s%1$s', 'event_espresso')
435 435
 					),
436 436
 					'<br />',
437
-					implode( '<br />', $this->decremented_tickets ),
437
+					implode('<br />', $this->decremented_tickets),
438 438
                     $none_added_msg,
439 439
                     $refresh_msg
440 440
 				)
@@ -458,27 +458,27 @@  discard block
 block discarded – undo
458 458
 	 * @param 	EE_Transaction 	$transaction
459 459
 	 * @return int
460 460
 	 */
461
-	protected function _release_all_reserved_tickets_for_transaction( EE_Transaction $transaction ) {
462
-		if ( self::debug ) {
463
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
464
-			echo "<br /> . transaction->ID: " . $transaction->ID();
461
+	protected function _release_all_reserved_tickets_for_transaction(EE_Transaction $transaction) {
462
+		if (self::debug) {
463
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
464
+			echo "<br /> . transaction->ID: ".$transaction->ID();
465 465
 		}
466 466
 		/** @type EE_Transaction_Processor $transaction_processor */
467
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
467
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
468 468
 		// check if 'finalize_registration' step has been completed...
469
-		$finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' );
470
-		if ( self::debug ) {
469
+		$finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration');
470
+		if (self::debug) {
471 471
 			// DEBUG LOG
472 472
 			EEH_Debug_Tools::log(
473 473
 				__CLASS__, __FUNCTION__, __LINE__,
474
-				array( 'finalized' => $finalized ),
475
-				false, 'EE_Transaction: ' . $transaction->ID()
474
+				array('finalized' => $finalized),
475
+				false, 'EE_Transaction: '.$transaction->ID()
476 476
 			);
477 477
 		}
478 478
 		// how many tickets were released
479 479
 		$count = 0;
480
-		if ( self::debug ) {
481
-			echo "<br /> . . . finalized: " . $finalized;
480
+		if (self::debug) {
481
+			echo "<br /> . . . finalized: ".$finalized;
482 482
 		}
483 483
 		$release_tickets_with_TXN_status = array(
484 484
 			EEM_Transaction::failed_status_code,
@@ -486,13 +486,13 @@  discard block
 block discarded – undo
486 486
 			EEM_Transaction::incomplete_status_code,
487 487
 		);
488 488
 		// if the session is getting cleared BEFORE the TXN has been finalized
489
-		if ( ! $finalized || in_array( $transaction->status_ID(), $release_tickets_with_TXN_status ) ) {
489
+		if ( ! $finalized || in_array($transaction->status_ID(), $release_tickets_with_TXN_status)) {
490 490
 			// let's cancel any reserved tickets
491 491
 			$registrations = $transaction->registrations();
492
-			if ( ! empty( $registrations ) ) {
493
-				foreach ( $registrations as $registration ) {
494
-					if ( $registration instanceof EE_Registration ) {
495
-						$count += $this->_release_reserved_ticket_for_registration( $registration, $transaction );
492
+			if ( ! empty($registrations)) {
493
+				foreach ($registrations as $registration) {
494
+					if ($registration instanceof EE_Registration) {
495
+						$count += $this->_release_reserved_ticket_for_registration($registration, $transaction);
496 496
 					}
497 497
 				}
498 498
 			}
@@ -513,12 +513,12 @@  discard block
 block discarded – undo
513 513
 	 * @return 	int
514 514
 	 * @throws 	\EE_Error
515 515
 	 */
516
-	protected function _release_reserved_ticket_for_registration( EE_Registration $registration, EE_Transaction $transaction ) {
517
-		if ( self::debug ) {
518
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
519
-			echo "<br /> . . registration->ID: " . $registration->ID();
520
-			echo "<br /> . . registration->status_ID: " . $registration->status_ID();
521
-			echo "<br /> . . transaction->status_ID(): " . $transaction->status_ID();
516
+	protected function _release_reserved_ticket_for_registration(EE_Registration $registration, EE_Transaction $transaction) {
517
+		if (self::debug) {
518
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
519
+			echo "<br /> . . registration->ID: ".$registration->ID();
520
+			echo "<br /> . . registration->status_ID: ".$registration->status_ID();
521
+			echo "<br /> . . transaction->status_ID(): ".$transaction->status_ID();
522 522
 		}
523 523
 		if (
524 524
 			// release Tickets for Failed Transactions and Abandoned Transactions
@@ -531,8 +531,8 @@  discard block
 block discarded – undo
531 531
 			)
532 532
 		) {
533 533
 			$ticket = $registration->ticket();
534
-			if ( $ticket instanceof EE_Ticket ) {
535
-				return $this->_release_reserved_ticket( $ticket );
534
+			if ($ticket instanceof EE_Ticket) {
535
+				return $this->_release_reserved_ticket($ticket);
536 536
 			}
537 537
 		}
538 538
 		return 0;
@@ -552,20 +552,20 @@  discard block
 block discarded – undo
552 552
 	 * @param    EE_Session $session
553 553
 	 * @return    void
554 554
 	 */
555
-	public static function session_cart_reset( EE_Session $session ) {
556
-		if ( self::debug ) {
557
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
555
+	public static function session_cart_reset(EE_Session $session) {
556
+		if (self::debug) {
557
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
558 558
 		}
559 559
 		$cart = $session->cart();
560
-		if ( $cart instanceof EE_Cart ) {
561
-			if ( self::debug ) {
560
+		if ($cart instanceof EE_Cart) {
561
+			if (self::debug) {
562 562
 				echo "<br /><br /> cart instanceof EE_Cart: ";
563 563
 			}
564
-			EED_Ticket_Sales_Monitor::instance()->_session_cart_reset( $cart );
564
+			EED_Ticket_Sales_Monitor::instance()->_session_cart_reset($cart);
565 565
 		} else {
566
-			if ( self::debug ) {
566
+			if (self::debug) {
567 567
 				echo "<br /><br /> invalid EE_Cart: ";
568
-				var_dump( $cart );
568
+				var_dump($cart);
569 569
 			}
570 570
 		}
571 571
 	}
@@ -580,30 +580,30 @@  discard block
 block discarded – undo
580 580
 	 * @param    EE_Cart $cart
581 581
 	 * @return    void
582 582
 	 */
583
-	protected function _session_cart_reset( EE_Cart $cart ) {
584
-		if ( self::debug ) {
585
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
583
+	protected function _session_cart_reset(EE_Cart $cart) {
584
+		if (self::debug) {
585
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
586 586
 		}
587
-		EE_Registry::instance()->load_helper( 'Line_Item' );
587
+		EE_Registry::instance()->load_helper('Line_Item');
588 588
 		$ticket_line_items = $cart->get_tickets();
589
-		if ( empty( $ticket_line_items ) ) {
589
+		if (empty($ticket_line_items)) {
590 590
 			return;
591 591
 		}
592
-		foreach ( $ticket_line_items as $ticket_line_item ) {
593
-			if ( self::debug ) {
594
-				echo "<br /> . ticket_line_item->ID(): " . $ticket_line_item->ID();
592
+		foreach ($ticket_line_items as $ticket_line_item) {
593
+			if (self::debug) {
594
+				echo "<br /> . ticket_line_item->ID(): ".$ticket_line_item->ID();
595 595
 			}
596
-			if ( $ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_type() == 'Ticket' ) {
597
-				if ( self::debug ) {
598
-					echo "<br /> . . ticket_line_item->OBJ_ID(): " . $ticket_line_item->OBJ_ID();
596
+			if ($ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_type() == 'Ticket') {
597
+				if (self::debug) {
598
+					echo "<br /> . . ticket_line_item->OBJ_ID(): ".$ticket_line_item->OBJ_ID();
599 599
 				}
600
-				$ticket = EEM_Ticket::instance()->get_one_by_ID( $ticket_line_item->OBJ_ID() );
601
-				if ( $ticket instanceof EE_Ticket ) {
602
-					if ( self::debug ) {
603
-						echo "<br /> . . ticket->ID(): " . $ticket->ID();
604
-						echo "<br /> . . ticket_line_item->quantity(): " . $ticket_line_item->quantity();
600
+				$ticket = EEM_Ticket::instance()->get_one_by_ID($ticket_line_item->OBJ_ID());
601
+				if ($ticket instanceof EE_Ticket) {
602
+					if (self::debug) {
603
+						echo "<br /> . . ticket->ID(): ".$ticket->ID();
604
+						echo "<br /> . . ticket_line_item->quantity(): ".$ticket_line_item->quantity();
605 605
 					}
606
-					$this->_release_reserved_ticket( $ticket, $ticket_line_item->quantity() );
606
+					$this->_release_reserved_ticket($ticket, $ticket_line_item->quantity());
607 607
 				}
608 608
 			}
609 609
 		}
@@ -627,10 +627,10 @@  discard block
 block discarded – undo
627 627
 	 * @param    EE_Session $session
628 628
 	 * @return    void
629 629
 	 */
630
-	public static function session_checkout_reset( EE_Session $session ) {
630
+	public static function session_checkout_reset(EE_Session $session) {
631 631
 		$checkout = $session->checkout();
632
-		if ( $checkout instanceof EE_Checkout ) {
633
-			EED_Ticket_Sales_Monitor::instance()->_session_checkout_reset( $checkout );
632
+		if ($checkout instanceof EE_Checkout) {
633
+			EED_Ticket_Sales_Monitor::instance()->_session_checkout_reset($checkout);
634 634
 		}
635 635
 	}
636 636
 
@@ -644,15 +644,15 @@  discard block
 block discarded – undo
644 644
 	 * @param    EE_Checkout $checkout
645 645
 	 * @return    void
646 646
 	 */
647
-	protected function _session_checkout_reset( EE_Checkout $checkout ) {
648
-		if ( self::debug ) {
649
-			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "() ";
647
+	protected function _session_checkout_reset(EE_Checkout $checkout) {
648
+		if (self::debug) {
649
+			echo "<br /><br /> ".__LINE__.") ".__METHOD__."() ";
650 650
 		}
651 651
 		// we want to release the each registration's reserved tickets if the session was cleared, but not if this is a revisit
652
-		if ( $checkout->revisit || ! $checkout->transaction instanceof EE_Transaction ) {
652
+		if ($checkout->revisit || ! $checkout->transaction instanceof EE_Transaction) {
653 653
 			return;
654 654
 		}
655
-		$this->_release_all_reserved_tickets_for_transaction( $checkout->transaction );
655
+		$this->_release_all_reserved_tickets_for_transaction($checkout->transaction);
656 656
 	}
657 657
 
658 658
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 	 * @param    EE_Session $session
669 669
 	 * @return    void
670 670
 	 */
671
-	public static function session_expired_reset( EE_Session $session ) {
671
+	public static function session_expired_reset(EE_Session $session) {
672 672
 
673 673
 	}
674 674
 
@@ -687,30 +687,30 @@  discard block
 block discarded – undo
687 687
 	 * @param    EE_Transaction $transaction
688 688
 	 * @return    void
689 689
 	 */
690
-	public static function process_abandoned_transactions( EE_Transaction $transaction ) {
690
+	public static function process_abandoned_transactions(EE_Transaction $transaction) {
691 691
 		// is this TXN free or has any money been paid towards this TXN? If so, then leave it alone
692
-		if ( $transaction->is_free() || $transaction->paid() > 0 ) {
693
-			if ( self::debug ) {
692
+		if ($transaction->is_free() || $transaction->paid() > 0) {
693
+			if (self::debug) {
694 694
 				// DEBUG LOG
695 695
 				EEH_Debug_Tools::log(
696 696
 					__CLASS__, __FUNCTION__, __LINE__,
697
-					array( $transaction ),
698
-					false, 'EE_Transaction: ' . $transaction->ID()
697
+					array($transaction),
698
+					false, 'EE_Transaction: '.$transaction->ID()
699 699
 				);
700 700
 			}
701 701
 			return;
702 702
 		}
703 703
 		// have their been any successful payments made ?
704 704
 		$payments = $transaction->payments();
705
-		foreach ( $payments as $payment ) {
706
-			if ( $payment instanceof EE_Payment ) {
707
-				if ( $payment->status() === EEM_Payment::status_id_approved ) {
708
-					if ( self::debug ) {
705
+		foreach ($payments as $payment) {
706
+			if ($payment instanceof EE_Payment) {
707
+				if ($payment->status() === EEM_Payment::status_id_approved) {
708
+					if (self::debug) {
709 709
 						// DEBUG LOG
710 710
 						EEH_Debug_Tools::log(
711 711
 							__CLASS__, __FUNCTION__, __LINE__,
712
-							array( $payment ),
713
-							false, 'EE_Transaction: ' . $transaction->ID()
712
+							array($payment),
713
+							false, 'EE_Transaction: '.$transaction->ID()
714 714
 						);
715 715
 					}
716 716
 					return;
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 			}
719 719
 		}
720 720
 		// since you haven't even attempted to pay for your ticket...
721
-		EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction( $transaction );
721
+		EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction($transaction);
722 722
 	}
723 723
 
724 724
 
@@ -735,9 +735,9 @@  discard block
 block discarded – undo
735 735
 	 * @param    EE_Transaction $transaction
736 736
 	 * @return    void
737 737
 	 */
738
-	public static function process_failed_transactions( EE_Transaction $transaction ) {
738
+	public static function process_failed_transactions(EE_Transaction $transaction) {
739 739
 		// since you haven't even attempted to pay for your ticket...
740
-		EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction( $transaction );
740
+		EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction($transaction);
741 741
 	}
742 742
 
743 743
 
Please login to merge, or discard this patch.
caffeinated/modules/recaptcha/ReCaptcha/RequestMethod.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@
 block discarded – undo
32 32
 interface RequestMethod
33 33
 {
34 34
 
35
-    /**
36
-     * Submit the request with the specified parameters.
37
-     *
38
-     * @param RequestParameters $params Request parameters
39
-     * @return string Body of the reCAPTCHA response
40
-     */
41
-    public function submit(RequestParameters $params);
35
+	/**
36
+	 * Submit the request with the specified parameters.
37
+	 *
38
+	 * @param RequestParameters $params Request parameters
39
+	 * @return string Body of the reCAPTCHA response
40
+	 */
41
+	public function submit(RequestParameters $params);
42 42
 }
Please login to merge, or discard this patch.