Total Complexity | 2 |
Total Lines | 16 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class ValidUsername implements Rule |
||
8 | { |
||
9 | /** |
||
10 | * It checks that the length of the username must be between 3 and 15 characters without spaces. |
||
11 | */ |
||
12 | public function passes($attribute, $value): bool |
||
13 | { |
||
14 | return preg_match('/^[a-z0-9_-]{3,15}$/', $value); |
||
|
|||
15 | } |
||
16 | |||
17 | /** |
||
18 | * Get the validation error message. |
||
19 | */ |
||
20 | public function message(): string |
||
23 | } |
||
24 | } |
||
25 |