EnvironmentVariableDefinition
in package
implements
Definition
Defines a reference to an environment variable, with fallback to a default value if the environment variable is not defined.
Tags
Table of Contents
Interfaces
- Definition
Properties
- $defaultValue : mixed
- $isOptional : bool
- $name : string
- Entry name.
- $variableName : string
Methods
- __construct() : mixed
- __toString() : string
- getDefaultValue() : mixed
- getName() : string
- getVariableName() : string
- isOptional() : bool
- replaceNestedDefinitions() : void
- setName() : void
Properties
$defaultValue
private
mixed
$defaultValue
= null
$isOptional
private
bool
$isOptional
= false
$name
Entry name.
private
string
$name
= ''
$variableName
private
string
$variableName
Methods
__construct()
public
__construct(string $variableName[, bool $isOptional = false ][, mixed $defaultValue = null ]) : mixed
Parameters
- $variableName : string
-
The name of the environment variable
- $isOptional : bool = false
-
Whether or not the environment variable definition is optional. If true and the environment variable given by $variableName has not been defined, $defaultValue is used.
- $defaultValue : mixed = null
-
The default value to use if the environment variable is optional and not provided
__toString()
public
__toString() : string
Return values
stringgetDefaultValue()
public
getDefaultValue() : mixed
Return values
mixed —The default value to use if the environment variable is optional and not provided
getName()
public
getName() : string
Return values
stringgetVariableName()
public
getVariableName() : string
Return values
string —The name of the environment variable
isOptional()
public
isOptional() : bool
Return values
bool —Whether or not the environment variable definition is optional
replaceNestedDefinitions()
public
replaceNestedDefinitions(callable $replacer) : void
Parameters
- $replacer : callable
setName()
public
setName(string $name) : void
Parameters
- $name : string