Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
68 | public function validate(string $password): bool |
||
69 | { |
||
70 | $pattern = '/[\\' . implode('\\', $this->whitelist) . ']/'; |
||
71 | $count = preg_match_all($pattern, $password); |
||
72 | |||
73 | if ($count >= $this->minimum) { |
||
74 | return true; |
||
75 | } |
||
76 | |||
77 | throw new PasswordException('Password must include at least ' . $this->minimum . ' special characters.'); |
||
78 | } |
||
80 |