1 | <?php |
||
28 | class Enum implements ValidatorInterface |
||
29 | { |
||
30 | /** |
||
31 | * |
||
32 | * @var mixed[] |
||
33 | */ |
||
34 | protected $items; |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | * @see \Mcustiel\SimpleRequest\Interfaces\Specificable::setSpecification() |
||
39 | */ |
||
40 | 78 | public function setSpecification($specification = null) |
|
41 | { |
||
42 | 78 | if (!is_array($specification) || count($specification) == 0) { |
|
43 | 2 | throw new UnspecifiedValidatorException( |
|
44 | "The validator Enum is being initialized without an array" |
||
45 | 2 | ); |
|
46 | } |
||
47 | 78 | $this->items = $specification; |
|
48 | 78 | } |
|
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | * @see \Mcustiel\SimpleRequest\Interfaces\ValidatorInterface::validate() |
||
53 | */ |
||
54 | 77 | public function validate($value) |
|
58 | } |
||
59 |