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); |
||
26 | 119 | public function validate(string $name): ConstraintViolationListInterface |
|
27 | { |
||
28 | 119 | $validator = Validation::createValidator(); |
|
29 | |||
30 | 119 | return $validator->validate($name, [ |
|
31 | 119 | new Length([ |
|
32 | 119 | 'min' => $this->minLength, |
|
33 | 119 | 'max' => $this->maxLength, |
|
34 | 'allowEmptyString' => false, |
||
35 | ]), |
||
36 | 119 | new Regex([ |
|
37 | 119 | 'pattern' => '/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', |
|
38 | ]), |
||
42 |