1 | <?php |
||
9 | class PasswordGenerator |
||
10 | { |
||
11 | /** @type string The characters to use in the password. */ |
||
12 | private $_characters; |
||
13 | |||
14 | /** @type int The length of the password. */ |
||
15 | private $_length; |
||
16 | |||
17 | /** |
||
18 | * Construct the password generator with the desired settings. |
||
19 | * |
||
20 | * @api |
||
21 | * @param string $characters The characters to use in the password. |
||
22 | * @param int $length The length of the password to generate. |
||
23 | */ |
||
24 | public function __construct($characters, $length = 32) |
||
29 | |||
30 | /** |
||
31 | * Generate a password. |
||
32 | * |
||
33 | * @api |
||
34 | * @return string The random password. |
||
35 | */ |
||
36 | public function __invoke() |
||
41 | |||
42 | /** |
||
43 | * Returns the default characters used by the generator. |
||
44 | * |
||
45 | * This is set to all of the printable ASCII characters. |
||
46 | * |
||
47 | * @return string The default characters used. |
||
48 | */ |
||
49 | public static function defaultCharacters() |
||
53 | } |
||
54 |