| @@ 533-543 (lines=11) @@ | ||
| 530 | * @param Validation $validation The validation results to add. |
|
| 531 | * @return bool Returns true if {@link $value} is valid or false otherwise. |
|
| 532 | */ |
|
| 533 | protected function validateFloat(&$value, array $field, Validation $validation) { |
|
| 534 | if (is_float($value)) { |
|
| 535 | $validType = true; |
|
| 536 | } elseif (is_numeric($value)) { |
|
| 537 | $value = (float)$value; |
|
| 538 | $validType = true; |
|
| 539 | } else { |
|
| 540 | $validType = false; |
|
| 541 | } |
|
| 542 | return $validType; |
|
| 543 | } |
|
| 544 | ||
| 545 | /** |
|
| 546 | * Validate and integer. |
|
| @@ 553-563 (lines=11) @@ | ||
| 550 | * @param Validation $validation The validation results to add. |
|
| 551 | * @return bool Returns true if {@link $value} is valid or false otherwise. |
|
| 552 | */ |
|
| 553 | protected function validateInteger(&$value, array $field, Validation $validation) { |
|
| 554 | if (is_int($value)) { |
|
| 555 | $validType = true; |
|
| 556 | } elseif (is_numeric($value)) { |
|
| 557 | $value = (int)$value; |
|
| 558 | $validType = true; |
|
| 559 | } else { |
|
| 560 | $validType = false; |
|
| 561 | } |
|
| 562 | return $validType; |
|
| 563 | } |
|
| 564 | ||
| 565 | /** |
|
| 566 | * Validate an object. |
|
| @@ 629-639 (lines=11) @@ | ||
| 626 | * @param Validation $validation The validation results to add. |
|
| 627 | * @return bool Returns true if {@link $value} is valid or false otherwise. |
|
| 628 | */ |
|
| 629 | protected function validateString(&$value, array $field, Validation $validation) { |
|
| 630 | if (is_string($value)) { |
|
| 631 | $validType = true; |
|
| 632 | } elseif (is_numeric($value)) { |
|
| 633 | $value = (string)$value; |
|
| 634 | $validType = true; |
|
| 635 | } else { |
|
| 636 | $validType = false; |
|
| 637 | } |
|
| 638 | return $validType; |
|
| 639 | } |
|
| 640 | ||
| 641 | /** |
|
| 642 | * Validate a unix timestamp. |
|