Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| FilterVarValidate | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| validate | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| testValue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @author: Doug Wilbourne (dougwilbourne@gmail.com) |
| 5 | */ |
| 6 | declare(strict_types=1); |
| 7 | |
| 8 | namespace pvc\filtervar; |
| 9 | |
| 10 | use pvc\interfaces\filtervar\FilterVarValidateInterface; |
| 11 | use pvc\interfaces\validator\ValTesterInterface; |
| 12 | |
| 13 | /** |
| 14 | * Class FilterVarValidate |
| 15 | * FilterVarValidateInterface extends ValtesterInterface so this object is also |
| 16 | * a ValTester object |
| 17 | */ |
| 18 | class FilterVarValidate extends FilterVar implements FilterVarValidateInterface |
| 19 | { |
| 20 | /** |
| 21 | * validate |
| 22 | * |
| 23 | * @param mixed $value |
| 24 | * |
| 25 | * @return bool |
| 26 | */ |
| 27 | public function validate(mixed $value): bool |
| 28 | { |
| 29 | return (false !== filter_var($value, $this->getFilter(), $this->getOptionsFlagsArray())); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * @param mixed $value |
| 34 | * |
| 35 | * @return bool |
| 36 | */ |
| 37 | public function testValue(mixed $value): bool |
| 38 | { |
| 39 | return $this->validate($value); |
| 40 | } |
| 41 | } |