1 | <?php |
||
21 | class LengthRule extends AbstractCompareRule |
||
22 | { |
||
23 | /** |
||
24 | * @var integer minimum value |
||
25 | */ |
||
26 | protected $minValue; |
||
27 | |||
28 | /** |
||
29 | * @var integer maximum value |
||
30 | */ |
||
31 | protected $maxValue; |
||
32 | |||
33 | /** |
||
34 | * @var bool |
||
35 | */ |
||
36 | protected $inclusive = true; |
||
37 | |||
38 | /** |
||
39 | * Setup validation rule |
||
40 | * |
||
41 | * @param integer|null $min |
||
42 | * @param integer|null $max |
||
43 | * |
||
44 | * @throws \Bluz\Validator\Exception\ComponentException |
||
45 | */ |
||
46 | 18 | public function __construct($min = null, $max = null) |
|
69 | |||
70 | /** |
||
71 | * Check input data |
||
72 | * |
||
73 | * @param string $input |
||
74 | * |
||
75 | * @return bool |
||
76 | */ |
||
77 | 14 | public function validate($input) : bool |
|
86 | |||
87 | /** |
||
88 | * Extract length |
||
89 | * |
||
90 | * @param string|object $input |
||
91 | * |
||
92 | * @return integer|false |
||
93 | */ |
||
94 | 14 | protected function extractLength($input) |
|
105 | |||
106 | /** |
||
107 | * Get error template |
||
108 | * |
||
109 | * @return string |
||
110 | */ |
||
111 | 13 | public function getDescription() : string |
|
124 | } |
||
125 |