1 | <?php |
||
13 | final class PasswordGeneratorManager implements PasswordGeneratorManagerInterface |
||
14 | { |
||
15 | /** |
||
16 | * The password generator registry. |
||
17 | * |
||
18 | * @var array |
||
19 | */ |
||
20 | private static $generators = []; |
||
21 | |||
22 | /** |
||
23 | * Registers the given password generator with the given name. |
||
24 | * |
||
25 | * @param string $name |
||
26 | * @param callable|PasswordGeneratorInterface|string $generator |
||
27 | */ |
||
28 | 5 | public function register(string $name, $generator): void |
|
46 | |||
47 | /** |
||
48 | * Get the previously registered generator by the given name. |
||
49 | * |
||
50 | * @param null|string $generatorName |
||
51 | * |
||
52 | * @return callable |
||
53 | */ |
||
54 | 3 | public function get(?string $generatorName = null): callable |
|
64 | |||
65 | /** |
||
66 | * Create a new password generator instance using the given |
||
67 | * fully qualified password generator class name. |
||
68 | * |
||
69 | * @param string $className |
||
70 | * |
||
71 | * @return PasswordGeneratorInterface |
||
72 | */ |
||
73 | 3 | private function createGeneratorFromString(string $className): PasswordGeneratorInterface |
|
90 | } |
||
91 |
Late static binding only has effect in subclasses. A
final
class cannot be extended anymore so late static binding cannot occurr. Consider replacingstatic::
withself::
.To learn more about late static binding, please refer to the PHP core documentation.