@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function setValue($value) : NumberInfo |
86 | 86 | { |
87 | - if($value instanceof NumberInfo) { |
|
87 | + if ($value instanceof NumberInfo) { |
|
88 | 88 | $value = $value->getValue(); |
89 | 89 | } |
90 | 90 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | public function isPositive() : bool |
119 | 119 | { |
120 | - if(!$this->isEmpty()) { |
|
120 | + if (!$this->isEmpty()) { |
|
121 | 121 | $number = $this->getNumber(); |
122 | 122 | return $number > 0; |
123 | 123 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function hasValue() : bool |
150 | 150 | { |
151 | - if(!$this->isEmpty() && !$this->isZero()) { |
|
151 | + if (!$this->isEmpty() && !$this->isZero()) { |
|
152 | 152 | return true; |
153 | 153 | } |
154 | 154 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function getUnits() |
223 | 223 | { |
224 | - if(!$this->hasUnits()) { |
|
224 | + if (!$this->hasUnits()) { |
|
225 | 225 | return 'px'; |
226 | 226 | } |
227 | 227 | |
@@ -255,15 +255,15 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function toAttribute() |
257 | 257 | { |
258 | - if($this->isEmpty()) { |
|
258 | + if ($this->isEmpty()) { |
|
259 | 259 | return null; |
260 | 260 | } |
261 | 261 | |
262 | - if($this->isZero()) { |
|
262 | + if ($this->isZero()) { |
|
263 | 263 | return '0'; |
264 | 264 | } |
265 | 265 | |
266 | - if($this->isPercent()) { |
|
266 | + if ($this->isPercent()) { |
|
267 | 267 | return $this->getNumber().$this->getUnits(); |
268 | 268 | } |
269 | 269 | |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function toCSS() : string |
278 | 278 | { |
279 | - if($this->isEmpty()) { |
|
279 | + if ($this->isEmpty()) { |
|
280 | 280 | return ''; |
281 | 281 | } |
282 | 282 | |
283 | - if($this->isZero()) { |
|
283 | + if ($this->isZero()) { |
|
284 | 284 | return '0'; |
285 | 285 | } |
286 | 286 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | public function __toString() |
291 | 291 | { |
292 | - if($this->isEmpty()) { |
|
292 | + if ($this->isEmpty()) { |
|
293 | 293 | return ''; |
294 | 294 | } |
295 | 295 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | public function isBiggerThan($number) |
308 | 308 | { |
309 | 309 | $number = parseNumber($number); |
310 | - if($number->getUnits() != $this->getUnits()) { |
|
310 | + if ($number->getUnits() != $this->getUnits()) { |
|
311 | 311 | return false; |
312 | 312 | } |
313 | 313 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | public function isSmallerThan($number) |
326 | 326 | { |
327 | 327 | $number = parseNumber($number); |
328 | - if($number->getUnits() != $this->getUnits()) { |
|
328 | + if ($number->getUnits() != $this->getUnits()) { |
|
329 | 329 | return false; |
330 | 330 | } |
331 | 331 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | public function isBiggerEqual($number) |
336 | 336 | { |
337 | 337 | $number = parseNumber($number); |
338 | - if($number->getUnits() != $this->getUnits()) { |
|
338 | + if ($number->getUnits() != $this->getUnits()) { |
|
339 | 339 | return false; |
340 | 340 | } |
341 | 341 | |
@@ -352,14 +352,14 @@ discard block |
||
352 | 352 | */ |
353 | 353 | public function add($value) |
354 | 354 | { |
355 | - if($this->isEmpty()) { |
|
355 | + if ($this->isEmpty()) { |
|
356 | 356 | $this->setValue($value); |
357 | 357 | return $this; |
358 | 358 | } |
359 | 359 | |
360 | 360 | $number = parseNumber($value); |
361 | 361 | |
362 | - if($number->getUnits() == $this->getUnits() || !$number->hasUnits()) |
|
362 | + if ($number->getUnits() == $this->getUnits() || !$number->hasUnits()) |
|
363 | 363 | { |
364 | 364 | $new = $this->getNumber() + $number->getNumber(); |
365 | 365 | $this->setValue($new.$this->getUnits()); |
@@ -378,14 +378,14 @@ discard block |
||
378 | 378 | */ |
379 | 379 | public function subtract($value) |
380 | 380 | { |
381 | - if($this->isEmpty()) { |
|
381 | + if ($this->isEmpty()) { |
|
382 | 382 | $this->setValue($value); |
383 | 383 | return $this; |
384 | 384 | } |
385 | 385 | |
386 | 386 | $number = parseNumber($value); |
387 | 387 | |
388 | - if($number->getUnits() == $this->getUnits() || !$number->hasUnits()) |
|
388 | + if ($number->getUnits() == $this->getUnits() || !$number->hasUnits()) |
|
389 | 389 | { |
390 | 390 | $new = $this->getNumber() - $number->getNumber(); |
391 | 391 | $this->setValue($new.$this->getUnits()); |
@@ -412,25 +412,25 @@ discard block |
||
412 | 412 | |
413 | 413 | protected function percentOperation($operation, $percent) |
414 | 414 | { |
415 | - if($this->isZeroOrEmpty()) { |
|
415 | + if ($this->isZeroOrEmpty()) { |
|
416 | 416 | return $this; |
417 | 417 | } |
418 | 418 | |
419 | 419 | $percent = parseNumber($percent); |
420 | - if($percent->hasUnits() && !$percent->isPercent()) { |
|
420 | + if ($percent->hasUnits() && !$percent->isPercent()) { |
|
421 | 421 | return $this; |
422 | 422 | } |
423 | 423 | |
424 | 424 | $number = $this->getNumber(); |
425 | 425 | $value = $number * $percent->getNumber() / 100; |
426 | 426 | |
427 | - if($operation == '-') { |
|
427 | + if ($operation == '-') { |
|
428 | 428 | $number = $number - $value; |
429 | 429 | } else { |
430 | 430 | $number = $number + $value; |
431 | 431 | } |
432 | 432 | |
433 | - if($this->isUnitInteger()) { |
|
433 | + if ($this->isUnitInteger()) { |
|
434 | 434 | $number = intval($number); |
435 | 435 | } |
436 | 436 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | |
482 | 482 | $key = $this->createValueKey($value); |
483 | 483 | |
484 | - if(array_key_exists($key, $cache)) { |
|
484 | + if (array_key_exists($key, $cache)) { |
|
485 | 485 | return $cache[$key]; |
486 | 486 | } |
487 | 487 | |
@@ -491,13 +491,13 @@ discard block |
||
491 | 491 | 'number' => null |
492 | 492 | ); |
493 | 493 | |
494 | - if($key === '_EMPTY_') |
|
494 | + if ($key === '_EMPTY_') |
|
495 | 495 | { |
496 | 496 | $cache[$key]['empty'] = true; |
497 | 497 | return $cache[$key]; |
498 | 498 | } |
499 | 499 | |
500 | - if($value === 0 || $value === '0') |
|
500 | + if ($value === 0 || $value === '0') |
|
501 | 501 | { |
502 | 502 | $cache[$key]['number'] = 0; |
503 | 503 | $cache[$key] = $this->filterInfo($cache[$key]); |
@@ -506,20 +506,20 @@ discard block |
||
506 | 506 | |
507 | 507 | $test = trim((string)$value); |
508 | 508 | |
509 | - if($test === '') |
|
509 | + if ($test === '') |
|
510 | 510 | { |
511 | 511 | $cache[$key]['empty'] = true; |
512 | 512 | return $cache[$key]; |
513 | 513 | } |
514 | 514 | |
515 | 515 | // replace comma notation (which is only possible if it's a string) |
516 | - if(is_string($value)) |
|
516 | + if (is_string($value)) |
|
517 | 517 | { |
518 | 518 | $test = $this->preProcess($test, $cache, $value); |
519 | 519 | } |
520 | 520 | |
521 | 521 | // convert to a number if it's numeric |
522 | - if(is_numeric($test)) |
|
522 | + if (is_numeric($test)) |
|
523 | 523 | { |
524 | 524 | $cache[$key]['number'] = $test * 1; |
525 | 525 | $cache[$key] = $this->filterInfo($cache[$key]); |
@@ -545,19 +545,19 @@ discard block |
||
545 | 545 | $empty = false; |
546 | 546 | |
547 | 547 | $found = $this->findUnits($test); |
548 | - if($found !== null) |
|
548 | + if ($found !== null) |
|
549 | 549 | { |
550 | 550 | $number = $found['number']; |
551 | 551 | $units = $found['units']; |
552 | 552 | } |
553 | 553 | |
554 | 554 | // the filters have to restore the value |
555 | - if($this->postProcess) |
|
555 | + if ($this->postProcess) |
|
556 | 556 | { |
557 | 557 | $number = $this->postProcess($number, $test); |
558 | 558 | } |
559 | 559 | // empty number |
560 | - else if($number === '' || $number === null || is_bool($number)) |
|
560 | + else if ($number === '' || $number === null || is_bool($number)) |
|
561 | 561 | { |
562 | 562 | $number = null; |
563 | 563 | $empty = true; |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | $number = trim($number); |
569 | 569 | |
570 | 570 | // may be an arbitrary string in some cases |
571 | - if(!is_numeric($number)) |
|
571 | + if (!is_numeric($number)) |
|
572 | 572 | { |
573 | 573 | $number = null; |
574 | 574 | $empty = true; |
@@ -600,17 +600,17 @@ discard block |
||
600 | 600 | $vlength = strlen($value); |
601 | 601 | $names = array_keys($this->knownUnits); |
602 | 602 | |
603 | - foreach($names as $unit) |
|
603 | + foreach ($names as $unit) |
|
604 | 604 | { |
605 | 605 | $ulength = strlen($unit); |
606 | - $start = $vlength-$ulength; |
|
607 | - if($start < 0) { |
|
606 | + $start = $vlength - $ulength; |
|
607 | + if ($start < 0) { |
|
608 | 608 | continue; |
609 | 609 | } |
610 | 610 | |
611 | 611 | $search = substr($value, $start, $ulength); |
612 | 612 | |
613 | - if($search==$unit) |
|
613 | + if ($search == $unit) |
|
614 | 614 | { |
615 | 615 | return array( |
616 | 616 | 'units' => $unit, |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | */ |
631 | 631 | private function createValueKey($value) : string |
632 | 632 | { |
633 | - if(!is_string($value) && !is_numeric($value)) |
|
633 | + if (!is_string($value) && !is_numeric($value)) |
|
634 | 634 | { |
635 | 635 | return '_EMPTY_'; |
636 | 636 | } |
@@ -696,12 +696,12 @@ discard block |
||
696 | 696 | protected function filterInfo(array $info) : array |
697 | 697 | { |
698 | 698 | $useUnits = 'px'; |
699 | - if($info['units'] !== null) { |
|
699 | + if ($info['units'] !== null) { |
|
700 | 700 | $useUnits = $info['units']; |
701 | 701 | } |
702 | 702 | |
703 | 703 | // the units are non-decimal: convert decimal values |
704 | - if($useUnits !== null && $this->knownUnits[$useUnits] === false && !$info['empty'] && is_numeric($info['number'])) |
|
704 | + if ($useUnits !== null && $this->knownUnits[$useUnits] === false && !$info['empty'] && is_numeric($info['number'])) |
|
705 | 705 | { |
706 | 706 | $info['number'] = intval($info['number']); |
707 | 707 | } |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | public function getParam($name, $default = null) |
91 | 91 | { |
92 | 92 | $value = $default; |
93 | - if(isset($_REQUEST[$name])) { |
|
93 | + if (isset($_REQUEST[$name])) { |
|
94 | 94 | $value = $_REQUEST[$name]; |
95 | 95 | } |
96 | 96 | |
97 | - if(isset($this->knownParams[$name])) { |
|
97 | + if (isset($this->knownParams[$name])) { |
|
98 | 98 | $value = $this->knownParams[$name]->validate($value); |
99 | 99 | } |
100 | 100 | |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | |
144 | 144 | $exclude = array_merge($exclude, $this->getExcludeParams()); |
145 | 145 | |
146 | - foreach($exclude as $name) |
|
146 | + foreach ($exclude as $name) |
|
147 | 147 | { |
148 | - if(isset($vars[$name])) |
|
148 | + if (isset($vars[$name])) |
|
149 | 149 | { |
150 | 150 | unset($vars[$name]); |
151 | 151 | } |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | // remove the HTML_QuickForm2 form variable if present, to |
157 | 157 | // avoid redirect loops when using the refresh URL in |
158 | 158 | // a page in which a form has been submitted. |
159 | - foreach($names as $name) |
|
159 | + foreach ($names as $name) |
|
160 | 160 | { |
161 | - if(strstr($name, '_qf__')) |
|
161 | + if (strstr($name, '_qf__')) |
|
162 | 162 | { |
163 | 163 | unset($vars[$name]); |
164 | 164 | break; |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | * @param string $dispatcher Relative path to script to use for the URL. Append trailing slash if needed. |
187 | 187 | * @return string |
188 | 188 | */ |
189 | - public function buildURL($params = array(), string $dispatcher='') |
|
189 | + public function buildURL($params = array(), string $dispatcher = '') |
|
190 | 190 | { |
191 | - $url = rtrim($this->getBaseURL(), '/') . '/' . $dispatcher; |
|
191 | + $url = rtrim($this->getBaseURL(), '/').'/'.$dispatcher; |
|
192 | 192 | |
193 | 193 | // append any leftover parameters to the end of the URL |
194 | 194 | if (!empty($params)) { |
195 | - $url .= '?' . http_build_query($params, null, '&'); |
|
195 | + $url .= '?'.http_build_query($params, null, '&'); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | return $url; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function registerParam($name) |
225 | 225 | { |
226 | - if(!isset($this->knownParams[$name])) { |
|
226 | + if (!isset($this->knownParams[$name])) { |
|
227 | 227 | $param = new Request_Param($this, $name); |
228 | 228 | $this->knownParams[$name] = $param; |
229 | 229 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function getRegisteredParam(string $name) : Request_Param |
242 | 242 | { |
243 | - if(isset($this->knownParams[$name])) { |
|
243 | + if (isset($this->knownParams[$name])) { |
|
244 | 244 | return $this->knownParams[$name]; |
245 | 245 | } |
246 | 246 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | { |
301 | 301 | static $accept; |
302 | 302 | |
303 | - if(!isset($accept)) { |
|
303 | + if (!isset($accept)) { |
|
304 | 304 | $accept = new Request_AcceptHeaders(); |
305 | 305 | } |
306 | 306 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | { |
320 | 320 | $_REQUEST[$name] = $value; |
321 | 321 | |
322 | - if(isset($this->knownParams[$name])) { |
|
322 | + if (isset($this->knownParams[$name])) { |
|
323 | 323 | unset($this->knownParams[$name]); |
324 | 324 | } |
325 | 325 | |
@@ -353,11 +353,11 @@ discard block |
||
353 | 353 | */ |
354 | 354 | public function removeParam(string $name) : Request |
355 | 355 | { |
356 | - if(isset($_REQUEST[$name])) { |
|
356 | + if (isset($_REQUEST[$name])) { |
|
357 | 357 | unset($_REQUEST[$name]); |
358 | 358 | } |
359 | 359 | |
360 | - if(isset($this->knownParams[$name])) { |
|
360 | + if (isset($this->knownParams[$name])) { |
|
361 | 361 | unset($this->knownParams[$name]); |
362 | 362 | } |
363 | 363 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function removeParams(array $names) : Request |
374 | 374 | { |
375 | - foreach($names as $name) { |
|
375 | + foreach ($names as $name) { |
|
376 | 376 | $this->removeParam($name); |
377 | 377 | } |
378 | 378 | |
@@ -388,10 +388,10 @@ discard block |
||
388 | 388 | * @param string $name |
389 | 389 | * @return bool |
390 | 390 | */ |
391 | - public function getBool($name, $default=false) |
|
391 | + public function getBool($name, $default = false) |
|
392 | 392 | { |
393 | 393 | $value = $this->getParam($name, $default); |
394 | - if(ConvertHelper::isBoolean($value)) { |
|
394 | + if (ConvertHelper::isBoolean($value)) { |
|
395 | 395 | return ConvertHelper::string2bool($value); |
396 | 396 | } |
397 | 397 | |
@@ -400,11 +400,11 @@ discard block |
||
400 | 400 | |
401 | 401 | public function validate() |
402 | 402 | { |
403 | - foreach($this->knownParams as $param) |
|
403 | + foreach ($this->knownParams as $param) |
|
404 | 404 | { |
405 | 405 | $name = $param->getName(); |
406 | 406 | |
407 | - if($param->isRequired() && !$this->hasParam($name)) |
|
407 | + if ($param->isRequired() && !$this->hasParam($name)) |
|
408 | 408 | { |
409 | 409 | throw new Request_Exception( |
410 | 410 | 'Missing request parameter '.$name, |
@@ -426,10 +426,10 @@ discard block |
||
426 | 426 | * @param mixed $default |
427 | 427 | * @return string |
428 | 428 | */ |
429 | - public function getFilteredParam($name, $default=null) |
|
429 | + public function getFilteredParam($name, $default = null) |
|
430 | 430 | { |
431 | 431 | $val = $this->getParam($name, $default); |
432 | - if(is_string($val)) { |
|
432 | + if (is_string($val)) { |
|
433 | 433 | $val = htmlspecialchars(trim(strip_tags($val)), ENT_QUOTES, 'UTF-8'); |
434 | 434 | } |
435 | 435 | |
@@ -448,24 +448,24 @@ discard block |
||
448 | 448 | * @see Request::getJSONAssoc() |
449 | 449 | * @see Request::getJSONObject() |
450 | 450 | */ |
451 | - public function getJSON(string $name, bool $assoc=true) |
|
451 | + public function getJSON(string $name, bool $assoc = true) |
|
452 | 452 | { |
453 | 453 | $value = $this->getParam($name); |
454 | 454 | |
455 | - if(!empty($value) && is_string($value)) |
|
455 | + if (!empty($value) && is_string($value)) |
|
456 | 456 | { |
457 | 457 | $data = json_decode($value, $assoc); |
458 | 458 | |
459 | - if($assoc && is_array($data)) { |
|
459 | + if ($assoc && is_array($data)) { |
|
460 | 460 | return $data; |
461 | 461 | } |
462 | 462 | |
463 | - if(is_object($data)) { |
|
463 | + if (is_object($data)) { |
|
464 | 464 | return $data; |
465 | 465 | } |
466 | 466 | } |
467 | 467 | |
468 | - if($assoc) { |
|
468 | + if ($assoc) { |
|
469 | 469 | return array(); |
470 | 470 | } |
471 | 471 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | public function getJSONAssoc(string $name) : array |
483 | 483 | { |
484 | 484 | $result = $this->getJSON($name); |
485 | - if(is_array($result)) { |
|
485 | + if (is_array($result)) { |
|
486 | 486 | return $result; |
487 | 487 | } |
488 | 488 | |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | public function getJSONObject(string $name) : object |
500 | 500 | { |
501 | 501 | $result = $this->getJSON($name, false); |
502 | - if(is_object($result)) { |
|
502 | + if (is_object($result)) { |
|
503 | 503 | return $result; |
504 | 504 | } |
505 | 505 | |
@@ -512,10 +512,10 @@ discard block |
||
512 | 512 | * @param array|string $data |
513 | 513 | * @param bool $exit Whether to exit the script afterwards. |
514 | 514 | */ |
515 | - public static function sendJSON($data, bool $exit=true) |
|
515 | + public static function sendJSON($data, bool $exit = true) |
|
516 | 516 | { |
517 | 517 | $payload = $data; |
518 | - if(!is_string($payload)) { |
|
518 | + if (!is_string($payload)) { |
|
519 | 519 | $payload = json_encode($payload); |
520 | 520 | } |
521 | 521 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | |
526 | 526 | echo $payload; |
527 | 527 | |
528 | - if($exit) |
|
528 | + if ($exit) |
|
529 | 529 | { |
530 | 530 | exit; |
531 | 531 | } |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | * @param string $html |
538 | 538 | * @param bool $exit Whether to exit the script afterwards. |
539 | 539 | */ |
540 | - public static function sendHTML(string $html, bool $exit=true) |
|
540 | + public static function sendHTML(string $html, bool $exit = true) |
|
541 | 541 | { |
542 | 542 | header('Cache-Control: no-cache, must-revalidate'); |
543 | 543 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | |
546 | 546 | echo $html; |
547 | 547 | |
548 | - if($exit) |
|
548 | + if ($exit) |
|
549 | 549 | { |
550 | 550 | exit; |
551 | 551 | } |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | * @param array $limitParams Whether to limit the comparison to these specific parameter names (if present) |
562 | 562 | * @return Request_URLComparer |
563 | 563 | */ |
564 | - public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams=array()) : Request_URLComparer |
|
564 | + public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams = array()) : Request_URLComparer |
|
565 | 565 | { |
566 | 566 | $comparer = new Request_URLComparer($this, $sourceURL, $targetURL); |
567 | 567 | $comparer->addLimitParams($limitParams); |
@@ -22,9 +22,9 @@ |
||
22 | 22 | { |
23 | 23 | use Traits_Optionable; |
24 | 24 | |
25 | - /** |
|
26 | - * @var Request_Param |
|
27 | - */ |
|
25 | + /** |
|
26 | + * @var Request_Param |
|
27 | + */ |
|
28 | 28 | protected $param; |
29 | 29 | |
30 | 30 | protected $value; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | protected function _filter() |
22 | 22 | { |
23 | - if($this->value === 'yes' || $this->value === 'true' || $this->value === true) { |
|
23 | + if ($this->value === 'yes' || $this->value === 'true' || $this->value === true) { |
|
24 | 24 | return true; |
25 | 25 | } |
26 | 26 |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | |
24 | 24 | protected function _filter() |
25 | 25 | { |
26 | - if(is_array($this->value)) { |
|
26 | + if (is_array($this->value)) { |
|
27 | 27 | return $this->value; |
28 | 28 | } |
29 | 29 | |
30 | - if($this->value === '' || $this->value === null || !is_string($this->value)) { |
|
30 | + if ($this->value === '' || $this->value === null || !is_string($this->value)) { |
|
31 | 31 | return array(); |
32 | 32 | } |
33 | 33 | |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | $stripEmptyEntries = $this->getBoolOption('stripEmptyEntries'); |
36 | 36 | $result = explode(',', $this->value); |
37 | 37 | |
38 | - if(!$trimEntries && !$stripEmptyEntries) { |
|
38 | + if (!$trimEntries && !$stripEmptyEntries) { |
|
39 | 39 | return $result; |
40 | 40 | } |
41 | 41 | |
42 | 42 | $keep = array(); |
43 | 43 | |
44 | - foreach($result as $entry) |
|
44 | + foreach ($result as $entry) |
|
45 | 45 | { |
46 | - if($trimEntries === true) { |
|
46 | + if ($trimEntries === true) { |
|
47 | 47 | $entry = trim($entry); |
48 | 48 | } |
49 | 49 | |
50 | - if($stripEmptyEntries === true && $entry === '') { |
|
50 | + if ($stripEmptyEntries === true && $entry === '') { |
|
51 | 51 | continue; |
52 | 52 | } |
53 | 53 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | protected function _filter() |
22 | 22 | { |
23 | - if(!is_scalar($this->value)) { |
|
23 | + if (!is_scalar($this->value)) { |
|
24 | 24 | return ''; |
25 | 25 | } |
26 | 26 |
@@ -27,11 +27,11 @@ |
||
27 | 27 | |
28 | 28 | protected function _validate() |
29 | 29 | { |
30 | - if(!is_scalar($this->value)) { |
|
30 | + if (!is_scalar($this->value)) { |
|
31 | 31 | return null; |
32 | 32 | } |
33 | 33 | |
34 | - if(preg_match('/\A[a-zA-Z]+\z/', $this->value)) { |
|
34 | + if (preg_match('/\A[a-zA-Z]+\z/', $this->value)) { |
|
35 | 35 | return $this->value; |
36 | 36 | } |
37 | 37 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | array_unshift($args, $this->value); |
35 | 35 | |
36 | 36 | $result = call_user_func_array($this->getOption('callback'), $args); |
37 | - if($result !== false) { |
|
37 | + if ($result !== false) { |
|
38 | 38 | return $this->value; |
39 | 39 | } |
40 | 40 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | protected function _validate() |
32 | 32 | { |
33 | - if(ConvertHelper::isInteger($this->value)) { |
|
33 | + if (ConvertHelper::isInteger($this->value)) { |
|
34 | 34 | return intval($this->value); |
35 | 35 | } |
36 | 36 |