1 | <?php |
||
6 | class PasswordValidator |
||
7 | { |
||
8 | /** @var Validator[] $validators */ |
||
9 | private $validators = []; |
||
10 | |||
11 | public function __construct(iterable $validators = []) |
||
17 | |||
18 | /** |
||
19 | * Adds a validator to the current PasswordValidator instance |
||
20 | * |
||
21 | * @param Validator $validator |
||
22 | */ |
||
23 | public function addValidator(Validator $validator): void |
||
27 | |||
28 | /** |
||
29 | * Gets an array of the currently applied Validators |
||
30 | * |
||
31 | * @return Validator[] |
||
32 | */ |
||
33 | public function getValidators(): array |
||
37 | |||
38 | /** |
||
39 | * Validates the given password against the current rule set. |
||
40 | * |
||
41 | * @param string $password |
||
42 | * @return bool True if the password is valid |
||
43 | * @throws PasswordException If the password fails a validation attempt. |
||
44 | */ |
||
45 | public function validate(string $password): bool |
||
53 | } |
||
54 |