@@ -9,18 +9,18 @@ |
||
9 | 9 | * @package Event Espresso |
10 | 10 | * @author Mike Nelson |
11 | 11 | */ |
12 | -class EE_Submit_Input_Display_Strategy extends EE_Display_Strategy_Base{ |
|
12 | +class EE_Submit_Input_Display_Strategy extends EE_Display_Strategy_Base { |
|
13 | 13 | /** |
14 | 14 | * |
15 | 15 | * @return string of html to display the input |
16 | 16 | */ |
17 | - public function display(){ |
|
17 | + public function display() { |
|
18 | 18 | $html = '<input type="submit" '; |
19 | - $html .= 'name="' . $this->_input->html_name() . '" '; |
|
20 | - $html .= 'value="' . $this->_input->raw_value_in_form() . '" '; |
|
21 | - $html .= 'id="' . $this->_input->html_id() . '-submit" '; |
|
22 | - $html .= 'class="' . $this->_input->html_class() . ' ' . $this->_input->button_css_attributes() . '" '; |
|
23 | - $html .= 'style="' . $this->_input->html_style() . '" '; |
|
19 | + $html .= 'name="'.$this->_input->html_name().'" '; |
|
20 | + $html .= 'value="'.$this->_input->raw_value_in_form().'" '; |
|
21 | + $html .= 'id="'.$this->_input->html_id().'-submit" '; |
|
22 | + $html .= 'class="'.$this->_input->html_class().' '.$this->_input->button_css_attributes().'" '; |
|
23 | + $html .= 'style="'.$this->_input->html_style().'" '; |
|
24 | 24 | $html .= $this->_input->other_html_attributes(); |
25 | 25 | $html .= '/>'; |
26 | 26 | return $html; |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | if( isset( $this->_children[ $code ] ) ) { |
672 | 672 | unset( $this->_children[ $code ] ); |
673 | 673 | return 1; |
674 | - }else{ |
|
674 | + } else{ |
|
675 | 675 | return 0; |
676 | 676 | } |
677 | 677 | } |
@@ -1110,10 +1110,10 @@ discard block |
||
1110 | 1110 | //that's taxable too (the taxable total so far) |
1111 | 1111 | if( $child_line_item->is_percent() ) { |
1112 | 1112 | $total = $total + ( $total * $child_line_item->percent() / 100 ); |
1113 | - }else{ |
|
1113 | + } else{ |
|
1114 | 1114 | $total += $child_line_item->total(); |
1115 | 1115 | } |
1116 | - }elseif( $child_line_item->type() === EEM_Line_Item::type_sub_total ){ |
|
1116 | + } elseif( $child_line_item->type() === EEM_Line_Item::type_sub_total ){ |
|
1117 | 1117 | $total += $child_line_item->taxable_total(); |
1118 | 1118 | } |
1119 | 1119 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * date_format and the second value is the time format |
51 | 51 | * @return EE_Line_Item |
52 | 52 | */ |
53 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
54 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
55 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
53 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
54 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
55 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * the website will be used. |
64 | 64 | * @return EE_Line_Item |
65 | 65 | */ |
66 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
67 | - return new self( $props_n_values, TRUE, $timezone ); |
|
66 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
67 | + return new self($props_n_values, TRUE, $timezone); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | * @param bool $bydb |
76 | 76 | * @param string $timezone |
77 | 77 | */ |
78 | - protected function __construct( $fieldValues = array(), $bydb = FALSE, $timezone = '' ) { |
|
79 | - parent::__construct( $fieldValues, $bydb, $timezone ); |
|
80 | - if ( ! $this->get( 'LIN_code' ) ) { |
|
81 | - $this->set_code( $this->generate_code() ); |
|
78 | + protected function __construct($fieldValues = array(), $bydb = FALSE, $timezone = '') { |
|
79 | + parent::__construct($fieldValues, $bydb, $timezone); |
|
80 | + if ( ! $this->get('LIN_code')) { |
|
81 | + $this->set_code($this->generate_code()); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return int |
90 | 90 | */ |
91 | 91 | public function ID() { |
92 | - return $this->get( 'LIN_ID' ); |
|
92 | + return $this->get('LIN_ID'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return int |
100 | 100 | */ |
101 | 101 | public function TXN_ID() { |
102 | - return $this->get( 'TXN_ID' ); |
|
102 | + return $this->get('TXN_ID'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * Sets TXN_ID |
109 | 109 | * @param int $TXN_ID |
110 | 110 | */ |
111 | - public function set_TXN_ID( $TXN_ID ) { |
|
112 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
111 | + public function set_TXN_ID($TXN_ID) { |
|
112 | + $this->set('TXN_ID', $TXN_ID); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | * @return string |
120 | 120 | */ |
121 | 121 | public function name() { |
122 | - $name = $this->get( 'LIN_name' ); |
|
123 | - if( ! $name ){ |
|
124 | - $name = ucwords( str_replace( '-', ' ', $this->type() ) ); |
|
122 | + $name = $this->get('LIN_name'); |
|
123 | + if ( ! $name) { |
|
124 | + $name = ucwords(str_replace('-', ' ', $this->type())); |
|
125 | 125 | } |
126 | 126 | return $name; |
127 | 127 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * Sets name |
133 | 133 | * @param string $name |
134 | 134 | */ |
135 | - public function set_name( $name ) { |
|
136 | - $this->set( 'LIN_name', $name ); |
|
135 | + public function set_name($name) { |
|
136 | + $this->set('LIN_name', $name); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return string |
144 | 144 | */ |
145 | 145 | public function desc() { |
146 | - return $this->get( 'LIN_desc' ); |
|
146 | + return $this->get('LIN_desc'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * Sets desc |
153 | 153 | * @param string $desc |
154 | 154 | */ |
155 | - public function set_desc( $desc ) { |
|
156 | - $this->set( 'LIN_desc', $desc ); |
|
155 | + public function set_desc($desc) { |
|
156 | + $this->set('LIN_desc', $desc); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @return int |
164 | 164 | */ |
165 | 165 | public function quantity() { |
166 | - return $this->get( 'LIN_quantity' ); |
|
166 | + return $this->get('LIN_quantity'); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | * Sets quantity |
173 | 173 | * @param int $quantity |
174 | 174 | */ |
175 | - public function set_quantity( $quantity ) { |
|
176 | - $this->set( 'LIN_quantity', max( $quantity, 0 ) ); |
|
175 | + public function set_quantity($quantity) { |
|
176 | + $this->set('LIN_quantity', max($quantity, 0)); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return string |
184 | 184 | */ |
185 | 185 | public function OBJ_ID() { |
186 | - return $this->get( 'OBJ_ID' ); |
|
186 | + return $this->get('OBJ_ID'); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | * Sets item_id |
193 | 193 | * @param string $item_id |
194 | 194 | */ |
195 | - public function set_OBJ_ID( $item_id ) { |
|
196 | - $this->set( 'OBJ_ID', $item_id ); |
|
195 | + public function set_OBJ_ID($item_id) { |
|
196 | + $this->set('OBJ_ID', $item_id); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return string |
204 | 204 | */ |
205 | 205 | public function OBJ_type() { |
206 | - return $this->get( 'OBJ_type' ); |
|
206 | + return $this->get('OBJ_type'); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | * Sets item_type |
241 | 241 | * @param string $OBJ_type |
242 | 242 | */ |
243 | - public function set_OBJ_type( $OBJ_type ) { |
|
244 | - $this->set( 'OBJ_type', $OBJ_type ); |
|
243 | + public function set_OBJ_type($OBJ_type) { |
|
244 | + $this->set('OBJ_type', $OBJ_type); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @return float |
252 | 252 | */ |
253 | 253 | public function unit_price() { |
254 | - return $this->get( 'LIN_unit_price' ); |
|
254 | + return $this->get('LIN_unit_price'); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | * |
262 | 262 | * @param float $unit_price |
263 | 263 | */ |
264 | - public function set_unit_price( $unit_price ) { |
|
265 | - $this->set( 'LIN_unit_price', $unit_price ); |
|
264 | + public function set_unit_price($unit_price) { |
|
265 | + $this->set('LIN_unit_price', $unit_price); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -273,19 +273,19 @@ discard block |
||
273 | 273 | * @return boolean |
274 | 274 | */ |
275 | 275 | public function is_percent() { |
276 | - if( $this->is_tax_sub_total() ) { |
|
276 | + if ($this->is_tax_sub_total()) { |
|
277 | 277 | //tax subtotals HAVE a percent on them, that percentage only applies |
278 | 278 | //to taxable items, so its' an exception. Treat it like a flat line item |
279 | 279 | return false; |
280 | 280 | } |
281 | - $unit_price = abs( $this->get( 'LIN_unit_price' ) ); |
|
282 | - $percent = abs( $this->get( 'LIN_percent' ) ); |
|
283 | - if ( $unit_price < .001 && $percent ) { |
|
281 | + $unit_price = abs($this->get('LIN_unit_price')); |
|
282 | + $percent = abs($this->get('LIN_percent')); |
|
283 | + if ($unit_price < .001 && $percent) { |
|
284 | 284 | return TRUE; |
285 | - } elseif ( $unit_price >= .001 && !$percent ) { |
|
285 | + } elseif ($unit_price >= .001 && ! $percent) { |
|
286 | 286 | return FALSE; |
287 | - } elseif ( $unit_price >= .001 && $percent ) { |
|
288 | - throw new EE_Error( sprintf( __( "A Line Item can not have a unit price of (%s) AND a percent (%s)!", "event_espresso" ), $unit_price, $percent ) ); |
|
287 | + } elseif ($unit_price >= .001 && $percent) { |
|
288 | + throw new EE_Error(sprintf(__("A Line Item can not have a unit price of (%s) AND a percent (%s)!", "event_espresso"), $unit_price, $percent)); |
|
289 | 289 | } else { |
290 | 290 | // if they're both 0, assume its not a percent item |
291 | 291 | return FALSE; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @return float |
300 | 300 | */ |
301 | 301 | public function percent() { |
302 | - return $this->get( 'LIN_percent' ); |
|
302 | + return $this->get('LIN_percent'); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -308,8 +308,8 @@ discard block |
||
308 | 308 | * Sets percent (between 100-0.01) |
309 | 309 | * @param float $percent |
310 | 310 | */ |
311 | - public function set_percent( $percent ) { |
|
312 | - $this->set( 'LIN_percent', $percent ); |
|
311 | + public function set_percent($percent) { |
|
312 | + $this->set('LIN_percent', $percent); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @return float |
320 | 320 | */ |
321 | 321 | public function total() { |
322 | - return $this->get( 'LIN_total' ); |
|
322 | + return $this->get('LIN_total'); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | * Sets total |
329 | 329 | * @param float $total |
330 | 330 | */ |
331 | - public function set_total( $total ) { |
|
332 | - $this->set( 'LIN_total', $total ); |
|
331 | + public function set_total($total) { |
|
332 | + $this->set('LIN_total', $total); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | * @return int |
340 | 340 | */ |
341 | 341 | public function order() { |
342 | - return $this->get( 'LIN_order' ); |
|
342 | + return $this->get('LIN_order'); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | |
@@ -348,8 +348,8 @@ discard block |
||
348 | 348 | * Sets order |
349 | 349 | * @param int $order |
350 | 350 | */ |
351 | - public function set_order( $order ) { |
|
352 | - $this->set( 'LIN_order', $order ); |
|
351 | + public function set_order($order) { |
|
352 | + $this->set('LIN_order', $order); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @return int |
360 | 360 | */ |
361 | 361 | public function parent_ID() { |
362 | - return $this->get( 'LIN_parent' ); |
|
362 | + return $this->get('LIN_parent'); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | * Sets parent |
369 | 369 | * @param int $parent |
370 | 370 | */ |
371 | - public function set_parent_ID( $parent ) { |
|
372 | - $this->set( 'LIN_parent', $parent ); |
|
371 | + public function set_parent_ID($parent) { |
|
372 | + $this->set('LIN_parent', $parent); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * @return string |
380 | 380 | */ |
381 | 381 | public function type() { |
382 | - return $this->get( 'LIN_type' ); |
|
382 | + return $this->get('LIN_type'); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | |
@@ -388,8 +388,8 @@ discard block |
||
388 | 388 | * Sets type |
389 | 389 | * @param string $type |
390 | 390 | */ |
391 | - public function set_type( $type ) { |
|
392 | - $this->set( 'LIN_type', $type ); |
|
391 | + public function set_type($type) { |
|
392 | + $this->set('LIN_type', $type); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
@@ -402,8 +402,8 @@ discard block |
||
402 | 402 | * @return EE_Line_Item |
403 | 403 | */ |
404 | 404 | public function parent() { |
405 | - if( $this->ID() ) { |
|
406 | - return $this->get_model()->get_one_by_ID( $this->parent_ID() ); |
|
405 | + if ($this->ID()) { |
|
406 | + return $this->get_model()->get_one_by_ID($this->parent_ID()); |
|
407 | 407 | } else { |
408 | 408 | return $this->_parent; |
409 | 409 | } |
@@ -416,13 +416,13 @@ discard block |
||
416 | 416 | * @return EE_Line_Item[] |
417 | 417 | */ |
418 | 418 | public function children() { |
419 | - if ( $this->ID() ) { |
|
419 | + if ($this->ID()) { |
|
420 | 420 | return $this->get_model()->get_all( |
421 | 421 | array( |
422 | - array( 'LIN_parent' => $this->ID() ), |
|
423 | - 'order_by' => array( 'LIN_order' => 'ASC' ) ) ); |
|
422 | + array('LIN_parent' => $this->ID()), |
|
423 | + 'order_by' => array('LIN_order' => 'ASC') ) ); |
|
424 | 424 | } else { |
425 | - if ( ! is_array( $this->_children ) ) { |
|
425 | + if ( ! is_array($this->_children)) { |
|
426 | 426 | $this->_children = array(); |
427 | 427 | } |
428 | 428 | return $this->_children; |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * @return string |
437 | 437 | */ |
438 | 438 | public function code() { |
439 | - return $this->get( 'LIN_code' ); |
|
439 | + return $this->get('LIN_code'); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | |
@@ -445,8 +445,8 @@ discard block |
||
445 | 445 | * Sets code |
446 | 446 | * @param string $code |
447 | 447 | */ |
448 | - public function set_code( $code ) { |
|
449 | - $this->set( 'LIN_code', $code ); |
|
448 | + public function set_code($code) { |
|
449 | + $this->set('LIN_code', $code); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * @return boolean |
457 | 457 | */ |
458 | 458 | public function is_taxable() { |
459 | - return $this->get( 'LIN_is_taxable' ); |
|
459 | + return $this->get('LIN_is_taxable'); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | * Sets is_taxable |
466 | 466 | * @param boolean $is_taxable |
467 | 467 | */ |
468 | - public function set_is_taxable( $is_taxable ) { |
|
469 | - $this->set( 'LIN_is_taxable', $is_taxable ); |
|
468 | + public function set_is_taxable($is_taxable) { |
|
469 | + $this->set('LIN_is_taxable', $is_taxable); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | */ |
482 | 482 | public function get_object() { |
483 | 483 | $model_name_of_related_obj = $this->OBJ_type(); |
484 | - return $this->get_model()->has_relation( $model_name_of_related_obj ) ? $this->get_first_related( $model_name_of_related_obj ) : NULL; |
|
484 | + return $this->get_model()->has_relation($model_name_of_related_obj) ? $this->get_first_related($model_name_of_related_obj) : NULL; |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | |
@@ -492,11 +492,11 @@ discard block |
||
492 | 492 | * @param array $query_params |
493 | 493 | * @return EE_Ticket |
494 | 494 | */ |
495 | - public function ticket( $query_params = array() ) { |
|
495 | + public function ticket($query_params = array()) { |
|
496 | 496 | //we're going to assume that when this method is called we always want to receive the attached ticket EVEN if that ticket is archived. This can be overridden via the incoming $query_params argument |
497 | - $remove_defaults = array( 'default_where_conditions' => 'none' ); |
|
498 | - $query_params = array_merge( $remove_defaults, $query_params ); |
|
499 | - return $this->get_first_related( 'Ticket', $query_params ); |
|
497 | + $remove_defaults = array('default_where_conditions' => 'none'); |
|
498 | + $query_params = array_merge($remove_defaults, $query_params); |
|
499 | + return $this->get_first_related('Ticket', $query_params); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | * @return EE_Datetime | NULL |
507 | 507 | */ |
508 | 508 | public function get_ticket_datetime() { |
509 | - if ( $this->OBJ_type() === 'Ticket' ) { |
|
509 | + if ($this->OBJ_type() === 'Ticket') { |
|
510 | 510 | $ticket = $this->ticket(); |
511 | - if ( $ticket instanceof EE_Ticket ) { |
|
511 | + if ($ticket instanceof EE_Ticket) { |
|
512 | 512 | $datetime = $ticket->first_datetime(); |
513 | - if ( $datetime instanceof EE_Datetime ) { |
|
513 | + if ($datetime instanceof EE_Datetime) { |
|
514 | 514 | return $datetime; |
515 | 515 | } |
516 | 516 | } |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | * @return string |
527 | 527 | */ |
528 | 528 | public function ticket_event_name() { |
529 | - $event_name = __( "Unknown", "event_espresso" ); |
|
529 | + $event_name = __("Unknown", "event_espresso"); |
|
530 | 530 | $event = $this->ticket_event(); |
531 | - if ( $event instanceof EE_Event ) { |
|
531 | + if ($event instanceof EE_Event) { |
|
532 | 532 | $event_name = $event->name(); |
533 | 533 | } |
534 | 534 | return $event_name; |
@@ -542,9 +542,9 @@ discard block |
||
542 | 542 | public function ticket_event() { |
543 | 543 | $event = null; |
544 | 544 | $ticket = $this->ticket(); |
545 | - if ( $ticket instanceof EE_Ticket ) { |
|
545 | + if ($ticket instanceof EE_Ticket) { |
|
546 | 546 | $datetime = $ticket->first_datetime(); |
547 | - if ( $datetime instanceof EE_Datetime ) { |
|
547 | + if ($datetime instanceof EE_Datetime) { |
|
548 | 548 | $event = $datetime->event(); |
549 | 549 | } |
550 | 550 | } |
@@ -559,11 +559,11 @@ discard block |
||
559 | 559 | * @param string $time_format |
560 | 560 | * @return string |
561 | 561 | */ |
562 | - public function ticket_datetime_start( $date_format = '', $time_format = '' ) { |
|
563 | - $first_datetime_string = __( "Unknown", "event_espresso" ); |
|
562 | + public function ticket_datetime_start($date_format = '', $time_format = '') { |
|
563 | + $first_datetime_string = __("Unknown", "event_espresso"); |
|
564 | 564 | $datetime = $this->get_ticket_datetime(); |
565 | - if ( $datetime ) { |
|
566 | - $first_datetime_string = $datetime->start_date_and_time( $date_format, $time_format ); |
|
565 | + if ($datetime) { |
|
566 | + $first_datetime_string = $datetime->start_date_and_time($date_format, $time_format); |
|
567 | 567 | } |
568 | 568 | return $first_datetime_string; |
569 | 569 | } |
@@ -578,26 +578,26 @@ discard block |
||
578 | 578 | * @return bool success |
579 | 579 | * @throws \EE_Error |
580 | 580 | */ |
581 | - public function add_child_line_item( EEI_Line_Item $line_item, $set_order = true ) { |
|
581 | + public function add_child_line_item(EEI_Line_Item $line_item, $set_order = true) { |
|
582 | 582 | // should we calculate the LIN_order for this line item ? |
583 | - if ( $set_order || $line_item->order() === null ) { |
|
584 | - $line_item->set_order( count( $this->children() ) ); |
|
583 | + if ($set_order || $line_item->order() === null) { |
|
584 | + $line_item->set_order(count($this->children())); |
|
585 | 585 | } |
586 | - if ( $this->ID() ) { |
|
586 | + if ($this->ID()) { |
|
587 | 587 | //check for any duplicate line items (with the same code), if so, this replaces it |
588 | - $line_item_with_same_code = $this->get_child_line_item( $line_item->code() ); |
|
589 | - if( $line_item_with_same_code instanceof EE_Line_Item && $line_item_with_same_code !== $line_item ) { |
|
590 | - $this->delete_child_line_item( $line_item_with_same_code->code() ); |
|
588 | + $line_item_with_same_code = $this->get_child_line_item($line_item->code()); |
|
589 | + if ($line_item_with_same_code instanceof EE_Line_Item && $line_item_with_same_code !== $line_item) { |
|
590 | + $this->delete_child_line_item($line_item_with_same_code->code()); |
|
591 | 591 | } |
592 | - $line_item->set_parent_ID( $this->ID() ); |
|
593 | - if( $this->TXN_ID() ){ |
|
594 | - $line_item->set_TXN_ID( $this->TXN_ID() ); |
|
592 | + $line_item->set_parent_ID($this->ID()); |
|
593 | + if ($this->TXN_ID()) { |
|
594 | + $line_item->set_TXN_ID($this->TXN_ID()); |
|
595 | 595 | } |
596 | 596 | return $line_item->save(); |
597 | 597 | } else { |
598 | - $this->_children[ $line_item->code() ] = $line_item; |
|
599 | - if( $line_item->parent() != $this ) { |
|
600 | - $line_item->set_parent( $this ); |
|
598 | + $this->_children[$line_item->code()] = $line_item; |
|
599 | + if ($line_item->parent() != $this) { |
|
600 | + $line_item->set_parent($this); |
|
601 | 601 | } |
602 | 602 | return TRUE; |
603 | 603 | } |
@@ -611,16 +611,16 @@ discard block |
||
611 | 611 | * @param EE_Line_Item $line_item |
612 | 612 | * |
613 | 613 | */ |
614 | - public function set_parent( $line_item ) { |
|
615 | - if ( $this->ID() ) { |
|
616 | - if( ! $line_item->ID() ) { |
|
614 | + public function set_parent($line_item) { |
|
615 | + if ($this->ID()) { |
|
616 | + if ( ! $line_item->ID()) { |
|
617 | 617 | $line_item->save(); |
618 | 618 | } |
619 | - $this->set_parent_ID( $line_item->ID() ); |
|
619 | + $this->set_parent_ID($line_item->ID()); |
|
620 | 620 | $this->save(); |
621 | 621 | } else { |
622 | 622 | $this->_parent = $line_item; |
623 | - $this->set_parent_ID( $line_item->ID() ); |
|
623 | + $this->set_parent_ID($line_item->ID()); |
|
624 | 624 | } |
625 | 625 | } |
626 | 626 | |
@@ -633,11 +633,11 @@ discard block |
||
633 | 633 | * @param string $code |
634 | 634 | * @return EE_Line_Item |
635 | 635 | */ |
636 | - public function get_child_line_item( $code ) { |
|
637 | - if ( $this->ID() ) { |
|
638 | - return $this->get_model()->get_one( array( array( 'LIN_parent' => $this->ID(), 'LIN_code' => $code ) ) ); |
|
636 | + public function get_child_line_item($code) { |
|
637 | + if ($this->ID()) { |
|
638 | + return $this->get_model()->get_one(array(array('LIN_parent' => $this->ID(), 'LIN_code' => $code))); |
|
639 | 639 | } else { |
640 | - return isset( $this->_children[ $code ] ) ? $this->_children[ $code ] : null; |
|
640 | + return isset($this->_children[$code]) ? $this->_children[$code] : null; |
|
641 | 641 | } |
642 | 642 | } |
643 | 643 | |
@@ -648,10 +648,10 @@ discard block |
||
648 | 648 | * @return int |
649 | 649 | */ |
650 | 650 | public function delete_children_line_items() { |
651 | - if ( $this->ID() ) { |
|
652 | - return $this->get_model()->delete( array( array( 'LIN_parent' => $this->ID() ) ) ); |
|
651 | + if ($this->ID()) { |
|
652 | + return $this->get_model()->delete(array(array('LIN_parent' => $this->ID()))); |
|
653 | 653 | } else { |
654 | - $count = count( $this->_children ); |
|
654 | + $count = count($this->_children); |
|
655 | 655 | $this->_children = array(); |
656 | 656 | return $count; |
657 | 657 | } |
@@ -668,25 +668,25 @@ discard block |
||
668 | 668 | * @param bool $stop_search_once_found |
669 | 669 | * @return int count of items deleted (or simply removed from the line item's cache, if not has not been saved to the DB yet) |
670 | 670 | */ |
671 | - public function delete_child_line_item( $code, $stop_search_once_found = true ) { |
|
672 | - if ( $this->ID() ) { |
|
671 | + public function delete_child_line_item($code, $stop_search_once_found = true) { |
|
672 | + if ($this->ID()) { |
|
673 | 673 | $items_deleted = 0; |
674 | - if( $this->code() == $code ) { |
|
675 | - $items_deleted += EEH_Line_Item::delete_all_child_items( $this ); |
|
674 | + if ($this->code() == $code) { |
|
675 | + $items_deleted += EEH_Line_Item::delete_all_child_items($this); |
|
676 | 676 | $items_deleted += (int) $this->delete(); |
677 | - if( $stop_search_once_found ){ |
|
677 | + if ($stop_search_once_found) { |
|
678 | 678 | return $items_deleted; |
679 | 679 | } |
680 | 680 | } |
681 | - foreach( $this->children() as $child_line_item ) { |
|
682 | - $items_deleted += $child_line_item->delete_child_line_item( $code, $stop_search_once_found ); |
|
681 | + foreach ($this->children() as $child_line_item) { |
|
682 | + $items_deleted += $child_line_item->delete_child_line_item($code, $stop_search_once_found); |
|
683 | 683 | } |
684 | 684 | return $items_deleted; |
685 | 685 | } else { |
686 | - if( isset( $this->_children[ $code ] ) ) { |
|
687 | - unset( $this->_children[ $code ] ); |
|
686 | + if (isset($this->_children[$code])) { |
|
687 | + unset($this->_children[$code]); |
|
688 | 688 | return 1; |
689 | - }else{ |
|
689 | + } else { |
|
690 | 690 | return 0; |
691 | 691 | } |
692 | 692 | } |
@@ -699,9 +699,9 @@ discard block |
||
699 | 699 | * @return boolean |
700 | 700 | */ |
701 | 701 | public function delete_if_childless_subtotal() { |
702 | - if( $this->ID() && |
|
702 | + if ($this->ID() && |
|
703 | 703 | $this->type() == EEM_Line_Item::type_sub_total && |
704 | - ! $this->children() ) { |
|
704 | + ! $this->children()) { |
|
705 | 705 | return $this->delete(); |
706 | 706 | } else { |
707 | 707 | return false; |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | */ |
717 | 717 | public function generate_code() { |
718 | 718 | // each line item in the cart requires a unique identifier |
719 | - return md5( $this->get( 'OBJ_type' ) . $this->get( 'OBJ_ID' ) . microtime() ); |
|
719 | + return md5($this->get('OBJ_type').$this->get('OBJ_ID').microtime()); |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | * @return string like '2, 004.00', formatted according to the localized currency |
800 | 800 | */ |
801 | 801 | public function unit_price_no_code() { |
802 | - return $this->get_pretty( 'LIN_unit_price', 'no_currency_code' ); |
|
802 | + return $this->get_pretty('LIN_unit_price', 'no_currency_code'); |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | * @return string like '2, 004.00', formatted according to the localized currency |
810 | 810 | */ |
811 | 811 | public function total_no_code() { |
812 | - return $this->get_pretty( 'LIN_total', 'no_currency_code' ); |
|
812 | + return $this->get_pretty('LIN_total', 'no_currency_code'); |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | |
@@ -829,17 +829,17 @@ discard block |
||
829 | 829 | $tax_total = $this->recalculate_taxes_and_tax_total(); |
830 | 830 | $total = $pre_tax_total + $tax_total; |
831 | 831 | // no negative totals plz |
832 | - $total = max( $total, 0 ); |
|
833 | - $this->set_total( $total ); |
|
832 | + $total = max($total, 0); |
|
833 | + $this->set_total($total); |
|
834 | 834 | //only update the related transaction's total |
835 | 835 | //if we intend to save this line item and its a grand total |
836 | - if( |
|
836 | + if ( |
|
837 | 837 | $this->allow_persist() && |
838 | 838 | $this->type() === EEM_Line_Item::type_total && |
839 | 839 | $this->transaction() instanceof EE_Transaction |
840 | - ){ |
|
841 | - $this->transaction()->set_total( $total ); |
|
842 | - if ( $this->transaction()->ID() ) { |
|
840 | + ) { |
|
841 | + $this->transaction()->set_total($total); |
|
842 | + if ($this->transaction()->ID()) { |
|
843 | 843 | $this->transaction()->save(); |
844 | 844 | } |
845 | 845 | } |
@@ -858,47 +858,47 @@ discard block |
||
858 | 858 | public function recalculate_pre_tax_total() { |
859 | 859 | $total = 0; |
860 | 860 | $my_children = $this->children(); |
861 | - $has_children = ! empty( $my_children ); |
|
862 | - if ( $has_children && $this->is_line_item() ) { |
|
863 | - $total = $this->_recalculate_pretax_total_for_line_item( $total, $my_children ); |
|
864 | - } elseif ( ! $has_children && ( $this->is_sub_line_item() || $this->is_line_item() ) ) { |
|
861 | + $has_children = ! empty($my_children); |
|
862 | + if ($has_children && $this->is_line_item()) { |
|
863 | + $total = $this->_recalculate_pretax_total_for_line_item($total, $my_children); |
|
864 | + } elseif ( ! $has_children && ($this->is_sub_line_item() || $this->is_line_item())) { |
|
865 | 865 | $total = $this->unit_price() * $this->quantity(); |
866 | - } elseif( $this->is_sub_total() || $this->is_total() ) { |
|
867 | - $total = $this->_recalculate_pretax_total_for_subtotal( $total, $my_children ); |
|
868 | - } elseif ( $this->is_tax_sub_total() || $this->is_tax() || $this->is_cancelled() ) { |
|
866 | + } elseif ($this->is_sub_total() || $this->is_total()) { |
|
867 | + $total = $this->_recalculate_pretax_total_for_subtotal($total, $my_children); |
|
868 | + } elseif ($this->is_tax_sub_total() || $this->is_tax() || $this->is_cancelled()) { |
|
869 | 869 | // completely ignore tax totals, tax sub-totals, and cancelled line items, when calculating the pre-tax-total |
870 | 870 | return 0; |
871 | 871 | } |
872 | 872 | // ensure all non-line items and non-sub-line-items have a quantity of 1 (except for Events) |
873 | - if( |
|
873 | + if ( |
|
874 | 874 | ! $this->is_line_item() && |
875 | 875 | ! $this->is_sub_line_item() && |
876 | 876 | ! $this->is_cancellation() |
877 | 877 | ) { |
878 | - if ( $this->OBJ_type() !== 'Event' ) { |
|
879 | - $this->set_quantity( 1 ); |
|
878 | + if ($this->OBJ_type() !== 'Event') { |
|
879 | + $this->set_quantity(1); |
|
880 | 880 | } |
881 | - if( ! $this->is_percent() ) { |
|
882 | - $this->set_unit_price( $this->total() ); |
|
881 | + if ( ! $this->is_percent()) { |
|
882 | + $this->set_unit_price($this->total()); |
|
883 | 883 | } |
884 | 884 | } |
885 | 885 | |
886 | 886 | //we don't want to bother saving grand totals, because that needs to factor in taxes anyways |
887 | 887 | //so it ought to be |
888 | - if( ! $this->is_total() ) { |
|
889 | - $this->set_total( $total ); |
|
888 | + if ( ! $this->is_total()) { |
|
889 | + $this->set_total($total); |
|
890 | 890 | //if not a percent line item, make sure we keep the unit price in sync |
891 | - if( |
|
891 | + if ( |
|
892 | 892 | $has_children |
893 | 893 | && $this->is_line_item() |
894 | 894 | && ! $this->is_percent() |
895 | 895 | ) { |
896 | - if( $this->quantity() === 0 ){ |
|
896 | + if ($this->quantity() === 0) { |
|
897 | 897 | $new_unit_price = 0; |
898 | 898 | } else { |
899 | 899 | $new_unit_price = $this->total() / $this->quantity(); |
900 | 900 | } |
901 | - $this->set_unit_price( $new_unit_price ); |
|
901 | + $this->set_unit_price($new_unit_price); |
|
902 | 902 | } |
903 | 903 | $this->maybe_save(); |
904 | 904 | } |
@@ -918,39 +918,39 @@ discard block |
||
918 | 918 | * @return float |
919 | 919 | * @throws \EE_Error |
920 | 920 | */ |
921 | - protected function _recalculate_pretax_total_for_subtotal( $calculated_total_so_far, $my_children = null ) { |
|
922 | - if( $my_children === null ) { |
|
921 | + protected function _recalculate_pretax_total_for_subtotal($calculated_total_so_far, $my_children = null) { |
|
922 | + if ($my_children === null) { |
|
923 | 923 | $my_children = $this->children(); |
924 | 924 | } |
925 | 925 | //get the total of all its children |
926 | - foreach ( $my_children as $child_line_item ) { |
|
927 | - if ( $child_line_item instanceof EE_Line_Item && ! $child_line_item->is_cancellation() ) { |
|
926 | + foreach ($my_children as $child_line_item) { |
|
927 | + if ($child_line_item instanceof EE_Line_Item && ! $child_line_item->is_cancellation()) { |
|
928 | 928 | // percentage line items are based on total so far |
929 | - if ( $child_line_item->is_percent() ) { |
|
929 | + if ($child_line_item->is_percent()) { |
|
930 | 930 | //round as we go so that the line items add up ok |
931 | 931 | $percent_total = round( |
932 | 932 | $calculated_total_so_far * $child_line_item->percent() / 100, |
933 | 933 | EE_Registry::instance()->CFG->currency->dec_plc |
934 | 934 | ); |
935 | - $child_line_item->set_total( $percent_total ); |
|
935 | + $child_line_item->set_total($percent_total); |
|
936 | 936 | //so far all percent line items should have a quantity of 1 |
937 | 937 | //(ie, no double percent discounts. Although that might be requested someday) |
938 | - $child_line_item->set_quantity( 1 ); |
|
938 | + $child_line_item->set_quantity(1); |
|
939 | 939 | $child_line_item->maybe_save(); |
940 | 940 | $calculated_total_so_far += $percent_total; |
941 | 941 | } else { |
942 | 942 | //verify flat sub-line-item quantities match their parent |
943 | - if( $child_line_item->is_sub_line_item() ) { |
|
944 | - $child_line_item->set_quantity( $this->quantity() ); |
|
943 | + if ($child_line_item->is_sub_line_item()) { |
|
944 | + $child_line_item->set_quantity($this->quantity()); |
|
945 | 945 | } |
946 | 946 | $calculated_total_so_far += $child_line_item->recalculate_pre_tax_total(); |
947 | 947 | } |
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
951 | - if( $this->is_sub_total() ){ |
|
951 | + if ($this->is_sub_total()) { |
|
952 | 952 | // no negative totals plz |
953 | - $calculated_total_so_far = max( $calculated_total_so_far, 0 ); |
|
953 | + $calculated_total_so_far = max($calculated_total_so_far, 0); |
|
954 | 954 | } |
955 | 955 | return $calculated_total_so_far; |
956 | 956 | } |
@@ -968,8 +968,8 @@ discard block |
||
968 | 968 | * @return float |
969 | 969 | * @throws \EE_Error |
970 | 970 | */ |
971 | - protected function _recalculate_pretax_total_for_line_item( $calculated_total_so_far, $my_children = null ) { |
|
972 | - if( $my_children === null ) { |
|
971 | + protected function _recalculate_pretax_total_for_line_item($calculated_total_so_far, $my_children = null) { |
|
972 | + if ($my_children === null) { |
|
973 | 973 | $my_children = $this->children(); |
974 | 974 | } |
975 | 975 | //we need to keep track of the running total for a single item, |
@@ -977,10 +977,10 @@ discard block |
||
977 | 977 | $unit_price_for_total = 0; |
978 | 978 | $quantity_for_total = 1; |
979 | 979 | //get the total of all its children |
980 | - foreach ( $my_children as $child_line_item ) { |
|
981 | - if ( $child_line_item instanceof EE_Line_Item && |
|
980 | + foreach ($my_children as $child_line_item) { |
|
981 | + if ($child_line_item instanceof EE_Line_Item && |
|
982 | 982 | ! $child_line_item->is_cancellation()) { |
983 | - if ( $child_line_item->is_percent() ) { |
|
983 | + if ($child_line_item->is_percent()) { |
|
984 | 984 | //it should be the unit-price-so-far multiplied by teh percent multiplied by the quantity |
985 | 985 | //not total multiplied by percent, because that ignores rounding along-the-way |
986 | 986 | $percent_unit_price = round( |
@@ -988,17 +988,17 @@ discard block |
||
988 | 988 | EE_Registry::instance()->CFG->currency->dec_plc |
989 | 989 | ); |
990 | 990 | $percent_total = $percent_unit_price * $quantity_for_total; |
991 | - $child_line_item->set_total( $percent_total ); |
|
991 | + $child_line_item->set_total($percent_total); |
|
992 | 992 | //so far all percent line items should have a quantity of 1 |
993 | 993 | //(ie, no double percent discounts. Although that might be requested someday) |
994 | - $child_line_item->set_quantity( 1 ); |
|
994 | + $child_line_item->set_quantity(1); |
|
995 | 995 | $child_line_item->maybe_save(); |
996 | 996 | $calculated_total_so_far += $percent_total; |
997 | 997 | $unit_price_for_total += $percent_unit_price; |
998 | 998 | } else { |
999 | 999 | //verify flat sub-line-item quantities match their parent |
1000 | - if( $child_line_item->is_sub_line_item() ) { |
|
1001 | - $child_line_item->set_quantity( $this->quantity() ); |
|
1000 | + if ($child_line_item->is_sub_line_item()) { |
|
1001 | + $child_line_item->set_quantity($this->quantity()); |
|
1002 | 1002 | } |
1003 | 1003 | $quantity_for_total = $child_line_item->quantity(); |
1004 | 1004 | $calculated_total_so_far += $child_line_item->recalculate_pre_tax_total(); |
@@ -1022,10 +1022,10 @@ discard block |
||
1022 | 1022 | //calculate the pretax total |
1023 | 1023 | $taxable_total = $this->taxable_total(); |
1024 | 1024 | $tax_total = 0; |
1025 | - foreach ( $taxes as $tax ) { |
|
1025 | + foreach ($taxes as $tax) { |
|
1026 | 1026 | $total_on_this_tax = $taxable_total * $tax->percent() / 100; |
1027 | 1027 | //remember the total on this line item |
1028 | - $tax->set_total( $total_on_this_tax ); |
|
1028 | + $tax->set_total($total_on_this_tax); |
|
1029 | 1029 | $tax_total += $tax->total(); |
1030 | 1030 | } |
1031 | 1031 | $this->_recalculate_tax_sub_total(); |
@@ -1039,21 +1039,21 @@ discard block |
||
1039 | 1039 | * @return void |
1040 | 1040 | */ |
1041 | 1041 | private function _recalculate_tax_sub_total() { |
1042 | - if ( $this->is_tax_sub_total() ) { |
|
1042 | + if ($this->is_tax_sub_total()) { |
|
1043 | 1043 | $total = 0; |
1044 | 1044 | $total_percent = 0; |
1045 | 1045 | //simply loop through all its children (which should be taxes) and sum their total |
1046 | - foreach ( $this->children() as $child_tax ) { |
|
1047 | - if ( $child_tax instanceof EE_Line_Item ) { |
|
1046 | + foreach ($this->children() as $child_tax) { |
|
1047 | + if ($child_tax instanceof EE_Line_Item) { |
|
1048 | 1048 | $total += $child_tax->total(); |
1049 | 1049 | $total_percent += $child_tax->percent(); |
1050 | 1050 | } |
1051 | 1051 | } |
1052 | - $this->set_total( $total ); |
|
1053 | - $this->set_percent( $total_percent ); |
|
1054 | - } elseif ( $this->is_total() ) { |
|
1055 | - foreach ( $this->children() as $maybe_tax_subtotal ) { |
|
1056 | - if ( $maybe_tax_subtotal instanceof EE_Line_Item ) { |
|
1052 | + $this->set_total($total); |
|
1053 | + $this->set_percent($total_percent); |
|
1054 | + } elseif ($this->is_total()) { |
|
1055 | + foreach ($this->children() as $maybe_tax_subtotal) { |
|
1056 | + if ($maybe_tax_subtotal instanceof EE_Line_Item) { |
|
1057 | 1057 | $maybe_tax_subtotal->_recalculate_tax_sub_total(); |
1058 | 1058 | } |
1059 | 1059 | } |
@@ -1069,8 +1069,8 @@ discard block |
||
1069 | 1069 | public function get_total_tax() { |
1070 | 1070 | $this->_recalculate_tax_sub_total(); |
1071 | 1071 | $total = 0; |
1072 | - foreach ( $this->tax_descendants() as $tax_line_item ) { |
|
1073 | - if ( $tax_line_item instanceof EE_Line_Item ) { |
|
1072 | + foreach ($this->tax_descendants() as $tax_line_item) { |
|
1073 | + if ($tax_line_item instanceof EE_Line_Item) { |
|
1074 | 1074 | $total += $tax_line_item->total(); |
1075 | 1075 | } |
1076 | 1076 | } |
@@ -1084,15 +1084,15 @@ discard block |
||
1084 | 1084 | */ |
1085 | 1085 | public function get_items_total() { |
1086 | 1086 | //by default, let's make sure we're consistent with the existing line item |
1087 | - if( $this->is_total() ) { |
|
1088 | - $pretax_subtotal_li = EEH_Line_Item::get_pre_tax_subtotal( $this ); |
|
1089 | - if( $pretax_subtotal_li instanceof EE_Line_Item ) { |
|
1087 | + if ($this->is_total()) { |
|
1088 | + $pretax_subtotal_li = EEH_Line_Item::get_pre_tax_subtotal($this); |
|
1089 | + if ($pretax_subtotal_li instanceof EE_Line_Item) { |
|
1090 | 1090 | return $pretax_subtotal_li->total(); |
1091 | 1091 | } |
1092 | 1092 | } |
1093 | 1093 | $total = 0; |
1094 | - foreach ( $this->get_items() as $item ) { |
|
1095 | - if ( $item instanceof EE_Line_Item ) { |
|
1094 | + foreach ($this->get_items() as $item) { |
|
1095 | + if ($item instanceof EE_Line_Item) { |
|
1096 | 1096 | $total += $item->total(); |
1097 | 1097 | } |
1098 | 1098 | } |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | * @return EE_Line_Item[] |
1108 | 1108 | */ |
1109 | 1109 | public function tax_descendants() { |
1110 | - return EEH_Line_Item::get_tax_descendants( $this ); |
|
1110 | + return EEH_Line_Item::get_tax_descendants($this); |
|
1111 | 1111 | } |
1112 | 1112 | |
1113 | 1113 | |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | * @return EE_Line_Item[] |
1118 | 1118 | */ |
1119 | 1119 | public function get_items() { |
1120 | - return EEH_Line_Item::get_line_item_descendants( $this ); |
|
1120 | + return EEH_Line_Item::get_line_item_descendants($this); |
|
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | |
@@ -1133,22 +1133,22 @@ discard block |
||
1133 | 1133 | */ |
1134 | 1134 | public function taxable_total() { |
1135 | 1135 | $total = 0; |
1136 | - if ( $this->children() ) { |
|
1137 | - foreach ( $this->children() as $child_line_item ) { |
|
1138 | - if ( $child_line_item->type() === EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) { |
|
1136 | + if ($this->children()) { |
|
1137 | + foreach ($this->children() as $child_line_item) { |
|
1138 | + if ($child_line_item->type() === EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) { |
|
1139 | 1139 | //if it's a percent item, only take into account the percent |
1140 | 1140 | //that's taxable too (the taxable total so far) |
1141 | - if( $child_line_item->is_percent() ) { |
|
1142 | - $total = $total + ( $total * $child_line_item->percent() / 100 ); |
|
1143 | - }else{ |
|
1141 | + if ($child_line_item->is_percent()) { |
|
1142 | + $total = $total + ($total * $child_line_item->percent() / 100); |
|
1143 | + } else { |
|
1144 | 1144 | $total += $child_line_item->total(); |
1145 | 1145 | } |
1146 | - }elseif( $child_line_item->type() === EEM_Line_Item::type_sub_total ){ |
|
1146 | + }elseif ($child_line_item->type() === EEM_Line_Item::type_sub_total) { |
|
1147 | 1147 | $total += $child_line_item->taxable_total(); |
1148 | 1148 | } |
1149 | 1149 | } |
1150 | 1150 | } |
1151 | - return max( $total, 0 ); |
|
1151 | + return max($total, 0); |
|
1152 | 1152 | } |
1153 | 1153 | |
1154 | 1154 | |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | * @return EE_Transaction |
1159 | 1159 | */ |
1160 | 1160 | public function transaction() { |
1161 | - return $this->get_first_related( 'Transaction' ); |
|
1161 | + return $this->get_first_related('Transaction'); |
|
1162 | 1162 | } |
1163 | 1163 | |
1164 | 1164 | |
@@ -1171,18 +1171,18 @@ discard block |
||
1171 | 1171 | * @param int $txn_id if none is provided, assumes $this->TXN_ID() |
1172 | 1172 | * @return int count of items saved |
1173 | 1173 | */ |
1174 | - public function save_this_and_descendants_to_txn( $txn_id = NULL ) { |
|
1174 | + public function save_this_and_descendants_to_txn($txn_id = NULL) { |
|
1175 | 1175 | $count = 0; |
1176 | - if ( ! $txn_id ) { |
|
1176 | + if ( ! $txn_id) { |
|
1177 | 1177 | $txn_id = $this->TXN_ID(); |
1178 | 1178 | } |
1179 | - $this->set_TXN_ID( $txn_id ); |
|
1179 | + $this->set_TXN_ID($txn_id); |
|
1180 | 1180 | $children = $this->children(); |
1181 | 1181 | $count += $this->save() ? 1 : 0; |
1182 | - foreach ( $children as $child_line_item ) { |
|
1183 | - if ( $child_line_item instanceof EE_Line_Item ) { |
|
1184 | - $child_line_item->set_parent_ID( $this->ID() ); |
|
1185 | - $count += $child_line_item->save_this_and_descendants_to_txn( $txn_id ); |
|
1182 | + foreach ($children as $child_line_item) { |
|
1183 | + if ($child_line_item instanceof EE_Line_Item) { |
|
1184 | + $child_line_item->set_parent_ID($this->ID()); |
|
1185 | + $count += $child_line_item->save_this_and_descendants_to_txn($txn_id); |
|
1186 | 1186 | } |
1187 | 1187 | } |
1188 | 1188 | return $count; |
@@ -1199,9 +1199,9 @@ discard block |
||
1199 | 1199 | $count = 0; |
1200 | 1200 | $children = $this->children(); |
1201 | 1201 | $count += $this->save() ? 1 : 0; |
1202 | - foreach ( $children as $child_line_item ) { |
|
1203 | - if ( $child_line_item instanceof EE_Line_Item ) { |
|
1204 | - $child_line_item->set_parent_ID( $this->ID() ); |
|
1202 | + foreach ($children as $child_line_item) { |
|
1203 | + if ($child_line_item instanceof EE_Line_Item) { |
|
1204 | + $child_line_item->set_parent_ID($this->ID()); |
|
1205 | 1205 | $count += $child_line_item->save_this_and_descendants(); |
1206 | 1206 | } |
1207 | 1207 | } |
@@ -1215,8 +1215,8 @@ discard block |
||
1215 | 1215 | * @return EE_Line_Item[] |
1216 | 1216 | */ |
1217 | 1217 | public function get_cancellations() { |
1218 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
1219 | - return EEH_Line_Item::get_descendants_of_type( $this, EEM_Line_Item::type_cancellation ); |
|
1218 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
1219 | + return EEH_Line_Item::get_descendants_of_type($this, EEM_Line_Item::type_cancellation); |
|
1220 | 1220 | } |
1221 | 1221 | |
1222 | 1222 | |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | * @return int count of items saved |
1228 | 1228 | */ |
1229 | 1229 | public function maybe_save() { |
1230 | - if ( $this->ID() ) { |
|
1230 | + if ($this->ID()) { |
|
1231 | 1231 | return $this->save(); |
1232 | 1232 | } |
1233 | 1233 | return false; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * Sets quantity |
173 | 173 | * @param int $quantity |
174 | 174 | */ |
175 | - public function set_quantity( $quantity ) { |
|
175 | + public function set_quantity( $quantity ) { |
|
176 | 176 | $this->set( 'LIN_quantity', max( $quantity, 0 ) ); |
177 | 177 | } |
178 | 178 | |
@@ -212,25 +212,25 @@ discard block |
||
212 | 212 | * Gets item_type |
213 | 213 | * @return string |
214 | 214 | */ |
215 | - public function OBJ_type_i18n() { |
|
216 | - $obj_type = $this->OBJ_type(); |
|
217 | - switch ($obj_type) { |
|
218 | - case 'Event': |
|
219 | - $obj_type = __('Event', 'event_espresso'); |
|
220 | - break; |
|
221 | - case 'Price': |
|
222 | - $obj_type = __('Price', 'event_espresso'); |
|
223 | - break; |
|
224 | - case 'Promotion': |
|
225 | - $obj_type = __('Promotion', 'event_espresso'); |
|
226 | - break; |
|
227 | - case 'Ticket': |
|
228 | - $obj_type = __('Ticket', 'event_espresso'); |
|
229 | - break; |
|
230 | - case 'Transaction': |
|
231 | - $obj_type = __('Transaction', 'event_espresso'); |
|
232 | - break; |
|
233 | - } |
|
215 | + public function OBJ_type_i18n() { |
|
216 | + $obj_type = $this->OBJ_type(); |
|
217 | + switch ($obj_type) { |
|
218 | + case 'Event': |
|
219 | + $obj_type = __('Event', 'event_espresso'); |
|
220 | + break; |
|
221 | + case 'Price': |
|
222 | + $obj_type = __('Price', 'event_espresso'); |
|
223 | + break; |
|
224 | + case 'Promotion': |
|
225 | + $obj_type = __('Promotion', 'event_espresso'); |
|
226 | + break; |
|
227 | + case 'Ticket': |
|
228 | + $obj_type = __('Ticket', 'event_espresso'); |
|
229 | + break; |
|
230 | + case 'Transaction': |
|
231 | + $obj_type = __('Transaction', 'event_espresso'); |
|
232 | + break; |
|
233 | + } |
|
234 | 234 | return apply_filters('FHEE__EE_Line_Item__OBJ_type_i18n', $obj_type, $this); |
235 | 235 | } |
236 | 236 | |
@@ -1244,48 +1244,48 @@ discard block |
||
1244 | 1244 | |
1245 | 1245 | |
1246 | 1246 | |
1247 | - /** |
|
1248 | - * @param bool $raw |
|
1249 | - * @return int |
|
1250 | - * @throws \EE_Error |
|
1251 | - */ |
|
1252 | - public function timestamp($raw = false) |
|
1253 | - { |
|
1254 | - return $raw ? $this->get_raw('LIN_timestamp') : $this->get('LIN_timestamp'); |
|
1255 | - } |
|
1247 | + /** |
|
1248 | + * @param bool $raw |
|
1249 | + * @return int |
|
1250 | + * @throws \EE_Error |
|
1251 | + */ |
|
1252 | + public function timestamp($raw = false) |
|
1253 | + { |
|
1254 | + return $raw ? $this->get_raw('LIN_timestamp') : $this->get('LIN_timestamp'); |
|
1255 | + } |
|
1256 | 1256 | |
1257 | 1257 | |
1258 | 1258 | |
1259 | 1259 | |
1260 | - /************************* DEPRECATED *************************/ |
|
1260 | + /************************* DEPRECATED *************************/ |
|
1261 | 1261 | |
1262 | 1262 | |
1263 | 1263 | |
1264 | - /** |
|
1265 | - * @deprecated 4.6.0 |
|
1266 | - * @param string $type one of the constants on EEM_Line_Item |
|
1267 | - * @return EE_Line_Item[] |
|
1268 | - */ |
|
1269 | - protected function _get_descendants_of_type($type) |
|
1270 | - { |
|
1271 | - EE_Error::doing_it_wrong('EE_Line_Item::_get_descendants_of_type()', |
|
1272 | - __('Method replaced with EEH_Line_Item::get_descendants_of_type()', 'event_espresso'), '4.6.0'); |
|
1273 | - return EEH_Line_Item::get_descendants_of_type($this, $type); |
|
1274 | - } |
|
1264 | + /** |
|
1265 | + * @deprecated 4.6.0 |
|
1266 | + * @param string $type one of the constants on EEM_Line_Item |
|
1267 | + * @return EE_Line_Item[] |
|
1268 | + */ |
|
1269 | + protected function _get_descendants_of_type($type) |
|
1270 | + { |
|
1271 | + EE_Error::doing_it_wrong('EE_Line_Item::_get_descendants_of_type()', |
|
1272 | + __('Method replaced with EEH_Line_Item::get_descendants_of_type()', 'event_espresso'), '4.6.0'); |
|
1273 | + return EEH_Line_Item::get_descendants_of_type($this, $type); |
|
1274 | + } |
|
1275 | 1275 | |
1276 | 1276 | |
1277 | 1277 | |
1278 | - /** |
|
1279 | - * @deprecated 4.6.0 |
|
1280 | - * @param string $type like one of the EEM_Line_Item::type_* |
|
1281 | - * @return EE_Line_Item |
|
1282 | - */ |
|
1283 | - public function get_nearest_descendant_of_type($type) |
|
1284 | - { |
|
1285 | - EE_Error::doing_it_wrong('EE_Line_Item::get_nearest_descendant_of_type()', |
|
1286 | - __('Method replaced with EEH_Line_Item::get_nearest_descendant_of_type()', 'event_espresso'), '4.6.0'); |
|
1287 | - return EEH_Line_Item::get_nearest_descendant_of_type($this, $type); |
|
1288 | - } |
|
1278 | + /** |
|
1279 | + * @deprecated 4.6.0 |
|
1280 | + * @param string $type like one of the EEM_Line_Item::type_* |
|
1281 | + * @return EE_Line_Item |
|
1282 | + */ |
|
1283 | + public function get_nearest_descendant_of_type($type) |
|
1284 | + { |
|
1285 | + EE_Error::doing_it_wrong('EE_Line_Item::get_nearest_descendant_of_type()', |
|
1286 | + __('Method replaced with EEH_Line_Item::get_nearest_descendant_of_type()', 'event_espresso'), '4.6.0'); |
|
1287 | + return EEH_Line_Item::get_nearest_descendant_of_type($this, $type); |
|
1288 | + } |
|
1289 | 1289 | |
1290 | 1290 | |
1291 | 1291 |
@@ -111,12 +111,12 @@ |
||
111 | 111 | public function previous(); |
112 | 112 | |
113 | 113 | /** |
114 | - * Returns the index of a given object, or false if not found |
|
115 | - * |
|
116 | - * @see http://stackoverflow.com/a/8736013 |
|
117 | - * @param $object |
|
118 | - * @return boolean|int|string |
|
119 | - */ |
|
114 | + * Returns the index of a given object, or false if not found |
|
115 | + * |
|
116 | + * @see http://stackoverflow.com/a/8736013 |
|
117 | + * @param $object |
|
118 | + * @return boolean|int|string |
|
119 | + */ |
|
120 | 120 | public function indexOf( $object ); |
121 | 121 | |
122 | 122 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\collections; |
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,7 +25,7 @@ discard block |
||
25 | 25 | * @param mixed $identifier |
26 | 26 | * @return bool |
27 | 27 | */ |
28 | - public function add( $object, $identifier = null ); |
|
28 | + public function add($object, $identifier = null); |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * setIdentifier |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param mixed $identifier |
38 | 38 | * @return bool |
39 | 39 | */ |
40 | - public function setIdentifier( $object, $identifier = null ); |
|
40 | + public function setIdentifier($object, $identifier = null); |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * get |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param mixed $identifier |
49 | 49 | * @return mixed |
50 | 50 | */ |
51 | - public function get( $identifier ); |
|
51 | + public function get($identifier); |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * has |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param mixed $identifier |
61 | 61 | * @return bool |
62 | 62 | */ |
63 | - public function has( $identifier ); |
|
63 | + public function has($identifier); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * hasObject |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param $object |
71 | 71 | * @return bool |
72 | 72 | */ |
73 | - public function hasObject( $object ); |
|
73 | + public function hasObject($object); |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * remove |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param $object |
81 | 81 | * @return bool |
82 | 82 | */ |
83 | - public function remove( $object ); |
|
83 | + public function remove($object); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * setCurrent |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param mixed $identifier |
91 | 91 | * @return boolean |
92 | 92 | */ |
93 | - public function setCurrent( $identifier ) ; |
|
93 | + public function setCurrent($identifier); |
|
94 | 94 | |
95 | 95 | /** |
96 | 96 | * setCurrentUsingObject |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param $object |
101 | 101 | * @return boolean |
102 | 102 | */ |
103 | - public function setCurrentUsingObject( $object ); |
|
103 | + public function setCurrentUsingObject($object); |
|
104 | 104 | |
105 | 105 | /** |
106 | 106 | * Returns the object occupying the index before the current object, |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param $object |
118 | 118 | * @return boolean|int|string |
119 | 119 | */ |
120 | - public function indexOf( $object ); |
|
120 | + public function indexOf($object); |
|
121 | 121 | |
122 | 122 | |
123 | 123 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @param $index |
128 | 128 | * @return mixed |
129 | 129 | */ |
130 | - public function objectAtIndex( $index ); |
|
130 | + public function objectAtIndex($index); |
|
131 | 131 | |
132 | 132 | /** |
133 | 133 | * Returns the sequence of objects as specified by the offset and length |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param int $length |
138 | 138 | * @return array |
139 | 139 | */ |
140 | - public function slice( $offset, $length ); |
|
140 | + public function slice($offset, $length); |
|
141 | 141 | |
142 | 142 | /** |
143 | 143 | * Inserts an object (or an array of objects) at a certain point |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param mixed $objects A single object or an array of objects |
147 | 147 | * @param integer $index |
148 | 148 | */ |
149 | - public function insertAt( $objects, $index ); |
|
149 | + public function insertAt($objects, $index); |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Removes the object at the given index |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @see http://stackoverflow.com/a/8736013 |
155 | 155 | * @param integer $index |
156 | 156 | */ |
157 | - public function removeAt( $index ) ; |
|
157 | + public function removeAt($index); |
|
158 | 158 | |
159 | 159 | |
160 | 160 | } |
@@ -1,6 +1,6 @@ discard block |
||
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 | /** |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @subpackage |
12 | 12 | * @author Mike Nelson |
13 | 13 | */ |
14 | -class EE_PMT_Aim extends EE_PMT_Base{ |
|
14 | +class EE_PMT_Aim extends EE_PMT_Base { |
|
15 | 15 | |
16 | 16 | |
17 | 17 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | require_once($this->file_folder().'EEG_Aim.gateway.php'); |
35 | 35 | $this->_gateway = new EEG_Aim(); |
36 | 36 | $this->_pretty_name = __("Authorize.net AIM", 'event_espresso'); |
37 | - $this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' ); |
|
37 | + $this->_default_description = __('Please provide the following billing information.', 'event_espresso'); |
|
38 | 38 | $this->_requires_https = true; |
39 | 39 | } |
40 | 40 | |
@@ -47,61 +47,61 @@ discard block |
||
47 | 47 | * @return EE_Billing_Info_Form |
48 | 48 | * @throws \EE_Error |
49 | 49 | */ |
50 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | - $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance,array( |
|
50 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
51 | + $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance, array( |
|
52 | 52 | 'name'=>'AIM_Form', |
53 | 53 | 'subsections'=>array( |
54 | 54 | 'credit_card'=>new EE_Credit_Card_Input(array( |
55 | 55 | 'required'=>true, |
56 | - 'html_label_text' => __( 'Card Number', 'event_espresso' ) |
|
56 | + 'html_label_text' => __('Card Number', 'event_espresso') |
|
57 | 57 | )), |
58 | 58 | 'exp_month'=>new EE_Credit_Card_Month_Input(true, array( |
59 | 59 | 'required'=>true, |
60 | - 'html_label_text' => __( 'Expiry Month', 'event_espresso' ) |
|
60 | + 'html_label_text' => __('Expiry Month', 'event_espresso') |
|
61 | 61 | )), |
62 | - 'exp_year'=>new EE_Credit_Card_Year_Input( array( |
|
62 | + 'exp_year'=>new EE_Credit_Card_Year_Input(array( |
|
63 | 63 | 'required'=>true, |
64 | - 'html_label_text' => __( 'Expiry Year', 'event_espresso' ) |
|
64 | + 'html_label_text' => __('Expiry Year', 'event_espresso') |
|
65 | 65 | )), |
66 | - 'cvv'=>new EE_CVV_Input( array( |
|
66 | + 'cvv'=>new EE_CVV_Input(array( |
|
67 | 67 | 'required'=>true, |
68 | - 'html_label_text' => __( 'CVV', 'event_espresso' ) ) ), |
|
68 | + 'html_label_text' => __('CVV', 'event_espresso') )), |
|
69 | 69 | ) |
70 | 70 | )); |
71 | - $billing_form->add_subsections( array( |
|
72 | - 'company' => new EE_Text_Input( array( |
|
71 | + $billing_form->add_subsections(array( |
|
72 | + 'company' => new EE_Text_Input(array( |
|
73 | 73 | 'html_label_text' => __('Company', 'event_espresso') |
74 | 74 | )) |
75 | - ), 'email', false ); |
|
75 | + ), 'email', false); |
|
76 | 76 | $billing_form->add_subsections( |
77 | 77 | array( |
78 | - 'fax' => new EE_Text_Input( array( |
|
78 | + 'fax' => new EE_Text_Input(array( |
|
79 | 79 | 'html_label_text' => __('Fax', 'event_espresso') |
80 | 80 | )) |
81 | 81 | ), |
82 | 82 | 'phone', |
83 | 83 | false ); |
84 | 84 | $settings_form = $this->settings_form(); |
85 | - if( $settings_form->get_input( 'excluded_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
86 | - $billing_form->exclude( $settings_form->get_input( 'excluded_billing_inputs' )->normalized_value() ); |
|
85 | + if ($settings_form->get_input('excluded_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
86 | + $billing_form->exclude($settings_form->get_input('excluded_billing_inputs')->normalized_value()); |
|
87 | 87 | } |
88 | - if( $settings_form->get_input( 'required_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
89 | - $required_inputs = $settings_form->get_input( 'required_billing_inputs' )->normalized_value(); |
|
88 | + if ($settings_form->get_input('required_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
89 | + $required_inputs = $settings_form->get_input('required_billing_inputs')->normalized_value(); |
|
90 | 90 | //only change the requirement of inputs which are allowed to be changed |
91 | 91 | /** @var EE_Form_Input_Base[] $inputs_to_evaluate */ |
92 | 92 | $inputs_to_evaluate = array_intersect_key( |
93 | 93 | $billing_form->inputs(), |
94 | 94 | $this->billing_input_names() |
95 | 95 | ); |
96 | - foreach( $inputs_to_evaluate as $input_name => $input ) { |
|
97 | - if( in_array( $input_name, $required_inputs ) ) { |
|
98 | - $input->set_required( true ); |
|
96 | + foreach ($inputs_to_evaluate as $input_name => $input) { |
|
97 | + if (in_array($input_name, $required_inputs)) { |
|
98 | + $input->set_required(true); |
|
99 | 99 | } else { |
100 | - $input->set_required( false ); |
|
100 | + $input->set_required(false); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | - return $this->apply_billing_form_debug_settings( $billing_form ); |
|
104 | + return $this->apply_billing_form_debug_settings($billing_form); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -114,18 +114,18 @@ discard block |
||
114 | 114 | * @return \EE_Billing_Info_Form |
115 | 115 | * @throws \EE_Error |
116 | 116 | */ |
117 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
117 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
118 | 118 | if ( |
119 | 119 | $this->_pm_instance->debug_mode() |
120 | - || $this->_pm_instance->get_extra_meta( 'test_transactions', TRUE, FALSE ) |
|
120 | + || $this->_pm_instance->get_extra_meta('test_transactions', TRUE, FALSE) |
|
121 | 121 | ) { |
122 | - $billing_form->get_input( 'credit_card' )->set_default( '4007000000027' ); |
|
123 | - $billing_form->get_input( 'exp_year' )->set_default( '2020' ); |
|
124 | - if( $billing_form->get_subsection( 'cvv' ) instanceof EE_Form_Input_Base ) { |
|
125 | - $billing_form->get_input( 'cvv' )->set_default( '123' ); |
|
122 | + $billing_form->get_input('credit_card')->set_default('4007000000027'); |
|
123 | + $billing_form->get_input('exp_year')->set_default('2020'); |
|
124 | + if ($billing_form->get_subsection('cvv') instanceof EE_Form_Input_Base) { |
|
125 | + $billing_form->get_input('cvv')->set_default('123'); |
|
126 | 126 | } |
127 | 127 | $billing_form->add_subsections( |
128 | - array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ), |
|
128 | + array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()), |
|
129 | 129 | 'credit_card' |
130 | 130 | ); |
131 | 131 | $billing_form->add_subsections( |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | 'extra_meta_inputs'=>array( |
154 | 154 | 'login_id'=>new EE_Text_Input( |
155 | 155 | array( |
156 | - 'html_label_text'=> sprintf( __("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link() ), |
|
156 | + 'html_label_text'=> sprintf(__("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link()), |
|
157 | 157 | 'required' => true ) |
158 | 158 | ), |
159 | 159 | 'transaction_key'=>new EE_Text_Input( |
160 | 160 | array( |
161 | - 'html_label_text'=> sprintf( __("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link() ), |
|
161 | + 'html_label_text'=> sprintf(__("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link()), |
|
162 | 162 | 'required' => true ) |
163 | 163 | ), |
164 | 164 | 'test_transactions'=>new EE_Yes_No_Input( |
165 | 165 | array( |
166 | - 'html_label_text'=> sprintf( __("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
166 | + 'html_label_text'=> sprintf(__("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link()), |
|
167 | 167 | 'html_help_text'=> __("Send test transactions, even to live server", 'event_espresso'), |
168 | 168 | 'default' => false, |
169 | 169 | 'required' => true |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | 'excluded_billing_inputs' => new EE_Checkbox_Multi_Input( |
173 | 173 | $billing_input_names, |
174 | 174 | array( |
175 | - 'html_label_text' => sprintf( __("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
175 | + 'html_label_text' => sprintf(__("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
176 | 176 | 'default' => array( |
177 | 177 | 'company', |
178 | 178 | 'fax', |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | 'required_billing_inputs' => new EE_Checkbox_Multi_Input( |
182 | 182 | $billing_input_names, |
183 | 183 | array( |
184 | - 'html_label_text' => sprintf( __("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
184 | + 'html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
185 | 185 | 'default' => array_diff( |
186 | - array_keys( $billing_input_names ), |
|
187 | - array( 'address2', 'phone', 'company', 'fax' ) |
|
186 | + array_keys($billing_input_names), |
|
187 | + array('address2', 'phone', 'company', 'fax') |
|
188 | 188 | ), |
189 | 189 | 'html_help_text' => __('Note: if fields are excluded they cannot be required.', 'event_espresso') |
190 | 190 | ) |
@@ -193,14 +193,14 @@ discard block |
||
193 | 193 | apply_filters( |
194 | 194 | 'FHEE__EE_PMT_Aim__generate_new_settings_form__server_select_input__options', |
195 | 195 | array( |
196 | - 'akamai' => __( 'Authorize.net/Akamai (default)', 'event_espresso' ), |
|
197 | - 'authorize.net' => __( 'Authorize.net (deprecated)', 'event_espresso' ), |
|
196 | + 'akamai' => __('Authorize.net/Akamai (default)', 'event_espresso'), |
|
197 | + 'authorize.net' => __('Authorize.net (deprecated)', 'event_espresso'), |
|
198 | 198 | ), |
199 | 199 | $this |
200 | 200 | ), |
201 | 201 | array( |
202 | - 'html_label_text' => __( 'Server', 'event_espresso' ), |
|
203 | - 'html_help_text' => __( 'The Gateway Server where payment requests will be sent', 'event_espresso' ) |
|
202 | + 'html_label_text' => __('Server', 'event_espresso'), |
|
203 | + 'html_help_text' => __('The Gateway Server where payment requests will be sent', 'event_espresso') |
|
204 | 204 | ) |
205 | 205 | ) |
206 | 206 | |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function billing_input_names() { |
218 | 218 | return array( |
219 | - 'first_name' => __( 'First Name', 'event_espresso' ), |
|
219 | + 'first_name' => __('First Name', 'event_espresso'), |
|
220 | 220 | 'last_name' => __('Last Name', 'event_espresso'), |
221 | - 'email' => __( 'Email', 'event_espresso' ), |
|
222 | - 'company' => __( 'Company', 'event_espresso' ), |
|
221 | + 'email' => __('Email', 'event_espresso'), |
|
222 | + 'company' => __('Company', 'event_espresso'), |
|
223 | 223 | 'address' => __('Address', 'event_espresso'), |
224 | 224 | 'address2' => __('Address2', 'event_espresso'), |
225 | 225 | 'city' => __('City', 'event_espresso'), |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | 'country' => __('Country', 'event_espresso'), |
228 | 228 | 'zip' => __('Zip', 'event_espresso'), |
229 | 229 | 'phone' => __('Phone', 'event_espresso'), |
230 | - 'fax' => __( 'Fax', 'event_espresso' ), |
|
230 | + 'fax' => __('Fax', 'event_espresso'), |
|
231 | 231 | 'cvv' => __('CVV', 'event_espresso') |
232 | 232 | ); |
233 | 233 | } |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | * @param EE_Billing_Info_Form $billing_form |
240 | 240 | * @return array |
241 | 241 | */ |
242 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
242 | + protected function _get_billing_values_from_form($billing_form) { |
|
243 | 243 | $all_billing_values_empty = array(); |
244 | - foreach( array_keys( $this->billing_input_names() ) as $input_name ) { |
|
245 | - $all_billing_values_empty[ $input_name ] = ''; |
|
244 | + foreach (array_keys($this->billing_input_names()) as $input_name) { |
|
245 | + $all_billing_values_empty[$input_name] = ''; |
|
246 | 246 | } |
247 | 247 | return array_merge( |
248 | 248 | $all_billing_values_empty, |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @see EE_PMT_Base::help_tabs_config() |
258 | 258 | * @return array |
259 | 259 | */ |
260 | - public function help_tabs_config(){ |
|
260 | + public function help_tabs_config() { |
|
261 | 261 | return array( |
262 | 262 | $this->get_help_tab_name() => array( |
263 | 263 | 'title' => __('Authorize.net AIM Settings', 'event_espresso'), |
@@ -22,7 +22,7 @@ |
||
22 | 22 | public function __construct($pm_instance = NULL) { |
23 | 23 | $this->_setup_properties(); |
24 | 24 | parent::__construct($pm_instance); |
25 | - $this->_gateway->set_unsupported_character_remover(new \EventEspresso\core\services\formatters\Windows1252()); |
|
25 | + $this->_gateway->set_unsupported_character_remover(new \EventEspresso\core\services\formatters\Windows1252()); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -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,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\collections; |
3 | 3 | |
4 | -use EventEspresso\core\exceptions\InvalidEntityException; |
|
5 | -use EventEspresso\core\exceptions\InvalidInterfaceException; |
|
4 | +use EventEspresso\core\exceptions\InvalidEntityException; |
|
5 | +use EventEspresso\core\exceptions\InvalidInterfaceException; |
|
6 | 6 | use LimitIterator; |
7 | 7 | |
8 | 8 | if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | use EventEspresso\core\exceptions\InvalidInterfaceException; |
6 | 6 | use LimitIterator; |
7 | 7 | |
8 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
9 | - exit( 'No direct script access allowed' ); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | 10 | } |
11 | 11 | /** |
12 | 12 | * Class Collection |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | * @param string $collection_interface |
37 | 37 | * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
38 | 38 | */ |
39 | - public function __construct( $collection_interface ) { |
|
40 | - $this->setCollectionInterface( $collection_interface ); |
|
39 | + public function __construct($collection_interface) { |
|
40 | + $this->setCollectionInterface($collection_interface); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | * @param string $collection_interface |
50 | 50 | * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
51 | 51 | */ |
52 | - protected function setCollectionInterface( $collection_interface ) { |
|
53 | - if ( ! ( interface_exists( $collection_interface ) || class_exists( $collection_interface ) ) ) { |
|
54 | - throw new InvalidInterfaceException( $collection_interface ); |
|
52 | + protected function setCollectionInterface($collection_interface) { |
|
53 | + if ( ! (interface_exists($collection_interface) || class_exists($collection_interface))) { |
|
54 | + throw new InvalidInterfaceException($collection_interface); |
|
55 | 55 | } |
56 | 56 | $this->collection_interface = $collection_interface; |
57 | 57 | } |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | * @return bool |
71 | 71 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
72 | 72 | */ |
73 | - public function add( $object, $identifier = null ) { |
|
74 | - if ( ! $object instanceof $this->collection_interface ) { |
|
75 | - throw new InvalidEntityException( $object, $this->collection_interface ); |
|
73 | + public function add($object, $identifier = null) { |
|
74 | + if ( ! $object instanceof $this->collection_interface) { |
|
75 | + throw new InvalidEntityException($object, $this->collection_interface); |
|
76 | 76 | } |
77 | - $this->attach( $object ); |
|
78 | - $this->setIdentifier( $object, $identifier ); |
|
79 | - return $this->contains( $object ); |
|
77 | + $this->attach($object); |
|
78 | + $this->setIdentifier($object, $identifier); |
|
79 | + return $this->contains($object); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | * @param mixed $identifier |
93 | 93 | * @return bool |
94 | 94 | */ |
95 | - public function setIdentifier( $object, $identifier = null ) { |
|
96 | - $identifier = ! empty( $identifier ) ? $identifier : spl_object_hash( $object ); |
|
95 | + public function setIdentifier($object, $identifier = null) { |
|
96 | + $identifier = ! empty($identifier) ? $identifier : spl_object_hash($object); |
|
97 | 97 | $this->rewind(); |
98 | - while ( $this->valid() ) { |
|
99 | - if ( $object === $this->current() ) { |
|
100 | - $this->setInfo( $identifier ); |
|
98 | + while ($this->valid()) { |
|
99 | + if ($object === $this->current()) { |
|
100 | + $this->setInfo($identifier); |
|
101 | 101 | $this->rewind(); |
102 | 102 | return true; |
103 | 103 | } |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | * @param mixed $identifier |
118 | 118 | * @return mixed |
119 | 119 | */ |
120 | - public function get( $identifier ) { |
|
120 | + public function get($identifier) { |
|
121 | 121 | $this->rewind(); |
122 | - while ( $this->valid() ) { |
|
123 | - if ( $identifier === $this->getInfo() ) { |
|
122 | + while ($this->valid()) { |
|
123 | + if ($identifier === $this->getInfo()) { |
|
124 | 124 | $object = $this->current(); |
125 | 125 | $this->rewind(); |
126 | 126 | return $object; |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | * @param mixed $identifier |
143 | 143 | * @return bool |
144 | 144 | */ |
145 | - public function has( $identifier ) { |
|
145 | + public function has($identifier) { |
|
146 | 146 | $this->rewind(); |
147 | - while ( $this->valid() ) { |
|
148 | - if ( $identifier === $this->getInfo() ) { |
|
147 | + while ($this->valid()) { |
|
148 | + if ($identifier === $this->getInfo()) { |
|
149 | 149 | $this->rewind(); |
150 | 150 | return true; |
151 | 151 | } |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | * @param $object |
165 | 165 | * @return bool |
166 | 166 | */ |
167 | - public function hasObject( $object ) { |
|
168 | - return $this->contains( $object ); |
|
167 | + public function hasObject($object) { |
|
168 | + return $this->contains($object); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * @param $object |
179 | 179 | * @return bool |
180 | 180 | */ |
181 | - public function remove( $object ) { |
|
182 | - $this->detach( $object ); |
|
181 | + public function remove($object) { |
|
182 | + $this->detach($object); |
|
183 | 183 | return true; |
184 | 184 | } |
185 | 185 | |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | * @param mixed $identifier |
194 | 194 | * @return boolean |
195 | 195 | */ |
196 | - public function setCurrent( $identifier ) { |
|
196 | + public function setCurrent($identifier) { |
|
197 | 197 | $this->rewind(); |
198 | - while ( $this->valid() ) { |
|
199 | - if ( $identifier === $this->getInfo() ) { |
|
198 | + while ($this->valid()) { |
|
199 | + if ($identifier === $this->getInfo()) { |
|
200 | 200 | return true; |
201 | 201 | } |
202 | 202 | $this->next(); |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | * @param $object |
215 | 215 | * @return boolean |
216 | 216 | */ |
217 | - public function setCurrentUsingObject( $object ) { |
|
217 | + public function setCurrentUsingObject($object) { |
|
218 | 218 | $this->rewind(); |
219 | - while ( $this->valid() ) { |
|
220 | - if ( $this->current() === $object ) { |
|
219 | + while ($this->valid()) { |
|
220 | + if ($this->current() === $object) { |
|
221 | 221 | return true; |
222 | 222 | } |
223 | 223 | $this->next(); |
@@ -234,12 +234,12 @@ discard block |
||
234 | 234 | * @return mixed |
235 | 235 | */ |
236 | 236 | public function previous() { |
237 | - $index = $this->indexOf( $this->current() ); |
|
238 | - if ( $index === 0 ) { |
|
237 | + $index = $this->indexOf($this->current()); |
|
238 | + if ($index === 0) { |
|
239 | 239 | return $this->current(); |
240 | 240 | } |
241 | 241 | $index--; |
242 | - return $this->objectAtIndex( $index ); |
|
242 | + return $this->objectAtIndex($index); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | * @param $object |
252 | 252 | * @return boolean|int|string |
253 | 253 | */ |
254 | - public function indexOf( $object ) { |
|
255 | - if ( ! $this->contains( $object ) ) { |
|
254 | + public function indexOf($object) { |
|
255 | + if ( ! $this->contains($object)) { |
|
256 | 256 | return false; |
257 | 257 | } |
258 | - foreach ( $this as $index => $obj ) { |
|
259 | - if ( $obj === $object ) { |
|
258 | + foreach ($this as $index => $obj) { |
|
259 | + if ($obj === $object) { |
|
260 | 260 | return $index; |
261 | 261 | } |
262 | 262 | } |
@@ -272,8 +272,8 @@ discard block |
||
272 | 272 | * @param int $index |
273 | 273 | * @return mixed |
274 | 274 | */ |
275 | - public function objectAtIndex( $index ) { |
|
276 | - $iterator = new LimitIterator( $this, $index, 1 ); |
|
275 | + public function objectAtIndex($index) { |
|
276 | + $iterator = new LimitIterator($this, $index, 1); |
|
277 | 277 | $iterator->rewind(); |
278 | 278 | return $iterator->current(); |
279 | 279 | } |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | * @param int $length |
289 | 289 | * @return array |
290 | 290 | */ |
291 | - public function slice( $offset, $length ) { |
|
291 | + public function slice($offset, $length) { |
|
292 | 292 | $slice = array(); |
293 | - $iterator = new LimitIterator( $this, $offset, $length ); |
|
294 | - foreach ( $iterator as $object ) { |
|
293 | + $iterator = new LimitIterator($this, $offset, $length); |
|
294 | + foreach ($iterator as $object) { |
|
295 | 295 | $slice[] = $object; |
296 | 296 | } |
297 | 297 | return $slice; |
@@ -306,35 +306,35 @@ discard block |
||
306 | 306 | * @param mixed $objects A single object or an array of objects |
307 | 307 | * @param int $index |
308 | 308 | */ |
309 | - public function insertAt( $objects, $index ) { |
|
310 | - if ( ! is_array( $objects ) ) { |
|
311 | - $objects = array( $objects ); |
|
309 | + public function insertAt($objects, $index) { |
|
310 | + if ( ! is_array($objects)) { |
|
311 | + $objects = array($objects); |
|
312 | 312 | } |
313 | 313 | // check to ensure that objects don't already exist in the collection |
314 | - foreach ( $objects as $key => $object ) { |
|
315 | - if ( $this->contains( $object ) ) { |
|
316 | - unset( $objects[ $key ] ); |
|
314 | + foreach ($objects as $key => $object) { |
|
315 | + if ($this->contains($object)) { |
|
316 | + unset($objects[$key]); |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | // do we have any objects left? |
320 | - if ( ! $objects ) { |
|
320 | + if ( ! $objects) { |
|
321 | 321 | return; |
322 | 322 | } |
323 | 323 | // detach any objects at or past this index |
324 | 324 | $remaining = array(); |
325 | - if ( $index < $this->count() ) { |
|
326 | - $remaining = $this->slice( $index, $this->count() - $index ); |
|
327 | - foreach ( $remaining as $object ) { |
|
328 | - $this->detach( $object ); |
|
325 | + if ($index < $this->count()) { |
|
326 | + $remaining = $this->slice($index, $this->count() - $index); |
|
327 | + foreach ($remaining as $object) { |
|
328 | + $this->detach($object); |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 | // add the new objects we're splicing in |
332 | - foreach ( $objects as $object ) { |
|
333 | - $this->attach( $object ); |
|
332 | + foreach ($objects as $object) { |
|
333 | + $this->attach($object); |
|
334 | 334 | } |
335 | 335 | // attach the objects we previously detached |
336 | - foreach ( $remaining as $object ) { |
|
337 | - $this->attach( $object ); |
|
336 | + foreach ($remaining as $object) { |
|
337 | + $this->attach($object); |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | * @see http://stackoverflow.com/a/8736013 |
347 | 347 | * @param int $index |
348 | 348 | */ |
349 | - public function removeAt( $index ) { |
|
350 | - $this->detach( $this->objectAtIndex( $index ) ); |
|
349 | + public function removeAt($index) { |
|
350 | + $this->detach($this->objectAtIndex($index)); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * by calling EE_Object_Collection::set_identifier() |
66 | 66 | * |
67 | 67 | * @access public |
68 | - * @param $object |
|
68 | + * @param \EventEspresso\core\services\progress_steps\ProgressStep $object |
|
69 | 69 | * @param mixed $identifier |
70 | 70 | * @return bool |
71 | 71 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * advances pointer to the provided object |
212 | 212 | * |
213 | 213 | * @access public |
214 | - * @param $object |
|
214 | + * @param \EventEspresso\core\libraries\form_sections\form_handlers\SequentialStepFormInterface $object |
|
215 | 215 | * @return boolean |
216 | 216 | */ |
217 | 217 | public function setCurrentUsingObject( $object ) { |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @see http://stackoverflow.com/a/8736013 |
251 | 251 | * @param $object |
252 | - * @return boolean|int|string |
|
252 | + * @return integer |
|
253 | 253 | */ |
254 | 254 | public function indexOf( $object ) { |
255 | 255 | if ( ! $this->contains( $object ) ) { |
@@ -83,7 +83,6 @@ |
||
83 | 83 | |
84 | 84 | /** |
85 | 85 | * setIdentifier |
86 | - |
|
87 | 86 | * Sets the data associated with an object in the Collection |
88 | 87 | * if no $identifier is supplied, then the spl_object_hash() is used |
89 | 88 | * |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\collections; |
3 | 3 | |
4 | -use EventEspresso\core\exceptions\InvalidClassException; |
|
5 | -use EventEspresso\core\exceptions\InvalidDataTypeException; |
|
6 | -use EventEspresso\core\exceptions\InvalidEntityException; |
|
7 | -use EventEspresso\core\exceptions\InvalidFilePathException; |
|
4 | +use EventEspresso\core\exceptions\InvalidClassException; |
|
5 | +use EventEspresso\core\exceptions\InvalidDataTypeException; |
|
6 | +use EventEspresso\core\exceptions\InvalidEntityException; |
|
7 | +use EventEspresso\core\exceptions\InvalidFilePathException; |
|
8 | 8 | use EventEspresso\core\services\locators\LocatorInterface; |
9 | 9 | use EventEspresso\core\services\locators\FileLocator; |
10 | 10 |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | use EventEspresso\core\services\locators\LocatorInterface; |
9 | 9 | use EventEspresso\core\services\locators\FileLocator; |
10 | 10 | |
11 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
12 | - exit( 'No direct script access allowed' ); |
|
11 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
12 | + exit('No direct script access allowed'); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | LocatorInterface $file_locator = null |
82 | 82 | ) { |
83 | 83 | $this->collection_details = $collection_details; |
84 | - if ( ! $collection instanceof CollectionInterface ) { |
|
85 | - $collection = new Collection( $this->collection_details->getCollectionInterface() ); |
|
84 | + if ( ! $collection instanceof CollectionInterface) { |
|
85 | + $collection = new Collection($this->collection_details->getCollectionInterface()); |
|
86 | 86 | } |
87 | 87 | $this->collection = $collection; |
88 | 88 | $this->file_locator = $file_locator; |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
111 | 111 | */ |
112 | 112 | protected function loadAllFromFilepaths() { |
113 | - if ( ! $this->file_locator instanceof FileLocator ) { |
|
113 | + if ( ! $this->file_locator instanceof FileLocator) { |
|
114 | 114 | $this->file_locator = new FileLocator(); |
115 | 115 | } |
116 | - $this->file_locator->setFileMask( $this->collection_details->getFileMask() ); |
|
116 | + $this->file_locator->setFileMask($this->collection_details->getFileMask()); |
|
117 | 117 | // find all of the files that match the file mask in the specified folder |
118 | - $this->file_locator->locate( $this->collection_details->getCollectionPaths() ); |
|
118 | + $this->file_locator->locate($this->collection_details->getCollectionPaths()); |
|
119 | 119 | // filter the results |
120 | 120 | $filepaths = (array) apply_filters( |
121 | 121 | "FHEE__CollectionLoader__loadAllFromFilepath__filepaths", |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | $this->collection_details->collectionName(), |
124 | 124 | $this->collection_details |
125 | 125 | ); |
126 | - if ( empty( $filepaths ) ) { |
|
126 | + if (empty($filepaths)) { |
|
127 | 127 | return; |
128 | 128 | } |
129 | - foreach ( $filepaths as $filepath ) { |
|
130 | - $this->loadClassFromFilepath( $filepath ); |
|
129 | + foreach ($filepaths as $filepath) { |
|
130 | + $this->loadClassFromFilepath($filepath); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -144,22 +144,22 @@ discard block |
||
144 | 144 | * @throws \EventEspresso\core\exceptions\InvalidFilePathException |
145 | 145 | * @throws \EventEspresso\core\exceptions\InvalidClassException |
146 | 146 | */ |
147 | - protected function loadClassFromFilepath( $filepath ) { |
|
148 | - if ( ! is_string( $filepath ) ) { |
|
149 | - throw new InvalidDataTypeException( '$filepath', $filepath, 'string' ); |
|
147 | + protected function loadClassFromFilepath($filepath) { |
|
148 | + if ( ! is_string($filepath)) { |
|
149 | + throw new InvalidDataTypeException('$filepath', $filepath, 'string'); |
|
150 | 150 | } |
151 | - if ( ! is_readable( $filepath ) ) { |
|
152 | - throw new InvalidFilePathException( $filepath ); |
|
151 | + if ( ! is_readable($filepath)) { |
|
152 | + throw new InvalidFilePathException($filepath); |
|
153 | 153 | } |
154 | - require_once( $filepath ); |
|
154 | + require_once($filepath); |
|
155 | 155 | // extract filename from path |
156 | - $file_name = basename( $filepath ); |
|
156 | + $file_name = basename($filepath); |
|
157 | 157 | // now remove any file extensions |
158 | - $class_name = \EEH_File::get_classname_from_filepath_with_standard_filename( $file_name ); |
|
159 | - if ( ! class_exists( $class_name ) ) { |
|
160 | - throw new InvalidClassException( $class_name ); |
|
158 | + $class_name = \EEH_File::get_classname_from_filepath_with_standard_filename($file_name); |
|
159 | + if ( ! class_exists($class_name)) { |
|
160 | + throw new InvalidClassException($class_name); |
|
161 | 161 | } |
162 | - return $this->addEntityToCollection( new $class_name(), $file_name ); |
|
162 | + return $this->addEntityToCollection(new $class_name(), $file_name); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | * @return string |
174 | 174 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
175 | 175 | */ |
176 | - protected function addEntityToCollection( $entity, $identifier ) { |
|
176 | + protected function addEntityToCollection($entity, $identifier) { |
|
177 | 177 | do_action( |
178 | 178 | "FHEE__CollectionLoader__addEntityToCollection__entity", |
179 | 179 | $entity, |
180 | 180 | $this->collection_details->collectionName(), |
181 | 181 | $this->collection_details |
182 | 182 | ); |
183 | - $identifier = $this->setIdentifier( $entity, $identifier ); |
|
184 | - if ( $this->collection->has( $identifier ) ) { |
|
183 | + $identifier = $this->setIdentifier($entity, $identifier); |
|
184 | + if ($this->collection->has($identifier)) { |
|
185 | 185 | do_action( |
186 | 186 | "FHEE__CollectionLoader__addEntityToCollection__entity_already_added", |
187 | 187 | $this, |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | ); |
191 | 191 | return CollectionLoader::ENTITY_EXISTS; |
192 | 192 | } |
193 | - if( $this->collection->add( $entity, $identifier ) ) { |
|
193 | + if ($this->collection->add($entity, $identifier)) { |
|
194 | 194 | do_action( |
195 | 195 | "FHEE__CollectionLoader__addEntityToCollection__entity_added", |
196 | 196 | $this, |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | * @return string |
221 | 221 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
222 | 222 | */ |
223 | - protected function setIdentifier( $entity, $identifier ) { |
|
224 | - if ( $this->collection_details->identifierType() === CollectionDetails::ID_OBJECT_HASH ) { |
|
225 | - $identifier = spl_object_hash( $entity ); |
|
226 | - } elseif ( $this->collection_details->identifierType() === CollectionDetails::ID_CALLBACK_METHOD ) { |
|
223 | + protected function setIdentifier($entity, $identifier) { |
|
224 | + if ($this->collection_details->identifierType() === CollectionDetails::ID_OBJECT_HASH) { |
|
225 | + $identifier = spl_object_hash($entity); |
|
226 | + } elseif ($this->collection_details->identifierType() === CollectionDetails::ID_CALLBACK_METHOD) { |
|
227 | 227 | $identifier_callback = $this->collection_details->identifierCallback(); |
228 | - if ( ! method_exists( $entity, $identifier_callback ) ) { |
|
228 | + if ( ! method_exists($entity, $identifier_callback)) { |
|
229 | 229 | throw new InvalidEntityException( |
230 | 230 | $entity, |
231 | 231 | $this->collection_details->getCollectionInterface(), |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | 'event_espresso' |
236 | 236 | ), |
237 | 237 | $identifier_callback, |
238 | - get_class( $entity ) |
|
238 | + get_class($entity) |
|
239 | 239 | ) |
240 | 240 | ); |
241 | 241 | } |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | $this->collection_details->collectionName(), |
268 | 268 | $this->collection_details |
269 | 269 | ); |
270 | - foreach ( $FQCNs as $FQCN ) { |
|
271 | - $this->loadClassFromFQCN( $FQCN ); |
|
270 | + foreach ($FQCNs as $FQCN) { |
|
271 | + $this->loadClassFromFQCN($FQCN); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
@@ -284,15 +284,15 @@ discard block |
||
284 | 284 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
285 | 285 | * @throws \EventEspresso\core\exceptions\InvalidClassException |
286 | 286 | */ |
287 | - protected function loadClassFromFQCN( $FQCN ) { |
|
288 | - if ( ! is_string( $FQCN ) ) { |
|
289 | - throw new InvalidDataTypeException( '$FQCN', $FQCN, 'string' ); |
|
287 | + protected function loadClassFromFQCN($FQCN) { |
|
288 | + if ( ! is_string($FQCN)) { |
|
289 | + throw new InvalidDataTypeException('$FQCN', $FQCN, 'string'); |
|
290 | 290 | } |
291 | - if ( ! class_exists( $FQCN ) ) { |
|
292 | - throw new InvalidClassException( $FQCN ); |
|
291 | + if ( ! class_exists($FQCN)) { |
|
292 | + throw new InvalidClassException($FQCN); |
|
293 | 293 | } |
294 | 294 | return $this->addEntityToCollection( |
295 | - \EE_Registry::instance()->create( $FQCN ), |
|
295 | + \EE_Registry::instance()->create($FQCN), |
|
296 | 296 | $FQCN |
297 | 297 | ); |
298 | 298 | } |
@@ -169,7 +169,7 @@ |
||
169 | 169 | * |
170 | 170 | * @access protected |
171 | 171 | * @param $entity |
172 | - * @param mixed $identifier |
|
172 | + * @param string $identifier |
|
173 | 173 | * @return string |
174 | 174 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
175 | 175 | */ |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\locators; |
3 | 3 | |
4 | -use EventEspresso\core\exceptions\InvalidDataTypeException; |
|
4 | +use EventEspresso\core\exceptions\InvalidDataTypeException; |
|
5 | 5 | use FilesystemIterator; |
6 | 6 | use GlobIterator; |
7 | 7 |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | use FilesystemIterator; |
6 | 6 | use GlobIterator; |
7 | 7 | |
8 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
9 | - exit( 'No direct script access allowed' ); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | * @param string $file_mask |
39 | 39 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
40 | 40 | */ |
41 | - public function setFileMask( $file_mask ) { |
|
42 | - if ( ! is_string( $file_mask ) ) { |
|
43 | - throw new InvalidDataTypeException( '$file_mask', $file_mask, 'string' ); |
|
41 | + public function setFileMask($file_mask) { |
|
42 | + if ( ! is_string($file_mask)) { |
|
43 | + throw new InvalidDataTypeException('$file_mask', $file_mask, 'string'); |
|
44 | 44 | } |
45 | 45 | $this->file_mask = $file_mask; |
46 | 46 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @return int |
64 | 64 | */ |
65 | 65 | public function count() { |
66 | - return count( $this->filepaths ); |
|
66 | + return count($this->filepaths); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | * @return \FilesystemIterator |
78 | 78 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
79 | 79 | */ |
80 | - public function locate( $directory_paths ) { |
|
81 | - if ( ! ( is_string( $directory_paths ) || is_array( $directory_paths ) ) ) { |
|
82 | - throw new InvalidDataTypeException( '$directory_paths', $directory_paths, 'string or array' ); |
|
80 | + public function locate($directory_paths) { |
|
81 | + if ( ! (is_string($directory_paths) || is_array($directory_paths))) { |
|
82 | + throw new InvalidDataTypeException('$directory_paths', $directory_paths, 'string or array'); |
|
83 | 83 | } |
84 | - foreach ( (array) $directory_paths as $directory_path ) { |
|
85 | - foreach ( $this->findFilesByPath( $directory_path ) as $key => $file ) { |
|
86 | - $this->filepaths[ $key ] = \EEH_File::standardise_directory_separators( $file ); |
|
84 | + foreach ((array) $directory_paths as $directory_path) { |
|
85 | + foreach ($this->findFilesByPath($directory_path) as $key => $file) { |
|
86 | + $this->filepaths[$key] = \EEH_File::standardise_directory_separators($file); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | return $this->filepaths; |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * @param string $directory_path |
99 | 99 | * @return \FilesystemIterator |
100 | 100 | */ |
101 | - protected function findFilesByPath( $directory_path = '' ) { |
|
102 | - $iterator = new GlobIterator ( |
|
103 | - \EEH_File::end_with_directory_separator( $directory_path ) . $this->file_mask |
|
101 | + protected function findFilesByPath($directory_path = '') { |
|
102 | + $iterator = new GlobIterator( |
|
103 | + \EEH_File::end_with_directory_separator($directory_path).$this->file_mask |
|
104 | 104 | ); |
105 | - foreach ( $this->flags as $flag ) { |
|
106 | - $iterator->setFlags( $flag ); |
|
105 | + foreach ($this->flags as $flag) { |
|
106 | + $iterator->setFlags($flag); |
|
107 | 107 | } |
108 | 108 | return $iterator; |
109 | 109 | } |