Conditions | 5 |
Paths | 5 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | public function __construct(string $password) |
||
26 | { |
||
27 | if (\strlen($password) < 8) { |
||
28 | throw new PasswordMustReach8CharactersException(); |
||
29 | } |
||
30 | if (!\preg_match('/([A-Z])/', $password)) { |
||
31 | throw new PasswordMustHaveUpperException(); |
||
32 | } |
||
33 | if (!\preg_match('/([\d])/', $password)) { |
||
34 | throw new PasswordMustHaveDigitException(); |
||
35 | } |
||
36 | if (!\preg_match('/([\-#$+_!()@])/', $password)) { |
||
37 | throw new PasswordMustHaveSpecialCharactersException(); |
||
38 | } |
||
39 | |||
40 | $this->password = $password; |
||
41 | } |
||
53 |