Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
2 / 2 |
Integer | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
filter | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
<?php | |
namespace Verja\Filter; | |
use Verja\Filter; | |
use Verja\Gate; | |
use Verja\Validator; | |
class Integer extends Filter | |
{ | |
/** | |
* Filter $value | |
* | |
* @param mixed $value | |
* @param array $context | |
* @return mixed | |
*/ | |
public function filter($value, array $context = []) | |
{ | |
Gate::assert(new Validator\Integer(), $value); | |
return (int)((double)$value); | |
} | |
} |