Conditions | 1 |
Paths | 1 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
32 | 23 | public function validate(string $name): ConstraintViolationListInterface |
|
33 | { |
||
34 | 23 | $validator = Validation::createValidator(); |
|
35 | |||
36 | 23 | return $validator->validate($name, [ |
|
37 | 23 | new Length([ |
|
38 | 23 | 'min' => $this->minLength, |
|
39 | 23 | 'max' => $this->maxLength, |
|
40 | 'allowEmptyString' => false, |
||
41 | ]), |
||
42 | 23 | new Regex([ |
|
43 | 23 | 'pattern' => '/^[a-zA-Z][a-zA-Z0-9_]*$/', |
|
44 | ]), |
||
48 |