src/voku/HtmlFormValidator/Rules/MaxLength.php 1 location
|
@@ 8-22 (lines=15) @@
|
| 5 |
|
use Respect\Validation\Rules\AbstractRule; |
| 6 |
|
use Respect\Validation\Rules\Length; |
| 7 |
|
|
| 8 |
|
class MaxLength extends AbstractRule |
| 9 |
|
{ |
| 10 |
|
protected $maxLength; |
| 11 |
|
|
| 12 |
|
public function __construct($maxLength = null) { |
| 13 |
|
$this->maxLength = $maxLength; |
| 14 |
|
} |
| 15 |
|
|
| 16 |
|
public function validate($input) |
| 17 |
|
{ |
| 18 |
|
$internValidate = new Length(null, $this->maxLength); |
| 19 |
|
|
| 20 |
|
return $internValidate->validate($input); |
| 21 |
|
} |
| 22 |
|
} |
| 23 |
|
|
src/voku/HtmlFormValidator/Rules/MinLength.php 1 location
|
@@ 8-23 (lines=16) @@
|
| 5 |
|
use Respect\Validation\Rules\AbstractRule; |
| 6 |
|
use Respect\Validation\Rules\Length; |
| 7 |
|
|
| 8 |
|
class MinLength extends AbstractRule |
| 9 |
|
{ |
| 10 |
|
protected $minLength; |
| 11 |
|
|
| 12 |
|
public function __construct($minLength = null) |
| 13 |
|
{ |
| 14 |
|
$this->minLength = $minLength; |
| 15 |
|
} |
| 16 |
|
|
| 17 |
|
public function validate($input) |
| 18 |
|
{ |
| 19 |
|
$internValidate = new Length($this->minLength, null); |
| 20 |
|
|
| 21 |
|
return $internValidate->validate($input); |
| 22 |
|
} |
| 23 |
|
} |
| 24 |
|
|