Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
Integer | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
filter | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Verja\Filter; |
4 | |
5 | use Verja\Filter; |
6 | use Verja\Gate; |
7 | use Verja\Validator; |
8 | |
9 | class Integer extends Filter |
10 | { |
11 | /** |
12 | * Filter $value |
13 | * |
14 | * @param mixed $value |
15 | * @param array $context |
16 | * @return mixed |
17 | */ |
18 | public function filter($value, array $context = []) |
19 | { |
20 | Gate::assert(new Validator\Integer(), $value); |
21 | |
22 | return (int)((double)$value); |
23 | } |
24 | } |