1 | <?php |
||
28 | abstract class AbstractSizeValidator implements ValidatorInterface |
||
29 | { |
||
30 | /** |
||
31 | * The size to check. |
||
32 | * |
||
33 | * @var int |
||
34 | */ |
||
35 | protected $size; |
||
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | * |
||
40 | * @see \Mcustiel\SimpleRequest\Interfaces\Specificable::setSpecification() |
||
41 | */ |
||
42 | 89 | public function setSpecification($specification = null) |
|
43 | { |
||
44 | 89 | if (!is_int($specification) || $specification < 0) { |
|
45 | 6 | throw new UnspecifiedValidatorException( |
|
46 | 'Size validator is being initialized without a valid number' |
||
47 | 6 | ); |
|
48 | } |
||
49 | 83 | $this->size = $specification; |
|
50 | 83 | } |
|
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | * |
||
55 | * @see \Mcustiel\SimpleRequest\Interfaces\ValidatorInterface::validate() |
||
56 | */ |
||
57 | abstract public function validate($value); |
||
58 | } |
||
59 |