iamfarhad /
validation
| 1 | <?php |
||
| 2 | |||
| 3 | /* |
||
| 4 | * This file is part of persian validation package |
||
| 5 | * |
||
| 6 | * (c) Farhad Zand <[email protected]> |
||
| 7 | * |
||
| 8 | * For the full copyright and license information, please view the LICENSE |
||
| 9 | * file that was distributed with this source code. |
||
| 10 | */ |
||
| 11 | |||
| 12 | namespace Iamfarhad\Validation\Rules; |
||
| 13 | |||
| 14 | use Iamfarhad\Validation\Contracts\AbstractValidationRule; |
||
| 15 | |||
| 16 | class PersianNumber extends AbstractValidationRule |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | public $validationRule = 'persian_number'; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param $attribute |
||
| 25 | * @param $value |
||
| 26 | * @param $parameters |
||
| 27 | * @param $validator |
||
| 28 | * @return bool |
||
| 29 | */ |
||
| 30 | public function rule($attribute, $value, $parameters, $validator): bool |
||
| 31 | { |
||
| 32 | return preg_match('/^[\x{6F0}-\x{6F9}]+$/u', $value); |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 33 | } |
||
| 34 | } |
||
| 35 |