| @@ 82-89 (lines=8) @@ | ||
| 79 | * @param int $min |
|
| 80 | * @return $this |
|
| 81 | */ |
|
| 82 | public function min($min) |
|
| 83 | { |
|
| 84 | return $this->add(function ($value, $nameKey) use ($min) { |
|
| 85 | if (strlen($value) < $min) { |
|
| 86 | $this->createError('string.min', $value, $nameKey, $min); |
|
| 87 | } |
|
| 88 | }); |
|
| 89 | } |
|
| 90 | ||
| 91 | /** |
|
| 92 | * Validate the string is atleast $max characters |
|
| @@ 97-104 (lines=8) @@ | ||
| 94 | * @param int $max |
|
| 95 | * @return $this |
|
| 96 | */ |
|
| 97 | public function max($max) |
|
| 98 | { |
|
| 99 | return $this->add(function ($value, $nameKey) use ($max) { |
|
| 100 | if (strlen($value) > $max) { |
|
| 101 | return $this->createError('string.max', $value, $nameKey, $max); |
|
| 102 | } |
|
| 103 | }); |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * Validate the string matches the provided $regex |
|