@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Prepares an array of field values FOR use in JSON/REST API |
58 | - * @param type $field_obj |
|
58 | + * @param \EE_Model_Field_Base $field_obj |
|
59 | 59 | * @param type $original_value_maybe_array |
60 | 60 | * @param string $request_version (eg 4.8.36) |
61 | 61 | * @return array |
@@ -97,6 +97,7 @@ discard block |
||
97 | 97 | * Prepares a field's value for display in the API |
98 | 98 | * @param \EE_Model_Field_Base $field_obj |
99 | 99 | * @param mixed $original_value |
100 | + * @param string $requested_version |
|
100 | 101 | * @return mixed |
101 | 102 | */ |
102 | 103 | public static function prepare_field_value_for_json( $field_obj, $original_value, $requested_version ) { |
@@ -1,8 +1,8 @@ discard block |
||
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 | |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | * @param string $requested_version |
42 | 42 | * @return mixed |
43 | 43 | */ |
44 | - public static function prepare_field_values_from_json( $field_obj, $original_value_maybe_array, $requested_version ) { |
|
45 | - if( is_array( $original_value_maybe_array ) ) { |
|
44 | + public static function prepare_field_values_from_json($field_obj, $original_value_maybe_array, $requested_version) { |
|
45 | + if (is_array($original_value_maybe_array)) { |
|
46 | 46 | $new_value_maybe_array = array(); |
47 | - foreach( $original_value_maybe_array as $array_key => $array_item ) { |
|
48 | - $new_value_maybe_array[ $array_key ] = Model_Data_Translator::prepare_field_value_from_json( $field_obj, $array_item, $requested_version ); |
|
47 | + foreach ($original_value_maybe_array as $array_key => $array_item) { |
|
48 | + $new_value_maybe_array[$array_key] = Model_Data_Translator::prepare_field_value_from_json($field_obj, $array_item, $requested_version); |
|
49 | 49 | } |
50 | 50 | } else { |
51 | - $new_value_maybe_array = Model_Data_Translator::prepare_field_value_from_json( $field_obj, $original_value_maybe_array, $requested_version ); |
|
51 | + $new_value_maybe_array = Model_Data_Translator::prepare_field_value_from_json($field_obj, $original_value_maybe_array, $requested_version); |
|
52 | 52 | } |
53 | 53 | return $new_value_maybe_array; |
54 | 54 | } |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | * @param string $request_version (eg 4.8.36) |
61 | 61 | * @return array |
62 | 62 | */ |
63 | - public static function prepare_field_values_for_json( $field_obj, $original_value_maybe_array, $request_version ){ |
|
64 | - if( is_array( $original_value_maybe_array ) ) { |
|
63 | + public static function prepare_field_values_for_json($field_obj, $original_value_maybe_array, $request_version) { |
|
64 | + if (is_array($original_value_maybe_array)) { |
|
65 | 65 | $new_value_maybe_array = array(); |
66 | - foreach( $original_value_maybe_array as $array_key => $array_item ) { |
|
67 | - $new_value_maybe_array[ $array_key ] = Model_Data_Translator::prepare_field_value_for_json( $field_obj, $array_item, $request_version ); |
|
66 | + foreach ($original_value_maybe_array as $array_key => $array_item) { |
|
67 | + $new_value_maybe_array[$array_key] = Model_Data_Translator::prepare_field_value_for_json($field_obj, $array_item, $request_version); |
|
68 | 68 | } |
69 | 69 | } else { |
70 | - $new_value_maybe_array = Model_Data_Translator::prepare_field_value_for_json( $field_obj, $original_value_maybe_array, $request_version ); |
|
70 | + $new_value_maybe_array = Model_Data_Translator::prepare_field_value_for_json($field_obj, $original_value_maybe_array, $request_version); |
|
71 | 71 | } |
72 | 72 | return $new_value_maybe_array; |
73 | 73 | } |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | * @param string $requested_version |
81 | 81 | * @return mixed |
82 | 82 | */ |
83 | - public static function prepare_field_value_from_json( $field_obj, $original_value, $requested_version ) { |
|
83 | + public static function prepare_field_value_from_json($field_obj, $original_value, $requested_version) { |
|
84 | 84 | $new_value = null; |
85 | - if( $field_obj instanceof \EE_Infinite_Integer_Field |
|
86 | - && in_array( $original_value, array( null, '' ), true ) ) { |
|
85 | + if ($field_obj instanceof \EE_Infinite_Integer_Field |
|
86 | + && in_array($original_value, array(null, ''), true)) { |
|
87 | 87 | $new_value = EE_INF; |
88 | - } elseif( $field_obj instanceof \EE_Datetime_Field ) { |
|
89 | - $new_value = rest_parse_date( $original_value ); |
|
88 | + } elseif ($field_obj instanceof \EE_Datetime_Field) { |
|
89 | + $new_value = rest_parse_date($original_value); |
|
90 | 90 | } else { |
91 | 91 | $new_value = $original_value; |
92 | 92 | } |
@@ -99,22 +99,22 @@ discard block |
||
99 | 99 | * @param mixed $original_value |
100 | 100 | * @return mixed |
101 | 101 | */ |
102 | - public static function prepare_field_value_for_json( $field_obj, $original_value, $requested_version ) { |
|
103 | - if( $original_value === EE_INF ) { |
|
102 | + public static function prepare_field_value_for_json($field_obj, $original_value, $requested_version) { |
|
103 | + if ($original_value === EE_INF) { |
|
104 | 104 | $new_value = Model_Data_Translator::ee_inf_in_rest; |
105 | - } elseif( $field_obj instanceof \EE_Datetime_Field ) { |
|
106 | - if( $original_value instanceof \DateTime ) { |
|
107 | - $new_value = $original_value->format( 'Y-m-d H:i:s' ); |
|
108 | - } elseif( is_int( $original_value ) ) { |
|
109 | - $new_value = date( 'Y-m-d H:i:s', $original_value ); |
|
105 | + } elseif ($field_obj instanceof \EE_Datetime_Field) { |
|
106 | + if ($original_value instanceof \DateTime) { |
|
107 | + $new_value = $original_value->format('Y-m-d H:i:s'); |
|
108 | + } elseif (is_int($original_value)) { |
|
109 | + $new_value = date('Y-m-d H:i:s', $original_value); |
|
110 | 110 | } else { |
111 | 111 | $new_value = $original_value; |
112 | 112 | } |
113 | - $new_value = mysql_to_rfc3339( $new_value ); |
|
113 | + $new_value = mysql_to_rfc3339($new_value); |
|
114 | 114 | } else { |
115 | 115 | $new_value = $original_value; |
116 | 116 | } |
117 | - return apply_filters( 'FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_field_for_rest_api', |
|
117 | + return apply_filters('FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_field_for_rest_api', |
|
118 | 118 | $new_value, |
119 | 119 | $field_obj, |
120 | 120 | $original_value, |
@@ -134,29 +134,29 @@ discard block |
||
134 | 134 | * @return array |
135 | 135 | * @throws \EE_Error |
136 | 136 | */ |
137 | - public static function prepare_conditions_query_params_for_models( $inputted_query_params_of_this_type, \EEM_Base $model, $requested_version ) { |
|
137 | + public static function prepare_conditions_query_params_for_models($inputted_query_params_of_this_type, \EEM_Base $model, $requested_version) { |
|
138 | 138 | $query_param_for_models = array(); |
139 | - foreach( $inputted_query_params_of_this_type as $query_param_key => $query_param_value ) { |
|
139 | + foreach ($inputted_query_params_of_this_type as $query_param_key => $query_param_value) { |
|
140 | 140 | $field = Model_Data_Translator::deduce_field_from_query_param( |
141 | - Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key( $query_param_key ), |
|
141 | + Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($query_param_key), |
|
142 | 142 | $model |
143 | 143 | ); |
144 | - if( $field instanceof \EE_Model_Field_Base ) { |
|
144 | + if ($field instanceof \EE_Model_Field_Base) { |
|
145 | 145 | //did they specify an operator? |
146 | - if( is_array( $query_param_value ) ) { |
|
147 | - $op = $query_param_value[ 0 ]; |
|
148 | - $translated_value = array( $op ); |
|
149 | - if( isset( $query_param_value[ 1 ] ) ) { |
|
150 | - $value = $query_param_value[ 1 ]; |
|
151 | - $translated_value[1] = Model_Data_Translator::prepare_field_values_from_json( $field, $value, $requested_version ); |
|
146 | + if (is_array($query_param_value)) { |
|
147 | + $op = $query_param_value[0]; |
|
148 | + $translated_value = array($op); |
|
149 | + if (isset($query_param_value[1])) { |
|
150 | + $value = $query_param_value[1]; |
|
151 | + $translated_value[1] = Model_Data_Translator::prepare_field_values_from_json($field, $value, $requested_version); |
|
152 | 152 | } |
153 | 153 | } else { |
154 | - $translated_value = Model_Data_Translator::prepare_field_value_from_json( $field, $query_param_value, $requested_version ); |
|
154 | + $translated_value = Model_Data_Translator::prepare_field_value_from_json($field, $query_param_value, $requested_version); |
|
155 | 155 | } |
156 | - $query_param_for_models[ $query_param_key ] = $translated_value; |
|
156 | + $query_param_for_models[$query_param_key] = $translated_value; |
|
157 | 157 | } else { |
158 | 158 | //so it's not for a field, assume it's a logic query param key |
159 | - $query_param_for_models[ $query_param_key ] = Model_Data_Translator::prepare_conditions_query_params_for_models( $query_param_value, $model, $requested_version ); |
|
159 | + $query_param_for_models[$query_param_key] = Model_Data_Translator::prepare_conditions_query_params_for_models($query_param_value, $model, $requested_version); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | return $query_param_for_models; |
@@ -171,27 +171,27 @@ discard block |
||
171 | 171 | * @param string $requested_version eg "4.8.36". If null is provided, defaults to the latest release of the EE4 REST API |
172 | 172 | * @return array which can be passed into the EE4 REST API when querying a model resource |
173 | 173 | */ |
174 | - public static function prepare_query_params_for_rest_api( $model_query_params, \EEM_Base $model, $requested_version = null ) { |
|
175 | - if( $requested_version === null ) { |
|
176 | - $requested_version = \EED_Core_Rest_Api::latest_rest_api_version() ; |
|
174 | + public static function prepare_query_params_for_rest_api($model_query_params, \EEM_Base $model, $requested_version = null) { |
|
175 | + if ($requested_version === null) { |
|
176 | + $requested_version = \EED_Core_Rest_Api::latest_rest_api_version(); |
|
177 | 177 | } |
178 | 178 | $rest_query_params = $model_query_params; |
179 | - if ( isset( $model_query_params[0] ) ) { |
|
180 | - $rest_query_params[ 'where' ] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( |
|
181 | - $model_query_params[ 0 ], |
|
179 | + if (isset($model_query_params[0])) { |
|
180 | + $rest_query_params['where'] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( |
|
181 | + $model_query_params[0], |
|
182 | 182 | $model, |
183 | 183 | $requested_version |
184 | 184 | ); |
185 | - unset( $rest_query_params[0] ); |
|
185 | + unset($rest_query_params[0]); |
|
186 | 186 | } |
187 | - if ( isset( $model_query_params[ 'having' ] ) ) { |
|
188 | - $rest_query_params[ 'having' ] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( |
|
189 | - $model_query_params[ 'having' ], |
|
187 | + if (isset($model_query_params['having'])) { |
|
188 | + $rest_query_params['having'] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( |
|
189 | + $model_query_params['having'], |
|
190 | 190 | $model, |
191 | 191 | $requested_version |
192 | 192 | ); |
193 | 193 | } |
194 | - return apply_filters( 'FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_query_params_for_rest_api', $rest_query_params, $model_query_params, $model, $requested_version ); |
|
194 | + return apply_filters('FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_query_params_for_rest_api', $rest_query_params, $model_query_params, $model, $requested_version); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -201,29 +201,29 @@ discard block |
||
201 | 201 | * @param string $requested_version eg "4.8.36" |
202 | 202 | * @return array ready for use in the rest api query params |
203 | 203 | */ |
204 | - public static function prepare_conditions_query_params_for_rest_api( $inputted_query_params_of_this_type, \EEM_Base $model, $requested_version ) { |
|
204 | + public static function prepare_conditions_query_params_for_rest_api($inputted_query_params_of_this_type, \EEM_Base $model, $requested_version) { |
|
205 | 205 | $query_param_for_models = array(); |
206 | - foreach( $inputted_query_params_of_this_type as $query_param_key => $query_param_value ) { |
|
206 | + foreach ($inputted_query_params_of_this_type as $query_param_key => $query_param_value) { |
|
207 | 207 | $field = Model_Data_Translator::deduce_field_from_query_param( |
208 | - Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key( $query_param_key ), |
|
208 | + Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($query_param_key), |
|
209 | 209 | $model |
210 | 210 | ); |
211 | - if( $field instanceof \EE_Model_Field_Base ) { |
|
211 | + if ($field instanceof \EE_Model_Field_Base) { |
|
212 | 212 | //did they specify an operator? |
213 | - if( is_array( $query_param_value ) ) { |
|
214 | - $op = $query_param_value[ 0 ]; |
|
215 | - $translated_value = array( $op ); |
|
216 | - if( isset( $query_param_value[ 1 ] ) ) { |
|
217 | - $value = $query_param_value[ 1 ]; |
|
218 | - $translated_value[1] = Model_Data_Translator::prepare_field_values_for_json( $field, $value, $requested_version ); |
|
213 | + if (is_array($query_param_value)) { |
|
214 | + $op = $query_param_value[0]; |
|
215 | + $translated_value = array($op); |
|
216 | + if (isset($query_param_value[1])) { |
|
217 | + $value = $query_param_value[1]; |
|
218 | + $translated_value[1] = Model_Data_Translator::prepare_field_values_for_json($field, $value, $requested_version); |
|
219 | 219 | } |
220 | 220 | } else { |
221 | - $translated_value = Model_Data_Translator::prepare_field_value_for_json( $field, $query_param_value, $requested_version ); |
|
221 | + $translated_value = Model_Data_Translator::prepare_field_value_for_json($field, $query_param_value, $requested_version); |
|
222 | 222 | } |
223 | - $query_param_for_models[ $query_param_key ] = $translated_value; |
|
223 | + $query_param_for_models[$query_param_key] = $translated_value; |
|
224 | 224 | } else { |
225 | 225 | //so it's not for a field, assume it's a logic query param key |
226 | - $query_param_for_models[ $query_param_key ] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( $query_param_value, $model, $requested_version ); |
|
226 | + $query_param_for_models[$query_param_key] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api($query_param_value, $model, $requested_version); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | return $query_param_for_models; |
@@ -235,11 +235,11 @@ discard block |
||
235 | 235 | * @param $condition_query_param_key |
236 | 236 | * @return string |
237 | 237 | */ |
238 | - public static function remove_stars_and_anything_after_from_condition_query_param_key( $condition_query_param_key ) { |
|
238 | + public static function remove_stars_and_anything_after_from_condition_query_param_key($condition_query_param_key) { |
|
239 | 239 | $pos_of_star = strpos($condition_query_param_key, '*'); |
240 | - if($pos_of_star === FALSE){ |
|
240 | + if ($pos_of_star === FALSE) { |
|
241 | 241 | return $condition_query_param_key; |
242 | - }else{ |
|
242 | + } else { |
|
243 | 243 | $condition_query_param_sans_star = substr($condition_query_param_key, 0, $pos_of_star); |
244 | 244 | return $condition_query_param_sans_star; |
245 | 245 | } |
@@ -255,26 +255,26 @@ discard block |
||
255 | 255 | * @return \EE_Model_Field_Base |
256 | 256 | * @throws \EE_Error |
257 | 257 | */ |
258 | - public static function deduce_field_from_query_param($query_param_name, \EEM_Base $model){ |
|
258 | + public static function deduce_field_from_query_param($query_param_name, \EEM_Base $model) { |
|
259 | 259 | //ok, now proceed with deducing which part is the model's name, and which is the field's name |
260 | 260 | //which will help us find the database table and column |
261 | 261 | |
262 | - $query_param_parts = explode(".",$query_param_name); |
|
263 | - if(empty($query_param_parts)){ |
|
264 | - throw new \EE_Error(sprintf(__("_extract_column_name is empty when trying to extract column and table name from %s",'event_espresso'),$query_param_name)); |
|
262 | + $query_param_parts = explode(".", $query_param_name); |
|
263 | + if (empty($query_param_parts)) { |
|
264 | + throw new \EE_Error(sprintf(__("_extract_column_name is empty when trying to extract column and table name from %s", 'event_espresso'), $query_param_name)); |
|
265 | 265 | } |
266 | 266 | $number_of_parts = count($query_param_parts); |
267 | - $last_query_param_part = $query_param_parts[ count($query_param_parts) - 1 ]; |
|
268 | - if($number_of_parts == 1){ |
|
267 | + $last_query_param_part = $query_param_parts[count($query_param_parts) - 1]; |
|
268 | + if ($number_of_parts == 1) { |
|
269 | 269 | $field_name = $last_query_param_part; |
270 | - }else{// $number_of_parts >= 2 |
|
270 | + } else {// $number_of_parts >= 2 |
|
271 | 271 | //the last part is the column name, and there are only 2parts. therefore... |
272 | 272 | $field_name = $last_query_param_part; |
273 | - $model = \EE_Registry::instance()->load_model( $query_param_parts[ $number_of_parts - 2 ]); |
|
273 | + $model = \EE_Registry::instance()->load_model($query_param_parts[$number_of_parts - 2]); |
|
274 | 274 | } |
275 | - try{ |
|
275 | + try { |
|
276 | 276 | return $model->field_settings_for($field_name); |
277 | - }catch(\EE_Error $e){ |
|
277 | + } catch (\EE_Error $e) { |
|
278 | 278 | return null; |
279 | 279 | } |
280 | 280 | } |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | use EventEspresso\Core\Exceptions\InvalidDataTypeException; |
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 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @author Brent Christensen |
20 | 20 | * @since 4.9.0 |
21 | 21 | */ |
22 | -class ProgressStep implements ProgressStepInterface{ |
|
22 | +class ProgressStep implements ProgressStepInterface { |
|
23 | 23 | |
24 | 24 | |
25 | 25 | /** |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | * @param string $text |
66 | 66 | * @throws InvalidDataTypeException |
67 | 67 | */ |
68 | - public function __construct( $order, $id, $html_class, $text ) { |
|
69 | - $this->setOrder( $order ); |
|
70 | - $this->setId( $id ); |
|
71 | - $this->setHtmlClass( $html_class ); |
|
72 | - $this->setText( $text ); |
|
68 | + public function __construct($order, $id, $html_class, $text) { |
|
69 | + $this->setOrder($order); |
|
70 | + $this->setId($id); |
|
71 | + $this->setHtmlClass($html_class); |
|
72 | + $this->setText($text); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | /** |
87 | 87 | * @param boolean $current |
88 | 88 | */ |
89 | - public function setIsCurrent( $current = true ) { |
|
90 | - $this->current = filter_var( $current, FILTER_VALIDATE_BOOLEAN ); |
|
89 | + public function setIsCurrent($current = true) { |
|
90 | + $this->current = filter_var($current, FILTER_VALIDATE_BOOLEAN); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @param boolean $completed |
106 | 106 | */ |
107 | - public function setIsCompleted( $completed = true ) { |
|
108 | - $this->completed = filter_var( $completed, FILTER_VALIDATE_BOOLEAN ); |
|
107 | + public function setIsCompleted($completed = true) { |
|
108 | + $this->completed = filter_var($completed, FILTER_VALIDATE_BOOLEAN); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | * @param string $id |
125 | 125 | * @throws InvalidDataTypeException |
126 | 126 | */ |
127 | - protected function setId( $id = '' ) { |
|
128 | - if ( ! is_string( $id ) ) { |
|
129 | - throw new InvalidDataTypeException( '$id', $id, 'string' ); |
|
127 | + protected function setId($id = '') { |
|
128 | + if ( ! is_string($id)) { |
|
129 | + throw new InvalidDataTypeException('$id', $id, 'string'); |
|
130 | 130 | } |
131 | 131 | $this->id = $id; |
132 | 132 | } |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * @param int $order |
149 | 149 | * @throws InvalidDataTypeException |
150 | 150 | */ |
151 | - protected function setOrder( $order = 0 ) { |
|
152 | - if ( ! is_int( $order ) ) { |
|
153 | - throw new InvalidDataTypeException( '$order', $order, 'integer' ); |
|
151 | + protected function setOrder($order = 0) { |
|
152 | + if ( ! is_int($order)) { |
|
153 | + throw new InvalidDataTypeException('$order', $order, 'integer'); |
|
154 | 154 | } |
155 | 155 | $this->order = $order; |
156 | 156 | } |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function htmlClass() { |
164 | 164 | $html_class = $this->html_class; |
165 | - if ( $this->isCurrent() ) { |
|
165 | + if ($this->isCurrent()) { |
|
166 | 166 | $html_class .= ' progress-step-active'; |
167 | - } else if ( $this->isCompleted() ) { |
|
167 | + } else if ($this->isCompleted()) { |
|
168 | 168 | $html_class .= ' progress-step-completed'; |
169 | 169 | } |
170 | 170 | return $html_class; |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | * @param string $html_class |
178 | 178 | * @throws InvalidDataTypeException |
179 | 179 | */ |
180 | - protected function setHtmlClass( $html_class ) { |
|
181 | - if ( ! is_string( $html_class ) ) { |
|
182 | - throw new InvalidDataTypeException( '$html_class', $html_class, 'string' ); |
|
180 | + protected function setHtmlClass($html_class) { |
|
181 | + if ( ! is_string($html_class)) { |
|
182 | + throw new InvalidDataTypeException('$html_class', $html_class, 'string'); |
|
183 | 183 | } |
184 | - if ( strpos( $html_class, 'progress-step-' ) === false ) { |
|
185 | - $html_class = 'progress-step-' . $html_class; |
|
184 | + if (strpos($html_class, 'progress-step-') === false) { |
|
185 | + $html_class = 'progress-step-'.$html_class; |
|
186 | 186 | } |
187 | 187 | $this->html_class = $html_class; |
188 | 188 | } |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | * @param string $text |
204 | 204 | * @throws InvalidDataTypeException |
205 | 205 | */ |
206 | - protected function setText( $text ) { |
|
207 | - if ( ! is_string( $text ) ) { |
|
208 | - throw new InvalidDataTypeException( '$text', $text, 'string' ); |
|
206 | + protected function setText($text) { |
|
207 | + if ( ! is_string($text)) { |
|
208 | + throw new InvalidDataTypeException('$text', $text, 'string'); |
|
209 | 209 | } |
210 | 210 | $this->text = $text; |
211 | 211 | } |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | use EventEspresso\core\services\collections\CollectionInterface; |
11 | 11 | use EventEspresso\core\services\progress_steps\display_strategies\ProgressStepsDisplayInterface; |
12 | 12 | |
13 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
14 | - exit( 'No direct script access allowed' ); |
|
13 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
14 | + exit('No direct script access allowed'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | CollectionInterface $collection = null, |
79 | 79 | EE_Request $request = null |
80 | 80 | ) { |
81 | - $this->setDisplayStrategy( $display_strategy_name ); |
|
82 | - $this->setDefaultStep( $default_step ); |
|
83 | - $this->setFormStepUrlKey( $form_step_url_key ); |
|
84 | - if ( ! $collection instanceof CollectionInterface ) { |
|
85 | - $collection = new Collection( '\EventEspresso\core\services\progress_steps\ProgressStepInterface' ); |
|
81 | + $this->setDisplayStrategy($display_strategy_name); |
|
82 | + $this->setDefaultStep($default_step); |
|
83 | + $this->setFormStepUrlKey($form_step_url_key); |
|
84 | + if ( ! $collection instanceof CollectionInterface) { |
|
85 | + $collection = new Collection('\EventEspresso\core\services\progress_steps\ProgressStepInterface'); |
|
86 | 86 | } |
87 | 87 | $this->collection = $collection; |
88 | - if ( ! $request instanceof EE_Request ) { |
|
89 | - $request = \EE_Registry::instance()->load_core( 'Request' ); |
|
88 | + if ( ! $request instanceof EE_Request) { |
|
89 | + $request = \EE_Registry::instance()->load_core('Request'); |
|
90 | 90 | } |
91 | 91 | $this->request = $request; |
92 | 92 | } |
@@ -98,28 +98,28 @@ discard block |
||
98 | 98 | * @throws InvalidDataTypeException |
99 | 99 | * @throws InvalidClassException |
100 | 100 | */ |
101 | - protected function setDisplayStrategy( $display_strategy_name = 'number_bubbles' ) { |
|
102 | - if ( ! is_string( $display_strategy_name ) ) { |
|
103 | - throw new InvalidDataTypeException( '$display_strategy_name', $display_strategy_name, 'string' ); |
|
101 | + protected function setDisplayStrategy($display_strategy_name = 'number_bubbles') { |
|
102 | + if ( ! is_string($display_strategy_name)) { |
|
103 | + throw new InvalidDataTypeException('$display_strategy_name', $display_strategy_name, 'string'); |
|
104 | 104 | } |
105 | 105 | // build up FQCN from incoming display strategy folder name |
106 | 106 | $display_strategy_class = 'EventEspresso\core\services\progress_steps\display_strategies\\'; |
107 | - $display_strategy_class .= $display_strategy_name . '\\'; |
|
108 | - $display_strategy_class .= str_replace( ' ', '', ucwords( str_replace( '_', ' ', $display_strategy_name ) ) ); |
|
107 | + $display_strategy_class .= $display_strategy_name.'\\'; |
|
108 | + $display_strategy_class .= str_replace(' ', '', ucwords(str_replace('_', ' ', $display_strategy_name))); |
|
109 | 109 | $display_strategy_class .= 'ProgressStepsDisplay'; |
110 | 110 | $display_strategy_class = apply_filters( |
111 | 111 | 'FHEE__ProgressStepManager__setDisplayStrategy__display_strategy_class', |
112 | 112 | $display_strategy_class |
113 | 113 | ); |
114 | - if ( ! class_exists( $display_strategy_class ) ) { |
|
115 | - throw new InvalidClassException( $display_strategy_class ); |
|
114 | + if ( ! class_exists($display_strategy_class)) { |
|
115 | + throw new InvalidClassException($display_strategy_class); |
|
116 | 116 | } |
117 | 117 | $display_strategy = new $display_strategy_class(); |
118 | - if ( ! $display_strategy instanceof ProgressStepsDisplayInterface ) { |
|
118 | + if ( ! $display_strategy instanceof ProgressStepsDisplayInterface) { |
|
119 | 119 | throw new InvalidClassException( |
120 | 120 | $display_strategy_class, |
121 | 121 | sprintf( |
122 | - __( 'The "%1$s" Class needs to be an implementation of the "%1$s" Interface.', 'event_espresso' ), |
|
122 | + __('The "%1$s" Class needs to be an implementation of the "%1$s" Interface.', 'event_espresso'), |
|
123 | 123 | $display_strategy_class, |
124 | 124 | '\EventEspresso\core\services\progress_steps\display_strategies\ProgressStepsDisplayInterface' |
125 | 125 | ) |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | * @param string $default_step |
135 | 135 | * @throws InvalidDataTypeException |
136 | 136 | */ |
137 | - public function setDefaultStep( $default_step ) { |
|
138 | - if ( ! is_string( $default_step ) ) { |
|
139 | - throw new InvalidDataTypeException( '$default_step', $default_step, 'string' ); |
|
137 | + public function setDefaultStep($default_step) { |
|
138 | + if ( ! is_string($default_step)) { |
|
139 | + throw new InvalidDataTypeException('$default_step', $default_step, 'string'); |
|
140 | 140 | } |
141 | 141 | $this->default_step = $default_step; |
142 | 142 | } |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | * @param string $form_step_url_key |
148 | 148 | * @throws InvalidDataTypeException |
149 | 149 | */ |
150 | - public function setFormStepUrlKey( $form_step_url_key = 'ee-form-step' ) { |
|
151 | - if ( ! is_string( $form_step_url_key ) ) { |
|
152 | - throw new InvalidDataTypeException( '$form_step_key', $form_step_url_key, 'string' ); |
|
150 | + public function setFormStepUrlKey($form_step_url_key = 'ee-form-step') { |
|
151 | + if ( ! is_string($form_step_url_key)) { |
|
152 | + throw new InvalidDataTypeException('$form_step_key', $form_step_url_key, 'string'); |
|
153 | 153 | } |
154 | - $this->form_step_url_key = ! empty( $form_step_url_key ) ? $form_step_url_key : 'ee-form-step'; |
|
154 | + $this->form_step_url_key = ! empty($form_step_url_key) ? $form_step_url_key : 'ee-form-step'; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | |
@@ -160,26 +160,26 @@ discard block |
||
160 | 160 | * @param string $step |
161 | 161 | * @throws InvalidIdentifierException |
162 | 162 | */ |
163 | - public function setCurrentStep( $step = '' ) { |
|
163 | + public function setCurrentStep($step = '') { |
|
164 | 164 | // use incoming value if it's set, otherwise use request param if it's set, otherwise use default |
165 | - $step = ! empty( $step ) |
|
165 | + $step = ! empty($step) |
|
166 | 166 | ? $step |
167 | - : $this->request->get( $this->form_step_url_key, $this->default_step ); |
|
167 | + : $this->request->get($this->form_step_url_key, $this->default_step); |
|
168 | 168 | // grab the step previously known as current, in case we need to revert |
169 | 169 | $current_current_step = $this->collection->current(); |
170 | 170 | // verify that requested step exists |
171 | - if ( ! $this->collection->has( $step ) ) { |
|
172 | - throw new InvalidIdentifierException( $step, $this->default_step ); |
|
171 | + if ( ! $this->collection->has($step)) { |
|
172 | + throw new InvalidIdentifierException($step, $this->default_step); |
|
173 | 173 | } |
174 | - if ( $this->collection->setCurrent( $step ) ) { |
|
174 | + if ($this->collection->setCurrent($step)) { |
|
175 | 175 | // if the old boss is the same as the new boss, then nothing changes |
176 | - if ( $this->collection->current() !== $current_current_step ) { |
|
177 | - $current_current_step->setIsCurrent( false ); |
|
176 | + if ($this->collection->current() !== $current_current_step) { |
|
177 | + $current_current_step->setIsCurrent(false); |
|
178 | 178 | } |
179 | 179 | $this->collection->current()->setIsCurrent(); |
180 | 180 | } else { |
181 | - $this->collection->setCurrent( $current_current_step->id() ); |
|
182 | - $current_current_step->setIsCurrent( true ); |
|
181 | + $this->collection->setCurrent($current_current_step->id()); |
|
182 | + $current_current_step->setIsCurrent(true); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | public function setPreviousStepsCompleted() { |
192 | 192 | $current_current_step = $this->collection->current(); |
193 | 193 | $this->collection->rewind(); |
194 | - while ( $this->collection->valid() ) { |
|
195 | - if ( $this->collection->current() === $current_current_step ) { |
|
194 | + while ($this->collection->valid()) { |
|
195 | + if ($this->collection->current() === $current_current_step) { |
|
196 | 196 | break; |
197 | 197 | } |
198 | 198 | $this->setCurrentStepCompleted(); |
199 | 199 | $this->collection->next(); |
200 | 200 | } |
201 | - $this->collection->setCurrentUsingObject( $current_current_step ); |
|
201 | + $this->collection->setCurrentUsingObject($current_current_step); |
|
202 | 202 | return false; |
203 | 203 | } |
204 | 204 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | public function displaySteps() { |
240 | 240 | return \EEH_Template::display_template( |
241 | 241 | $this->display_strategy->getTemplate(), |
242 | - array( 'progress_steps' => $this->collection ), |
|
242 | + array('progress_steps' => $this->collection), |
|
243 | 243 | true |
244 | 244 | ); |
245 | 245 | } |
@@ -250,8 +250,8 @@ discard block |
||
250 | 250 | * @param bool $completed |
251 | 251 | * @return \EventEspresso\core\services\progress_steps\ProgressStepInterface |
252 | 252 | */ |
253 | - public function setCurrentStepCompleted( $completed = true ) { |
|
254 | - return $this->collection->current()->setIsCompleted( $completed ); |
|
253 | + public function setCurrentStepCompleted($completed = true) { |
|
254 | + return $this->collection->current()->setIsCompleted($completed); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 |
@@ -2,10 +2,10 @@ |
||
2 | 2 | namespace EventEspresso\core\services\progress_steps; |
3 | 3 | |
4 | 4 | use EE_Request; |
5 | -use EventEspresso\core\exceptions\InvalidClassException; |
|
6 | -use EventEspresso\core\exceptions\InvalidDataTypeException; |
|
7 | -use EventEspresso\core\exceptions\InvalidIdentifierException; |
|
8 | -use EventEspresso\core\exceptions\InvalidInterfaceException; |
|
5 | +use EventEspresso\core\exceptions\InvalidClassException; |
|
6 | +use EventEspresso\core\exceptions\InvalidDataTypeException; |
|
7 | +use EventEspresso\core\exceptions\InvalidIdentifierException; |
|
8 | +use EventEspresso\core\exceptions\InvalidInterfaceException; |
|
9 | 9 | use EventEspresso\core\services\collections\Collection; |
10 | 10 | use EventEspresso\core\services\collections\CollectionInterface; |
11 | 11 | use EventEspresso\core\services\progress_steps\display_strategies\ProgressStepsDisplayInterface; |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | use EventEspresso\core\services\progress_steps\display_strategies\ProgressStepsDisplayInterface; |
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,7 +29,7 @@ discard block |
||
29 | 29 | // core/services/progress_steps/display_strategies/number_bubbles/number_bubbles.css |
30 | 30 | wp_enqueue_style( |
31 | 31 | 'ee_progress_steps_display_number_bubbles', |
32 | - plugin_dir_url( __FILE__ ) . 'number_bubbles.css' |
|
32 | + plugin_dir_url(__FILE__).'number_bubbles.css' |
|
33 | 33 | ); |
34 | 34 | } |
35 | 35 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function getTemplate() { |
44 | 44 | // return plugin_dir_path( __FILE__ ) . 'number_bubbles.template.php'; |
45 | - return __DIR__ . DS .'number_bubbles.template.php'; |
|
45 | + return __DIR__.DS.'number_bubbles.template.php'; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | } |
@@ -1,6 +1,6 @@ |
||
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 EE_Line_Item_Filter_Collection |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\commands; |
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 | |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param int $code |
26 | 26 | * @param \Exception $previous |
27 | 27 | */ |
28 | - public function __construct( $command_name, $message = '', $code = 0, \Exception $previous = null ) { |
|
29 | - if ( empty( $message ) ) { |
|
28 | + public function __construct($command_name, $message = '', $code = 0, \Exception $previous = null) { |
|
29 | + if (empty($message)) { |
|
30 | 30 | $message = sprintf( |
31 | - __( 'The supplied Command Handler "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', 'event_espresso' ), |
|
31 | + __('The supplied Command Handler "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', 'event_espresso'), |
|
32 | 32 | $command_name |
33 | 33 | ); |
34 | 34 | } |
35 | - parent::__construct( $message, $code, $previous ); |
|
35 | + parent::__construct($message, $code, $previous); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\commands; |
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 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param \EventEspresso\core\services\commands\CommandInterface $command |
20 | 20 | * @return mixed |
21 | 21 | */ |
22 | - public function handle( CommandInterface $command ); |
|
22 | + public function handle(CommandInterface $command); |
|
23 | 23 | |
24 | 24 | } |
25 | 25 | // End of file CommandHandlerInterface.php |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\commands; |
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 | |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | * @param \EventEspresso\core\services\commands\CommandHandlerInterface $command_handler |
20 | 20 | * @return mixed |
21 | 21 | */ |
22 | - public function addCommandHandler( CommandHandlerInterface $command_handler ); |
|
22 | + public function addCommandHandler(CommandHandlerInterface $command_handler); |
|
23 | 23 | |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @param \EventEspresso\core\services\commands\CommandInterface $command |
27 | 27 | * @return mixed |
28 | 28 | */ |
29 | - public function getCommandHandler( CommandInterface $command ); |
|
29 | + public function getCommandHandler(CommandInterface $command); |
|
30 | 30 | |
31 | 31 | } |
32 | 32 | // End of file CommandHandlerManagerInterface.php |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * just checks the field isn't blank |
27 | 27 | * |
28 | 28 | * @param $normalized_value |
29 | - * @return bool |
|
29 | + * @return boolean|null |
|
30 | 30 | * @throws \EE_Validation_Error |
31 | 31 | */ |
32 | 32 | function validate($normalized_value) { |
@@ -1,6 +1,6 @@ discard block |
||
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 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @param \EE_Request $request |
76 | 76 | * @param \EE_Response $response |
77 | 77 | */ |
78 | - protected function __construct( EE_Request $request, EE_Response $response ) { |
|
78 | + protected function __construct(EE_Request $request, EE_Response $response) { |
|
79 | 79 | $this->_request = $request; |
80 | 80 | $this->_response = $response; |
81 | - add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) ); |
|
82 | - do_action( 'EE_Dependency_Map____construct' ); |
|
81 | + add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); |
|
82 | + do_action('EE_Dependency_Map____construct'); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | * @param \EE_Response $response |
102 | 102 | * @return \EE_Dependency_Map instance |
103 | 103 | */ |
104 | - public static function instance( EE_Request $request = null, EE_Response $response = null ) { |
|
104 | + public static function instance(EE_Request $request = null, EE_Response $response = null) { |
|
105 | 105 | // check if class object is instantiated, and instantiated properly |
106 | - if ( ! self::$_instance instanceof EE_Dependency_Map ) { |
|
107 | - self::$_instance = new EE_Dependency_Map( $request, $response ); |
|
106 | + if ( ! self::$_instance instanceof EE_Dependency_Map) { |
|
107 | + self::$_instance = new EE_Dependency_Map($request, $response); |
|
108 | 108 | } |
109 | 109 | return self::$_instance; |
110 | 110 | } |
@@ -116,16 +116,16 @@ discard block |
||
116 | 116 | * @param array $dependencies |
117 | 117 | * @return boolean |
118 | 118 | */ |
119 | - public static function register_dependencies( $class, $dependencies ) { |
|
120 | - if ( ! isset( self::$_instance->_dependency_map[ $class ] ) ) { |
|
119 | + public static function register_dependencies($class, $dependencies) { |
|
120 | + if ( ! isset(self::$_instance->_dependency_map[$class])) { |
|
121 | 121 | // we need to make sure that any aliases used when registering a dependency |
122 | 122 | // get resolved to the correct class name |
123 | - foreach ( (array) $dependencies as $dependency => $load_source ) { |
|
124 | - $alias = self::$_instance->get_alias( $dependency ); |
|
125 | - unset( $dependencies[ $dependency ] ); |
|
126 | - $dependencies[ $alias ] = $load_source; |
|
123 | + foreach ((array) $dependencies as $dependency => $load_source) { |
|
124 | + $alias = self::$_instance->get_alias($dependency); |
|
125 | + unset($dependencies[$dependency]); |
|
126 | + $dependencies[$alias] = $load_source; |
|
127 | 127 | } |
128 | - self::$_instance->_dependency_map[ $class ] = (array) $dependencies; |
|
128 | + self::$_instance->_dependency_map[$class] = (array) $dependencies; |
|
129 | 129 | return true; |
130 | 130 | } |
131 | 131 | return false; |
@@ -139,19 +139,19 @@ discard block |
||
139 | 139 | * @return bool |
140 | 140 | * @throws \EE_Error |
141 | 141 | */ |
142 | - public static function register_class_loader( $class_name, $loader = 'load_core' ) { |
|
142 | + public static function register_class_loader($class_name, $loader = 'load_core') { |
|
143 | 143 | // check that loader method starts with "load_" and exists in EE_Registry |
144 | - if ( strpos( $loader, 'load_' ) !== 0 || ! method_exists( 'EE_Registry', $loader ) ) { |
|
144 | + if (strpos($loader, 'load_') !== 0 || ! method_exists('EE_Registry', $loader)) { |
|
145 | 145 | throw new EE_Error( |
146 | 146 | sprintf( |
147 | - __( '"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso' ), |
|
147 | + __('"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso'), |
|
148 | 148 | $loader |
149 | 149 | ) |
150 | 150 | ); |
151 | 151 | } |
152 | - $class_name = self::$_instance->get_alias( $class_name ); |
|
153 | - if ( ! isset( self::$_instance->_class_loaders[ $class_name ] ) ) { |
|
154 | - self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
152 | + $class_name = self::$_instance->get_alias($class_name); |
|
153 | + if ( ! isset(self::$_instance->_class_loaders[$class_name])) { |
|
154 | + self::$_instance->_class_loaders[$class_name] = $loader; |
|
155 | 155 | return true; |
156 | 156 | } |
157 | 157 | return false; |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @param string $class_name |
175 | 175 | * @return boolean |
176 | 176 | */ |
177 | - public function has( $class_name = '' ) { |
|
178 | - return isset( $this->_dependency_map[ $class_name ] ) ? true : false; |
|
177 | + public function has($class_name = '') { |
|
178 | + return isset($this->_dependency_map[$class_name]) ? true : false; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | * @param string $dependency |
188 | 188 | * @return bool |
189 | 189 | */ |
190 | - public function has_dependency_for_class( $class_name = '', $dependency = '' ) { |
|
191 | - $dependency = $this->get_alias( $dependency ); |
|
192 | - return isset( $this->_dependency_map[ $class_name ], $this->_dependency_map[ $class_name ][ $dependency ] ) |
|
190 | + public function has_dependency_for_class($class_name = '', $dependency = '') { |
|
191 | + $dependency = $this->get_alias($dependency); |
|
192 | + return isset($this->_dependency_map[$class_name], $this->_dependency_map[$class_name][$dependency]) |
|
193 | 193 | ? true |
194 | 194 | : false; |
195 | 195 | } |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | * @param string $dependency |
204 | 204 | * @return int |
205 | 205 | */ |
206 | - public function loading_strategy_for_class_dependency( $class_name = '', $dependency = '' ) { |
|
207 | - $dependency = $this->get_alias( $dependency ); |
|
208 | - return $this->has_dependency_for_class( $class_name, $dependency ) |
|
209 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
206 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') { |
|
207 | + $dependency = $this->get_alias($dependency); |
|
208 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
209 | + ? $this->_dependency_map[$class_name][$dependency] |
|
210 | 210 | : EE_Dependency_Map::not_registered; |
211 | 211 | } |
212 | 212 | |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | * @param string $class_name |
217 | 217 | * @return string | Closure |
218 | 218 | */ |
219 | - public function class_loader( $class_name ) { |
|
220 | - $class_name = $this->get_alias( $class_name ); |
|
221 | - return isset( $this->_class_loaders[ $class_name ] ) ? $this->_class_loaders[ $class_name ] : ''; |
|
219 | + public function class_loader($class_name) { |
|
220 | + $class_name = $this->get_alias($class_name); |
|
221 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | * @param string $alias |
240 | 240 | * @return bool |
241 | 241 | */ |
242 | - public function add_alias( $class_name, $alias ) { |
|
243 | - $this->_aliases[ $class_name ] = $alias; |
|
242 | + public function add_alias($class_name, $alias) { |
|
243 | + $this->_aliases[$class_name] = $alias; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
@@ -251,8 +251,8 @@ discard block |
||
251 | 251 | * @param string $class_name |
252 | 252 | * @return boolean |
253 | 253 | */ |
254 | - public function has_alias( $class_name = '' ) { |
|
255 | - return isset( $this->_aliases[ $class_name ] ) ? true : false; |
|
254 | + public function has_alias($class_name = '') { |
|
255 | + return isset($this->_aliases[$class_name]) ? true : false; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | * @param string $class_name |
273 | 273 | * @return boolean |
274 | 274 | */ |
275 | - public function get_alias( $class_name = '' ) { |
|
276 | - return $this->has_alias( $class_name ) |
|
277 | - ? $this->get_alias( $this->_aliases[ $class_name ] ) |
|
275 | + public function get_alias($class_name = '') { |
|
276 | + return $this->has_alias($class_name) |
|
277 | + ? $this->get_alias($this->_aliases[$class_name]) |
|
278 | 278 | : $class_name; |
279 | 279 | } |
280 | 280 | |
@@ -461,17 +461,17 @@ discard block |
||
461 | 461 | 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
462 | 462 | 'EE_Message_Template_Group_Collection' => 'load_lib', |
463 | 463 | 'EE_Messages_Generator' => function() { |
464 | - return EE_Registry::instance()->load_lib( 'Messages_Generator', array(), false, false ); |
|
464 | + return EE_Registry::instance()->load_lib('Messages_Generator', array(), false, false); |
|
465 | 465 | }, |
466 | - 'EE_Messages_Template_Defaults' => function( $arguments = array() ) { |
|
467 | - return EE_Registry::instance()->load_lib( 'Messages_Template_Defaults', $arguments, false, false ); |
|
466 | + 'EE_Messages_Template_Defaults' => function($arguments = array()) { |
|
467 | + return EE_Registry::instance()->load_lib('Messages_Template_Defaults', $arguments, false, false); |
|
468 | 468 | }, |
469 | 469 | //load_model |
470 | 470 | 'EEM_Message_Template_Group' => 'load_model', |
471 | 471 | 'EEM_Message_Template' => 'load_model', |
472 | 472 | //load_helper |
473 | 473 | 'EEH_Parse_Shortcodes' => function() { |
474 | - if ( EE_Registry::instance()->load_helper( 'Parse_Shortcodes' ) ) { |
|
474 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
475 | 475 | return new EEH_Parse_Shortcodes(); |
476 | 476 | } |
477 | 477 | return null; |