1 | <?php |
||
11 | class Len extends BaseValidator{ |
||
12 | |||
13 | /** |
||
14 | * @var int|null |
||
15 | */ |
||
16 | protected $exactLen; |
||
17 | |||
18 | /** |
||
19 | * @var string|null |
||
20 | */ |
||
21 | protected $exactLenError; |
||
22 | |||
23 | |||
24 | /** |
||
25 | * @var int|null |
||
26 | */ |
||
27 | protected $minLen; |
||
28 | |||
29 | /** |
||
30 | * @var string|null |
||
31 | */ |
||
32 | protected $minLenError; |
||
33 | |||
34 | |||
35 | /** |
||
36 | * @var int|null |
||
37 | */ |
||
38 | protected $maxLen; |
||
39 | |||
40 | /** |
||
41 | * @var string|null |
||
42 | */ |
||
43 | protected $maxLenError; |
||
44 | |||
45 | |||
46 | /** |
||
47 | * Maximum len of value |
||
48 | * |
||
49 | * @param $len |
||
50 | * @param $error |
||
51 | * @return $this |
||
52 | */ |
||
53 | 1 | public function max($len, $error) { |
|
58 | |||
59 | |||
60 | /** |
||
61 | * Minimum len of value |
||
62 | * |
||
63 | * @param $len |
||
64 | * @param $error |
||
65 | * @return $this |
||
66 | */ |
||
67 | 1 | public function min($len, $error) { |
|
72 | |||
73 | |||
74 | /** |
||
75 | * Expect exact len of value |
||
76 | * |
||
77 | * @param $len |
||
78 | * @param $error |
||
79 | * @return $this |
||
80 | */ |
||
81 | public function exact($len, $error) { |
||
82 | $this->exactLen = $len; |
||
83 | $this->exactLenError = $error; |
||
84 | return $this; |
||
85 | } |
||
86 | |||
87 | |||
88 | /** |
||
89 | * Validate value |
||
90 | * @param string $value |
||
91 | * @return bool |
||
92 | */ |
||
93 | 1 | public function isValid($value) { |
|
109 | |||
110 | } |