Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
DI\Definition\EnvironmentVariableDefinition Class Reference
Inheritance diagram for DI\Definition\EnvironmentVariableDefinition:
DI\Definition\Definition DI\Factory\RequestedEntry

Public Member Functions

 __construct (private string $variableName, private bool $isOptional=false, private mixed $defaultValue=null,)
 
 __toString ()
 Definitions can be cast to string for debugging information.
 
 getDefaultValue ()
 
 getName ()
 Returns the name of the entry in the container.
 
 getVariableName ()
 
 isOptional ()
 
 replaceNestedDefinitions (callable $replacer)
 Apply a callable that replaces the definitions nested in this definition.
 
 setName (string $name)
 Set the name of the entry in the container.
 

Constructor & Destructor Documentation

◆ __construct()

DI\Definition\EnvironmentVariableDefinition::__construct ( private string $variableName,
private bool $isOptional = false,
private mixed $defaultValue = null )
Parameters
string$variableNameThe name of the environment variable
bool$isOptionalWhether or not the environment variable definition is optional. If true and the environment variable given by $variableName has not been defined, $defaultValue is used.
mixed$defaultValueThe default value to use if the environment variable is optional and not provided

Member Function Documentation

◆ __toString()

DI\Definition\EnvironmentVariableDefinition::__toString ( )

Definitions can be cast to string for debugging information.

Implements DI\Definition\Definition.

◆ getDefaultValue()

DI\Definition\EnvironmentVariableDefinition::getDefaultValue ( )
Return values
mixedThe default value to use if the environment variable is optional and not provided

◆ getName()

DI\Definition\EnvironmentVariableDefinition::getName ( )

Returns the name of the entry in the container.

Implements DI\Definition\Definition.

◆ getVariableName()

DI\Definition\EnvironmentVariableDefinition::getVariableName ( )
Return values
stringThe name of the environment variable

◆ isOptional()

DI\Definition\EnvironmentVariableDefinition::isOptional ( )
Return values
boolWhether or not the environment variable definition is optional

◆ replaceNestedDefinitions()

DI\Definition\EnvironmentVariableDefinition::replaceNestedDefinitions ( callable $replacer)

Apply a callable that replaces the definitions nested in this definition.

Implements DI\Definition\Definition.

◆ setName()

DI\Definition\EnvironmentVariableDefinition::setName ( string $name)

Set the name of the entry in the container.

Implements DI\Definition\Definition.


The documentation for this class was generated from the following file: