Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
3 / 3 |
| FloatSanitizer | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
3 / 3 |
| sanitize | |
100.00% |
1 / 1 |
2 | |
100.00% |
3 / 3 |
|||
| <?php | |
| declare(strict_types=1); | |
| namespace Korobochkin\WPKit\Sanitizers; | |
| /** | |
| * Class FloatSanitizer | |
| * @package Korobochkin\WPKit\Sanitizers | |
| */ | |
| class FloatSanitizer implements SanitizerInterface | |
| { | |
| /** | |
| * @param $value mixed Any types of values. | |
| * | |
| * @return float Value converted to float. | |
| */ | |
| public static function sanitize($value) | |
| { | |
| if (is_object($value)) { | |
| return 1.0; | |
| } | |
| return (float) $value; | |
| } | |
| } |