| 1 | <?php |
||
| 18 | class RegexpRule extends AbstractRule |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var string error template |
||
| 22 | */ |
||
| 23 | protected $description = 'must validate with regular expression rule'; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var string regular expression for check string |
||
| 27 | */ |
||
| 28 | protected $regexp; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Check string by regular expression |
||
| 32 | * |
||
| 33 | * @param string $regexp |
||
| 34 | */ |
||
| 35 | public function __construct($regexp) |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Check string by regular expression |
||
| 42 | * |
||
| 43 | * @param mixed $input |
||
| 44 | * |
||
| 45 | * @return bool |
||
| 46 | */ |
||
| 47 | public function validate($input): bool |
||
| 51 | } |
||
| 52 |