Menu

## EnvironmentVariableDefinition
in package
implements Definition

EnvironmentVariableDefinition.php : 13

Defines a reference to an environment variable, with fallback to a default value if the environment variable is not defined.

##### Tags

author

  James Harris james.harris@icecave.com.au

### 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

EnvironmentVariableDefinition.php : 26
`private mixed $defaultValue = null`

#### $isOptional

EnvironmentVariableDefinition.php : 25
`private bool $isOptional = false`

#### $name

EnvironmentVariableDefinition.php : 16

Entry name.

`private string $name = ''`

#### $variableName

EnvironmentVariableDefinition.php : 24
`private string $variableName`

### Methods

#### __construct()

EnvironmentVariableDefinition.php : 23
`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()

EnvironmentVariableDefinition.php : 69
`public __toString() : string`

##### Return values

string

#### getDefaultValue()

EnvironmentVariableDefinition.php : 59
`public getDefaultValue() : mixed`

##### Return values

mixed —

The default value to use if the environment variable is optional and not provided

#### getName()

EnvironmentVariableDefinition.php : 30
`public getName() : string`

##### Return values

string

#### getVariableName()

EnvironmentVariableDefinition.php : 43
`public getVariableName() : string`

##### Return values

string —

The name of the environment variable

#### isOptional()

EnvironmentVariableDefinition.php : 51
`public isOptional() : bool`

##### Return values

bool —

Whether or not the environment variable definition is optional

#### replaceNestedDefinitions()

EnvironmentVariableDefinition.php : 64
`public replaceNestedDefinitions(callable $replacer) : void`

##### Parameters

$replacer : callable

#### setName()

EnvironmentVariableDefinition.php : 35
`public setName(string $name) : void`

##### Parameters

$name : string

## Search results