|
11 | 11 |
|
12 | 12 | class PassphraseGenerator |
13 | 13 | { |
| 14 | + /** |
| 15 | + * Minimum allowed number of words in a generated passphrase. |
| 16 | + * |
| 17 | + * @internal |
| 18 | + */ |
14 | 19 | public const MINIMUM_NUM_WORDS = 3; |
15 | 20 |
|
| 21 | + /** |
| 22 | + * Maximum allowed number of words in a generated passphrase. |
| 23 | + * |
| 24 | + * @internal |
| 25 | + * |
| 26 | + * @deprecated This constant is planned for removal in the next major version. Do not rely on a fixed maximum word count. |
| 27 | + */ |
16 | 28 | public const MAXIMUM_NUM_WORDS = 20; |
17 | 29 |
|
| 30 | + /** |
| 31 | + * Default number of words used when no explicit value is provided. |
| 32 | + * |
| 33 | + * @internal |
| 34 | + */ |
18 | 35 | public const DEFAULT_NUM_WORDS = 3; |
19 | 36 |
|
| 37 | + /** |
| 38 | + * Default separator used between words in generated passphrases. |
| 39 | + * |
| 40 | + * @internal |
| 41 | + */ |
20 | 42 | public const DEFAULT_WORD_SEPARATOR = '-'; |
21 | 43 |
|
| 44 | + /** |
| 45 | + * Default capitalization setting for generated passphrases. |
| 46 | + * |
| 47 | + * @internal |
| 48 | + */ |
22 | 49 | public const DEFAULT_CAPITALIZE = false; |
23 | 50 |
|
| 51 | + /** |
| 52 | + * Default setting for appending a random digit to a generated passphrase. |
| 53 | + * |
| 54 | + * @internal |
| 55 | + */ |
24 | 56 | public const DEFAULT_INCLUDE_NUMBER = false; |
25 | 57 |
|
26 | 58 | private WordList $wordList; |
@@ -71,10 +103,10 @@ public function setDefaults( |
71 | 103 | * Parameters default to the instance defaults set via setDefaults(). |
72 | 104 | * In Laravel, these come from config/passphrase.php. |
73 | 105 | * |
74 | | - * @param ?int $numWords Number of words (MINIMUM_NUM_WORDS-MAXIMUM_NUM_WORDS), null to use instance default |
| 106 | + * @param ?int $numWords Number of words (minimum 3), null to use instance default |
75 | 107 | * @param ?string $wordSeparator Character(s) to separate words, null to use instance default |
76 | 108 | * @param ?bool $capitalize Capitalize first letter of each word, null to use instance default |
77 | | - * @param ?bool $includeNumber Append a random digit to a random word, null to use instance default |
| 109 | + * @param ?bool $includeNumber Append a random digit (0-9) to a random word, null to use instance default |
78 | 110 | * @param ?int $targetEntropyBits Optional. If set, adjusts numWords to meet or exceed this target entropy. |
79 | 111 | * Entropy is calculated conservatively only based on the number of words in the word list, ignoring the additional entropy from numbers. |
80 | 112 | */ |
|
0 commit comments