Completed
Branch BUG-10434-reg-cancel-shortcode... (f76056)
by
unknown
14:04
created
core/db_classes/EE_Extra_Join.class.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	 * @param null  $timezone
23 23
 	 * @return EE_Event_Message_Template|mixed
24 24
 	 */
25
-	public static function new_instance( $props_n_values = array(), $timezone = NULL ) {
26
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone );
27
-		return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone );
25
+	public static function new_instance($props_n_values = array(), $timezone = NULL) {
26
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone);
27
+		return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone);
28 28
 	}
29 29
 
30 30
 
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	 * @param null  $timezone
35 35
 	 * @return EE_Event_Message_Template
36 36
 	 */
37
-	public static function new_instance_from_db ( $props_n_values = array(), $timezone = NULL ) {
38
-		return new self( $props_n_values, TRUE, $timezone );
37
+	public static function new_instance_from_db($props_n_values = array(), $timezone = NULL) {
38
+		return new self($props_n_values, TRUE, $timezone);
39 39
 	}
40 40
 
41 41
 }
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.
strategies/validation/EE_Max_Length_Validation_Strategy.strategy.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,36 +8,36 @@
 block discarded – undo
8 8
  * @subpackage	Expression package is undefined on line 19, column 19 in Templates/Scripting/PHPClass.php.
9 9
  * @author				Mike Nelson
10 10
  */
11
-class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base{
11
+class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base {
12 12
 
13 13
 	protected $_max_length;
14 14
 
15
-	public function __construct( $validation_error_message = NULL, $max_length = EE_INF ) {
15
+	public function __construct($validation_error_message = NULL, $max_length = EE_INF) {
16 16
 		$this->_max_length = $max_length;
17
-		if( $validation_error_message === null ) {
18
-			$validation_error_message = sprintf( __( 'Input is too long. Maximum number of characters is %1$s', 'event_espresso' ), $max_length );
17
+		if ($validation_error_message === null) {
18
+			$validation_error_message = sprintf(__('Input is too long. Maximum number of characters is %1$s', 'event_espresso'), $max_length);
19 19
 		}
20
-		parent::__construct( $validation_error_message );
20
+		parent::__construct($validation_error_message);
21 21
 	}
22 22
 
23 23
 	/**
24 24
 	 * @param $normalized_value
25 25
 	 */
26 26
 	public function validate($normalized_value) {
27
-		if( $this->_max_length !== EE_INF &&
27
+		if ($this->_max_length !== EE_INF &&
28 28
 				$normalized_value &&
29
-				is_string( $normalized_value ) &&
30
-				 strlen( $normalized_value ) > $this->_max_length){
31
-			throw new EE_Validation_Error( $this->get_validation_error_message(), 'maxlength' );
29
+				is_string($normalized_value) &&
30
+				 strlen($normalized_value) > $this->_max_length) {
31
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'maxlength');
32 32
 		}
33 33
 	}
34 34
 
35 35
 	/**
36 36
 	 * @return array
37 37
 	 */
38
-	function get_jquery_validation_rule_array(){
39
-		if( $this->_max_length !== EE_INF ) {
40
-			return array( 'maxlength'=> $this->_max_length, 'messages' => array( 'maxlength' => $this->get_validation_error_message() ) );
38
+	function get_jquery_validation_rule_array() {
39
+		if ($this->_max_length !== EE_INF) {
40
+			return array('maxlength'=> $this->_max_length, 'messages' => array('maxlength' => $this->get_validation_error_message()));
41 41
 		} else {
42 42
 			return array();
43 43
 		}
Please login to merge, or discard this patch.
core/db_models/EEM_Extra_Join.model.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,26 +21,26 @@
 block discarded – undo
21 21
  * @since		 	   $VID:$
22 22
  *
23 23
  */
24
-if (!defined('EVENT_ESPRESSO_VERSION')) {
24
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
25 25
 	exit('No direct script access allowed');
26 26
 }
27 27
 
28
-class EEM_Extra_Join extends EEM_Base{
28
+class EEM_Extra_Join extends EEM_Base {
29 29
 	// private instance of the Extra Join object
30 30
 	protected static $_instance = NULL;
31 31
 	
32 32
 	public function __construct($timezone = NULL) {
33
-		$models_this_can_join = array_keys( EE_Registry::instance()->non_abstract_db_models );
33
+		$models_this_can_join = array_keys(EE_Registry::instance()->non_abstract_db_models);
34 34
 		$this->_tables = array(
35
-			'Extra_Join' => new EE_Primary_Table( 'esp_extra_join', 'EXJ_ID' ),
35
+			'Extra_Join' => new EE_Primary_Table('esp_extra_join', 'EXJ_ID'),
36 36
 		);
37 37
 		$this->_fields = array(
38 38
 			'Extra_Join' => array(
39
-				'EXJ_ID' => new EE_Primary_Key_Int_Field( 'EXJ_ID', __( 'Extra Join ID', 'event_espresso' ) ),
40
-				'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_first_model_ID', __( 'First Model ID', 'event_espresso' ), true, 0, $models_this_can_join ),
41
-				'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_first_model_name', __( 'First Model Name', 'event_espresso'), true, '', $models_this_can_join ),
42
-				'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_second_model_ID', __( 'Second Model ID', 'event_espresso' ), true, 0, $models_this_can_join ),
43
-				'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_second_model_name', __( 'Second Model Name', 'event_espresso'), true, '', $models_this_can_join ),
39
+				'EXJ_ID' => new EE_Primary_Key_Int_Field('EXJ_ID', __('Extra Join ID', 'event_espresso')),
40
+				'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field('EXJ_first_model_ID', __('First Model ID', 'event_espresso'), true, 0, $models_this_can_join),
41
+				'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_first_model_name', __('First Model Name', 'event_espresso'), true, '', $models_this_can_join),
42
+				'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field('EXJ_second_model_ID', __('Second Model ID', 'event_espresso'), true, 0, $models_this_can_join),
43
+				'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_second_model_name', __('Second Model Name', 'event_espresso'), true, '', $models_this_can_join),
44 44
 				
45 45
 			)
46 46
 		);
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/config/Read.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		//so in case teh IPN is arriving later, let's try to process an IPN!
91 91
 		if($_SERVER['REQUEST_METHOD'] == 'POST'){
92 92
 			return $this->handle_ipn($_POST, $transaction );
93
-		}else{
93
+		} else{
94 94
 			return parent::finalize_payment_for( $transaction );
95 95
 		}
96 96
 	}
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\rest_api\controllers\config;
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
 /**
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 	 * @param \WP_REST_Request $request
22 22
 	 * @return \EE_Config|\WP_Error
23 23
 	 */
24
-	public static function handle_request( \WP_REST_Request $request) {
24
+	public static function handle_request(\WP_REST_Request $request) {
25 25
 		$cap = \EE_Restriction_Generator_Base::get_default_restrictions_cap();
26
-		if( \EE_Capabilities::instance()->current_user_can( $cap, 'read_over_api' ) ){
26
+		if (\EE_Capabilities::instance()->current_user_can($cap, 'read_over_api')) {
27 27
 			return \EE_Config::instance();
28
-		}else{
28
+		} else {
29 29
 			return new \WP_Error(
30 30
 				'cannot_read_config',
31 31
 				sprintf(
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 					),
36 36
 					$cap
37 37
 				),
38
-				array( 'status' => 403 )
38
+				array('status' => 403)
39 39
 			);
40 40
 		}
41 41
 	}
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 	 * @param \WP_REST_Request $request
46 46
 	 * @return \EE_Config|\WP_Error
47 47
 	 */
48
-	public static function handle_request_site_info( \WP_REST_Request $request) {
48
+	public static function handle_request_site_info(\WP_REST_Request $request) {
49 49
 		return array(
50 50
 			'default_timezone' => array(
51 51
 				'pretty' => \EEH_DTT_Helper::get_timezone_string_for_display(),
52
-				'string' => get_option( 'timezone_string' ),
52
+				'string' => get_option('timezone_string'),
53 53
 				'offset' => \EEH_DTT_Helper::get_site_timezone_gmt_offset(),
54 54
 			),
55 55
 			'default_currency' => \EE_Config::instance()->currency
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/model/Base.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 	protected $_model_version_info;
27 27
 
28 28
 /**
29
-	 * Sets the version the user requested
30
-	 * @param string $version eg '4.8'
31
-	 */
29
+ * Sets the version the user requested
30
+ * @param string $version eg '4.8'
31
+ */
32 32
 	public function set_requested_version( $version ) {
33 33
 		parent::set_requested_version( $version );
34 34
 		$this->_model_version_info = new Model_Version_Info( $version );
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 use EventEspresso\core\libraries\rest_api\controllers\Base as Controller_Base;
4 4
 use EventEspresso\core\libraries\rest_api\Model_Version_Info;
5 5
 
6
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-	exit( 'No direct script access allowed' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 /**
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	 * Sets the version the user requested
30 30
 	 * @param string $version eg '4.8'
31 31
 	 */
32
-	public function set_requested_version( $version ) {
33
-		parent::set_requested_version( $version );
34
-		$this->_model_version_info = new Model_Version_Info( $version );
32
+	public function set_requested_version($version) {
33
+		parent::set_requested_version($version);
34
+		$this->_model_version_info = new Model_Version_Info($version);
35 35
 	}
36 36
 
37 37
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @return \EventEspresso\core\libraries\rest_api\Model_Version_Info
44 44
 	 * @throws \EE_Error
45 45
 	 */
46
-	public function get_model_version_info(){
47
-		if( ! $this->_model_version_info ) {
46
+	public function get_model_version_info() {
47
+		if ( ! $this->_model_version_info) {
48 48
 			throw new \EE_Error(
49 49
 				sprintf(
50 50
 					__(
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @param array $classnames
67 67
 	 * @return boolean
68 68
 	 */
69
-	public function is_subclass_of_one( $object, $classnames ) {
70
-		foreach( $classnames as $classname ) {
71
-			if( is_a( $object, $classname ) ) {
69
+	public function is_subclass_of_one($object, $classnames) {
70
+		foreach ($classnames as $classname) {
71
+			if (is_a($object, $classname)) {
72 72
 				return true;
73 73
 			}
74 74
 		}
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/Base.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		//so in case teh IPN is arriving later, let's try to process an IPN!
91 91
 		if($_SERVER['REQUEST_METHOD'] == 'POST'){
92 92
 			return $this->handle_ipn($_POST, $transaction );
93
-		}else{
93
+		} else{
94 94
 			return parent::finalize_payment_for( $transaction );
95 95
 		}
96 96
 	}
Please login to merge, or discard this patch.
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.
core/libraries/rest_api/Model_Version_Info.php 3 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 				$validation_error_message = $default_validation_strategy->get_validation_error_message();
43 43
 			}
44 44
 			throw new EE_Validation_Error( $validation_error_message, 'float_only' );
45
-		}else{
45
+		} else{
46 46
 			return floatval($normalized_value);
47 47
 		}
48 48
 	}
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	public function unnormalize($normalized_value) {
56 56
 		if( empty( $normalized_value ) ){
57 57
 			return '0.00';
58
-		}else{
58
+		} else{
59 59
 			return "$normalized_value";
60 60
 		}
61 61
 	}
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 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;
3 3
 
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
 /**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      *
95 95
      * @param array $requested_version
96 96
      */
97
-    public function __construct( $requested_version ) {
97
+    public function __construct($requested_version) {
98 98
 		$this->_requested_version = $requested_version;
99 99
 		$this->_model_changes = array(
100 100
 			'4.8.29' => array(
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
 			'table_column' => 'N/A',
117 117
 			'always_available' => true,
118 118
 		);
119
-		foreach( $this->_resource_changes as $version => $model_classnames ) {
120
-			foreach( $model_classnames as $model_classname => $extra_fields ) {
121
-				foreach( $extra_fields as $fieldname => $field_data ) {
122
-					$this->_resource_changes[ $model_classname ][ $fieldname ][ 'name' ] = $fieldname;
123
-					foreach( $defaults as $attribute => $default_value ) {
124
-						if( ! isset( $this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] ) ) {
125
-							$this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] = $default_value;
119
+		foreach ($this->_resource_changes as $version => $model_classnames) {
120
+			foreach ($model_classnames as $model_classname => $extra_fields) {
121
+				foreach ($extra_fields as $fieldname => $field_data) {
122
+					$this->_resource_changes[$model_classname][$fieldname]['name'] = $fieldname;
123
+					foreach ($defaults as $attribute => $default_value) {
124
+						if ( ! isset($this->_resource_changes[$model_classname][$fieldname][$attribute])) {
125
+							$this->_resource_changes[$model_classname][$fieldname][$attribute] = $default_value;
126 126
 						}
127 127
 					}
128 128
 				}
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 	 * @return array
139 139
 	 */
140 140
 	public function model_changes_between_requested_version_and_current() {
141
-		if( $this->_cached_model_changes_between_requested_version_and_current === null ) {
141
+		if ($this->_cached_model_changes_between_requested_version_and_current === null) {
142 142
 			$model_changes = array();
143
-			foreach( $this->model_changes() as $version => $models_changed_in_version ) {
144
-				if( $version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version() ) {
145
-					$model_changes[ $version ] = $models_changed_in_version;
143
+			foreach ($this->model_changes() as $version => $models_changed_in_version) {
144
+				if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) {
145
+					$model_changes[$version] = $models_changed_in_version;
146 146
 				}
147 147
 			}
148 148
 			$this->_cached_model_changes_between_requested_version_and_current = $model_changes;
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 	 * @return array
159 159
 	 */
160 160
 	public function resource_changes_between_requested_version_and_current() {
161
-		if( $this->_cached_resource_changes_between_requested_version_and_current === null ) {
161
+		if ($this->_cached_resource_changes_between_requested_version_and_current === null) {
162 162
 			$resource_changes = array();
163
-			foreach( $this->resource_changes() as $version => $model_classnames ) {
164
-				if( $version <= \EED_Core_Rest_Api::core_version()  && $version > $this->requested_version()  ) {
165
-					$resource_changes[ $version ] = $model_classnames;
163
+			foreach ($this->resource_changes() as $version => $model_classnames) {
164
+				if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) {
165
+					$resource_changes[$version] = $model_classnames;
166 166
 				}
167 167
 			}
168 168
 			$this->_cached_resource_changes_between_requested_version_and_current = $resource_changes;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * If a request was sent to 'wp-json/ee/v4.7/events' this would be '4.7'
175 175
 	 * @return string like '4.6'
176 176
 	 */
177
-	public function requested_version(){
177
+	public function requested_version() {
178 178
 		return $this->_requested_version;
179 179
 	}
180 180
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 * If a version is missing then we don't know anything about what changes it introduced from the previous version
189 189
 	 * @return array
190 190
 	 */
191
-	public function model_changes(){
191
+	public function model_changes() {
192 192
 		return $this->_model_changes;
193 193
 	}
194 194
 
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 	 * @return array keys are model names, values are their classname
200 200
 	 */
201 201
 	public function models_for_requested_version() {
202
-		if( $this->_cached_models_for_requested_version === null ) {
202
+		if ($this->_cached_models_for_requested_version === null) {
203 203
 			$all_models_in_current_version = \EE_Registry::instance()->non_abstract_db_models;
204
-			foreach( $this->model_changes_between_requested_version_and_current() as $version => $models_changed ) {
205
-				foreach( $models_changed as $model_name => $new_indicator_or_fields_added ) {
206
-					if( $new_indicator_or_fields_added === Model_Version_Info::model_added ) {
207
-						unset( $all_models_in_current_version[ $model_name ] );
204
+			foreach ($this->model_changes_between_requested_version_and_current() as $version => $models_changed) {
205
+				foreach ($models_changed as $model_name => $new_indicator_or_fields_added) {
206
+					if ($new_indicator_or_fields_added === Model_Version_Info::model_added) {
207
+						unset($all_models_in_current_version[$model_name]);
208 208
 					}
209 209
 				}
210 210
 			}
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 	 * @param string $model_name eg 'Event'
228 228
 	 * @return boolean
229 229
 	 */
230
-	public function is_model_name_in_this_version( $model_name ) {
230
+	public function is_model_name_in_this_version($model_name) {
231 231
 		$model_names = $this->models_for_requested_version();
232
-		if( isset( $model_names[ $model_name ] ) ) {
232
+		if (isset($model_names[$model_name])) {
233 233
 			return true;
234
-		}else{
234
+		} else {
235 235
 			return false;
236 236
 		}
237 237
 	}
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
 	 * @return \EEM_Base
247 247
 	 * @throws \EE_Error
248 248
 	 */
249
-	public function load_model( $model_name ) {
250
-		if( $this->is_model_name_in_this_version( $model_name ) ) {
251
-			return \EE_Registry::instance()->load_model( $model_name );
252
-		}else{
249
+	public function load_model($model_name) {
250
+		if ($this->is_model_name_in_this_version($model_name)) {
251
+			return \EE_Registry::instance()->load_model($model_name);
252
+		} else {
253 253
 			throw new \EE_Error(
254 254
 				sprintf(
255 255
 					__(
@@ -271,21 +271,21 @@  discard block
 block discarded – undo
271 271
 	 * @param \EEM_Base $model
272 272
 	 * @return array|\EE_Model_Field_Base[]
273 273
 	 */
274
-	public function fields_on_model_in_this_version( $model ) {
275
-		if( ! isset( $this->_cached_fields_on_models[ $model->get_this_model_name() ] ) ) {
274
+	public function fields_on_model_in_this_version($model) {
275
+		if ( ! isset($this->_cached_fields_on_models[$model->get_this_model_name()])) {
276 276
 			//get all model changes between the requested version and current core version
277 277
 			$changes = $this->model_changes_between_requested_version_and_current();
278 278
 			//fetch all fields currently on this model
279 279
 			$current_fields = $model->field_settings();
280 280
 			//remove all fields that have been added since
281
-			foreach( $changes as $version => $changes_in_version ) {
282
-				if(
283
-					isset( $changes_in_version[ $model->get_this_model_name() ] )
284
-					&& $changes_in_version[ $model->get_this_model_name() ] !== Model_Version_Info::model_added
281
+			foreach ($changes as $version => $changes_in_version) {
282
+				if (
283
+					isset($changes_in_version[$model->get_this_model_name()])
284
+					&& $changes_in_version[$model->get_this_model_name()] !== Model_Version_Info::model_added
285 285
 				) {
286 286
 					$current_fields = array_diff_key(
287 287
 						$current_fields,
288
-						array_flip( $changes_in_version[ $model->get_this_model_name() ] )
288
+						array_flip($changes_in_version[$model->get_this_model_name()])
289 289
 					);
290 290
 				}
291 291
 			}
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 	 * @param array $classnames
304 304
 	 * @return boolean
305 305
 	 */
306
-	public function is_subclass_of_one( $object, $classnames ) {
307
-		foreach( $classnames as $classname ) {
308
-			if( is_a( $object, $classname ) ) {
306
+	public function is_subclass_of_one($object, $classnames) {
307
+		foreach ($classnames as $classname) {
308
+			if (is_a($object, $classname)) {
309 309
 				return true;
310 310
 			}
311 311
 		}
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 	 * Returns the list of model field classes that that the API basically ignores
317 317
 	 * @return array
318 318
 	 */
319
-	public function fields_ignored(){
319
+	public function fields_ignored() {
320 320
 		return apply_filters(
321 321
 			'FHEE__Controller_Model_Read_fields_ignored',
322
-			array( 'EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field' )
322
+			array('EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field')
323 323
 		);
324 324
 	}
325 325
 
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 	 * @param EE_Model_Field_Base
329 329
 	 * @return boolean
330 330
 	 */
331
-	public function field_is_ignored( $field_obj ){
332
-		 return $this->is_subclass_of_one( $field_obj, $this->fields_ignored() );
331
+	public function field_is_ignored($field_obj) {
332
+		 return $this->is_subclass_of_one($field_obj, $this->fields_ignored());
333 333
 	}
334 334
 
335 335
 	/**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	public function fields_that_have_rendered_format() {
341 341
 		return apply_filters(
342 342
 			'FHEE__Controller_Model_Read__fields_raw',
343
-			array( 'EE_Post_Content_Field', 'EE_Full_HTML_Field' )
343
+			array('EE_Post_Content_Field', 'EE_Full_HTML_Field')
344 344
 		);
345 345
 	}
346 346
 
@@ -349,8 +349,8 @@  discard block
 block discarded – undo
349 349
 	 * @param EE_Model_Field_Base
350 350
 	 * @return boolean
351 351
 	 */
352
-	public function field_has_rendered_format( $field_obj ){
353
-		 return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_rendered_format() );
352
+	public function field_has_rendered_format($field_obj) {
353
+		 return $this->is_subclass_of_one($field_obj, $this->fields_that_have_rendered_format());
354 354
 	}
355 355
 
356 356
 	/**
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 	public function fields_that_have_pretty_format() {
363 363
 		return apply_filters(
364 364
 			'FHEE__Controller_Model_Read__fields_pretty',
365
-			array( 'EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field' )
365
+			array('EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field')
366 366
 		);
367 367
 	}
368 368
 
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 	 * @param EE_Model_Field_Base
372 372
 	 * @return boolean
373 373
 	 */
374
-	public function field_has_pretty_format( $field_obj ){
375
-		 return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_pretty_format() );
374
+	public function field_has_pretty_format($field_obj) {
375
+		 return $this->is_subclass_of_one($field_obj, $this->fields_that_have_pretty_format());
376 376
 	}
377 377
 
378 378
 	/**
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 	 * @param \EEM_Base $model
390 390
 	 * @return array
391 391
 	 */
392
-	public function extra_resource_properties_for_model( $model ) {
392
+	public function extra_resource_properties_for_model($model) {
393 393
 		$extra_properties = array();
394
-		foreach( $this->resource_changes_between_requested_version_and_current() as $version => $model_classnames ) {
395
-			foreach( $model_classnames as $model_classname => $properties_added_in_this_version ) {
396
-				if( is_subclass_of( $model, $model_classname ) ) {
397
-					$extra_properties = array_merge( $extra_properties, $properties_added_in_this_version );
394
+		foreach ($this->resource_changes_between_requested_version_and_current() as $version => $model_classnames) {
395
+			foreach ($model_classnames as $model_classname => $properties_added_in_this_version) {
396
+				if (is_subclass_of($model, $model_classname)) {
397
+					$extra_properties = array_merge($extra_properties, $properties_added_in_this_version);
398 398
 				}
399 399
 			}
400 400
 		}
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
 	 * @param \EEM_Base $model
408 408
 	 * @return \EE_Model_Relation_Base[]
409 409
 	 */
410
-	public function relation_settings( \EEM_Base $model ) {
410
+	public function relation_settings(\EEM_Base $model) {
411 411
 		$relations = array();
412
-		foreach( $model->relation_settings() as $relation_name => $relation_obj ) {
413
-			if( $this->is_model_name_in_this_version(  $relation_name ) ) {
414
-				$relations[ $relation_name ] = $relation_obj;
412
+		foreach ($model->relation_settings() as $relation_name => $relation_obj) {
413
+			if ($this->is_model_name_in_this_version($relation_name)) {
414
+				$relations[$relation_name] = $relation_obj;
415 415
 			}
416 416
 		}
417 417
 		//filter the results, but use the old filter name
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 
90 90
 
91 91
 
92
-    /**
93
-     * Model_Version_Info constructor.
94
-     *
95
-     * @param string $requested_version
96
-     */
97
-    public function __construct( $requested_version ) {
92
+	/**
93
+	 * Model_Version_Info constructor.
94
+	 *
95
+	 * @param string $requested_version
96
+	 */
97
+	public function __construct( $requested_version ) {
98 98
 		$this->_requested_version = $requested_version;
99 99
 		$this->_model_changes = array(
100 100
 			'4.8.29' => array(
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 				}
210 210
 			}
211 211
 			$this->_cached_models_for_requested_version = apply_filters(
212
-			    'FHEE__EventEspresso_core_libraries_rest_api__models_for_requested_version',
213
-                $all_models_in_current_version,
214
-                $this
215
-            );
212
+				'FHEE__EventEspresso_core_libraries_rest_api__models_for_requested_version',
213
+				$all_models_in_current_version,
214
+				$this
215
+			);
216 216
 		}
217 217
 		return $this->_cached_models_for_requested_version;
218 218
 	}
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/model/Meta.php 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@
 block discarded – undo
44 44
 
45 45
 				if( $field_obj instanceof \EE_Boolean_Field ) {
46 46
 					$datatype = 'Boolean';
47
-				}elseif( $field_obj->get_wpdb_data_type() == '%d' ) {
47
+				} elseif( $field_obj->get_wpdb_data_type() == '%d' ) {
48 48
 					$datatype = 'Number';
49
-				}elseif( $field_name instanceof \EE_Serialized_Text_Field ) {
49
+				} elseif( $field_name instanceof \EE_Serialized_Text_Field ) {
50 50
 					$datatype = 'Object';
51
-				}else{
51
+				} else{
52 52
 					$datatype = 'String';
53 53
 				}
54 54
 				$field_json = array(
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 
4 4
 use EventEspresso\core\libraries\rest_api\Model_Data_Translator;
5 5
 
6
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-	exit( 'No direct script access allowed' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 /**
@@ -25,20 +25,20 @@  discard block
 block discarded – undo
25 25
 	 * @param \WP_REST_Request $request
26 26
 	 * @return array|\WP_REST_Response
27 27
 	 */
28
-	public static function handle_request_models_meta( \WP_REST_Request $request ) {
28
+	public static function handle_request_models_meta(\WP_REST_Request $request) {
29 29
 		$controller = new Meta();
30
-		try{
30
+		try {
31 31
 			$matches = $controller->parse_route(
32 32
 				$request->get_route(),
33
-				'~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . 'resources~',
34
-				array( 'version' ) );
35
-			if( $matches instanceof \WP_REST_Response ) {
33
+				'~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'resources~',
34
+				array('version') );
35
+			if ($matches instanceof \WP_REST_Response) {
36 36
 				return $matches;
37 37
 			}
38
-			$controller->set_requested_version( $matches[ 'version' ] );
39
-			return $controller->send_response( $controller->_get_models_metadata_entity() );
40
-		} catch( \Exception $e ) {
41
-			return $controller->send_response( $e );
38
+			$controller->set_requested_version($matches['version']);
39
+			return $controller->send_response($controller->_get_models_metadata_entity());
40
+		} catch (\Exception $e) {
41
+			return $controller->send_response($e);
42 42
 		}
43 43
 	}
44 44
 
@@ -46,22 +46,22 @@  discard block
 block discarded – undo
46 46
 	 * Gets the model metadata resource entity
47 47
 	 * @return array for JSON response, describing all the models available in teh requested version
48 48
 	 */
49
-	protected function _get_models_metadata_entity(){
49
+	protected function _get_models_metadata_entity() {
50 50
 		$response = array();
51
-		foreach( $this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname ){
52
-			$model = $this->get_model_version_info()->load_model( $model_name );
51
+		foreach ($this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname) {
52
+			$model = $this->get_model_version_info()->load_model($model_name);
53 53
 			$fields_json = array();
54
-			foreach( $this->get_model_version_info()->fields_on_model_in_this_version( $model ) as $field_name => $field_obj ) {
55
-				if( $this->get_model_version_info()->field_is_ignored( $field_obj ) ) {
54
+			foreach ($this->get_model_version_info()->fields_on_model_in_this_version($model) as $field_name => $field_obj) {
55
+				if ($this->get_model_version_info()->field_is_ignored($field_obj)) {
56 56
 					continue;
57 57
 				}
58
-				if( $field_obj instanceof \EE_Boolean_Field ) {
58
+				if ($field_obj instanceof \EE_Boolean_Field) {
59 59
 					$datatype = 'Boolean';
60
-				}elseif( $field_obj->get_wpdb_data_type() == '%d' ) {
60
+				}elseif ($field_obj->get_wpdb_data_type() == '%d') {
61 61
 					$datatype = 'Number';
62
-				}elseif( $field_name instanceof \EE_Serialized_Text_Field ) {
62
+				}elseif ($field_name instanceof \EE_Serialized_Text_Field) {
63 63
 					$datatype = 'Object';
64
-				}else{
64
+				} else {
65 65
 					$datatype = 'String';
66 66
 				}
67 67
 				$default_value = Model_Data_Translator::prepare_field_value_for_json(
@@ -72,30 +72,30 @@  discard block
 block discarded – undo
72 72
 				$field_json = array(
73 73
 					'name' => $field_name,
74 74
 					'nicename' => $field_obj->get_nicename(),
75
-					'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format( $field_obj ),
76
-					'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format( $field_obj ),
77
-					'type' => str_replace('EE_', '', get_class( $field_obj ) ),
75
+					'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format($field_obj),
76
+					'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format($field_obj),
77
+					'type' => str_replace('EE_', '', get_class($field_obj)),
78 78
 					'datatype' => $datatype,
79 79
 					'nullable' => $field_obj->is_nullable(),
80 80
 					'default' => $default_value,
81 81
 					'table_alias' => $field_obj->get_table_alias(),
82 82
 					'table_column' => $field_obj->get_table_column(),
83 83
 				);
84
-				$fields_json[ $field_json[ 'name' ] ] = $field_json;
84
+				$fields_json[$field_json['name']] = $field_json;
85 85
 
86 86
 			}
87
-			$fields_json = array_merge( $fields_json, $this->get_model_version_info()->extra_resource_properties_for_model( $model ) );
88
-			$response[ $model_name ]['fields'] = apply_filters( 'FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model );
87
+			$fields_json = array_merge($fields_json, $this->get_model_version_info()->extra_resource_properties_for_model($model));
88
+			$response[$model_name]['fields'] = apply_filters('FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model);
89 89
 			$relations_json = array();
90
-			foreach( $model->relation_settings()  as $relation_name => $relation_obj ) {
90
+			foreach ($model->relation_settings()  as $relation_name => $relation_obj) {
91 91
 				$relation_json = array(
92 92
 					'name' => $relation_name,
93
-					'type' => str_replace( 'EE_', '', get_class( $relation_obj ) ),
93
+					'type' => str_replace('EE_', '', get_class($relation_obj)),
94 94
 					'single' => $relation_obj instanceof \EE_Belongs_To_Relation ? true : false,
95 95
 				);
96
-				$relations_json[ $relation_name ] = $relation_json;
96
+				$relations_json[$relation_name] = $relation_json;
97 97
 			}
98
-			$response[ $model_name ][ 'relations' ] = apply_filters( 'FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model );
98
+			$response[$model_name]['relations'] = apply_filters('FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model);
99 99
 		}
100 100
 		return $response;
101 101
 	}
@@ -105,24 +105,24 @@  discard block
 block discarded – undo
105 105
 	 * @param \WP_REST_Response $rest_response_obj
106 106
 	 * @return \WP_REST_Response
107 107
 	 */
108
-	public static function filter_ee_metadata_into_index( \WP_REST_Response $rest_response_obj ) {
108
+	public static function filter_ee_metadata_into_index(\WP_REST_Response $rest_response_obj) {
109 109
 		$response_data = $rest_response_obj->get_data();
110 110
 		$addons = array();
111
-		foreach( \EE_Registry::instance()->addons as $addon){
111
+		foreach (\EE_Registry::instance()->addons as $addon) {
112 112
 			$addon_json = array(
113 113
 				'name' => $addon->name(),
114 114
 				'version' => $addon->version()
115 115
 			);
116
-			$addons[ $addon_json[ 'name' ] ] = $addon_json;
116
+			$addons[$addon_json['name']] = $addon_json;
117 117
 		}
118
-		$response_data[ 'ee' ] = array(
118
+		$response_data['ee'] = array(
119 119
 			'version' => \EEM_System_Status::instance()->get_ee_version(),
120 120
 			'documentation_url' => 'https://github.com/eventespresso/event-espresso-core/tree/master/docs/C--REST-API',
121 121
 			'addons' => $addons,
122 122
 			'maintenance_mode' => \EE_Maintenance_Mode::instance()->real_level(),
123
-			'served_core_versions' => array_keys( \EED_Core_Rest_Api::versions_served() ),
123
+			'served_core_versions' => array_keys(\EED_Core_Rest_Api::versions_served()),
124 124
 		);
125
-		$rest_response_obj->set_data( $response_data );
125
+		$rest_response_obj->set_data($response_data);
126 126
 		return $rest_response_obj;
127 127
 	}
128 128
 }
Please login to merge, or discard this patch.
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.