PasswordGenerator
in package
The PasswordGenerator class
Class to generate random secured password
Tags
Table of Contents
Constants
- CHAR_ALL = 15
- CHAR_ALPHA = 3
- CHAR_ALPHA_DIGIT = 7
- CHAR_ALPHA_LOWER = 1
- CHAR_ALPHA_UPPER = 2
- CHAR_DIGIT = 4
- CHAR_SYMBOL = 8
Properties
- $primarySets : array<string|int, mixed>
- The set of character we could require in password
Methods
- __construct() : mixed
- Constructor
- generate() : string
- Generate a random complex password
- setPrimarySet() : static
- Set a known set of character by flag
Constants
CHAR_ALL
public
mixed
CHAR_ALL
= 15
CHAR_ALPHA
public
mixed
CHAR_ALPHA
= 3
CHAR_ALPHA_DIGIT
public
mixed
CHAR_ALPHA_DIGIT
= 7
CHAR_ALPHA_LOWER
public
mixed
CHAR_ALPHA_LOWER
= 1
CHAR_ALPHA_UPPER
public
mixed
CHAR_ALPHA_UPPER
= 2
CHAR_DIGIT
public
mixed
CHAR_DIGIT
= 4
CHAR_SYMBOL
public
mixed
CHAR_SYMBOL
= 8
Properties
$primarySets
The set of character we could require in password
protected
array<string|int, mixed>
$primarySets
= []
Methods
__construct()
Constructor
public
__construct() : mixed
generate()
Generate a random complex password
public
generate([int $length = 10 ][, int $restriction = self::CHAR_ALPHA_DIGIT ][, array<string|int, int> $tokens = [self::CHAR_ALPHA, self::CHAR_DIGIT] ]) : string
Parameters
- $length : int = 10
- $restriction : int = self::CHAR_ALPHA_DIGIT
- $tokens : array<string|int, int> = [self::CHAR_ALPHA, self::CHAR_DIGIT]
Return values
stringsetPrimarySet()
Set a known set of character by flag
public
setPrimarySet(int $flag, string $characters) : static
Parameters
- $flag : int
- $characters : string