Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | public function __construct(string $value) |
||
32 | { |
||
33 | $value = trim($value); |
||
34 | |||
35 | if (strlen($value) < self::MIN_LENGTH) { |
||
36 | throw InvalidPasswordException::invalidMinLength(); |
||
37 | } |
||
38 | |||
39 | if (!preg_match('/\pL/u', $value)) { |
||
40 | throw InvalidPasswordException::missingLetters(); |
||
41 | } |
||
42 | |||
43 | if (!preg_match('/\pN/u', $value)) { |
||
44 | throw InvalidPasswordException::missingNumbers(); |
||
45 | } |
||
46 | |||
47 | $this->value = $value; |
||
48 | } |
||
50 |