Total Complexity | 4 |
Total Lines | 21 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | class InSet implements ValidatorInterface |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | 3 | public function isValid($value, array $parameters) |
|
26 | { |
||
27 | 3 | if (count($parameters) === 0) { |
|
28 | 1 | throw new ValidationException('"set" expects at least one parameter.'); |
|
29 | } |
||
30 | 3 | return in_array($value, ['', null], true) || |
|
31 | 3 | in_array($value, $parameters); |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | 2 | public function getInvalidDetails() |
|
40 | } |
||
41 | } |
||
42 |