EnvType
in package
Table of Contents
- DEB = 'deb'
- DEBUG = 'debug'
- DEV = 'dev'
- DEVELOPMENT = 'development'
- LOCAL = 'local'
- PROD = 'prod'
- PRODUCTION = 'production'
- SEC = 'sec'
- SECURE = 'secure'
- STAGING = 'staging'
- $filesystem : mixed
- $envTypes : array<string|int, mixed>
- An array of all environment types.
- __construct() : mixed
- createFile() : void
- filterFiles() : array<string|int, mixed>
- Filters out environment files that do not exist to avoid warnings.
- getAll() : array<string|int, string>
- Get all environment types.
- isValid() : bool
- Checks if the given type is a valid environment type.
- randStr() : string
- Generate a cryptographically secure password.
- supportedFiles() : array<string|int, string>
- Retrieves the default file names for environment configuration.
- tryRegenerateFile() : void
- Regenerates the tenant-specific .env file if it doesn't exist.
- generateFileContent() : string
- wpSalts() : array<string|int, string>
Constants
DEB
public
mixed
DEB
= 'deb'
DEBUG
public
mixed
DEBUG
= 'debug'
DEV
public
mixed
DEV
= 'dev'
DEVELOPMENT
public
mixed
DEVELOPMENT
= 'development'
LOCAL
public
mixed
LOCAL
= 'local'
PROD
public
mixed
PROD
= 'prod'
PRODUCTION
public
mixed
PRODUCTION
= 'production'
SEC
public
mixed
SEC
= 'sec'
SECURE
public
mixed
SECURE
= 'secure'
STAGING
public
mixed
STAGING
= 'staging'
Properties
$filesystem
protected
mixed
$filesystem
$envTypes
An array of all environment types.
private
static array<string|int, mixed>
$envTypes
= [self::SECURE, self::SEC, self::PRODUCTION, self::PROD, self::STAGING, self::DEVELOPMENT, self::DEV, self::DEBUG, self::DEB, self::LOCAL]
Methods
__construct()
public
__construct(Filesystem $filesystem) : mixed
Parameters
- $filesystem : Filesystem
Return values
mixed —createFile()
public
createFile(string $filePath, string $domain[, string|null $prefix = null ]) : void
Parameters
- $filePath : string
- $domain : string
- $prefix : string|null = null
Return values
void —filterFiles()
Filters out environment files that do not exist to avoid warnings.
public
filterFiles(array<string|int, mixed> $envFiles, string $appPath) : array<string|int, mixed>
Parameters
- $envFiles : array<string|int, mixed>
- $appPath : string
Return values
array<string|int, mixed> —getAll()
Get all environment types.
public
static getAll() : array<string|int, string>
Return values
array<string|int, string> —The list of environment types.
isValid()
Checks if the given type is a valid environment type.
public
static isValid(null|string $type) : bool
Parameters
- $type : null|string
-
The environment type to check.
Return values
bool —True if valid, false otherwise.
randStr()
Generate a cryptographically secure password.
public
static randStr([int $length = 8 ][, bool $useSpecialChars = false ]) : string
Parameters
- $length : int = 8
-
The length of the password to generate.
- $useSpecialChars : bool = false
-
Whether to include special characters in the password.
Return values
string —The generated password.
supportedFiles()
Retrieves the default file names for environment configuration.
public
static supportedFiles() : array<string|int, string>
Tags
Return values
array<string|int, string> —An array of default file names for environment configurations.
tryRegenerateFile()
Regenerates the tenant-specific .env file if it doesn't exist.
public
tryRegenerateFile(string $appPath, string $appHttpHost[, array<string|int, mixed> $availableFiles = [] ]) : void
Parameters
- $appPath : string
- $appHttpHost : string
- $availableFiles : array<string|int, mixed> = []
Return values
void —generateFileContent()
protected
generateFileContent([string|null $wpdomain = null ][, string|null $prefix = null ]) : string
Parameters
- $wpdomain : string|null = null
- $prefix : string|null = null
Return values
string —wpSalts()
protected
static wpSalts() : array<string|int, string>