trait ConstantsTrait

Methods

setConstants(array $constants)

Sets a collection of constants

$this
setConstant(string|PhpConstant $nameOrConstant, string $value = null)

Adds a constant

boolean
hasConstant(string $name)

Checks whether a constant exists

getConstant(string $name)

Returns a constant.

$this
removeConstant(string $name)

Removes a constant

getConstants(boolean $asObjects = false)

Returns constants

Details

at line line 18
setConstants(array $constants)

Sets a collection of constants

Parameters

array $constants

at line line 42
$this setConstant(string|PhpConstant $nameOrConstant, string $value = null)

Adds a constant

Parameters

string|PhpConstant $nameOrConstant constant name or instance
string $value

Return Value

$this

at line line 63
boolean hasConstant(string $name)

Checks whether a constant exists

Parameters

string $name

Return Value

boolean

at line line 74
PhpConstant getConstant(string $name)

Returns a constant.

Parameters

string $name constant name

Return Value

PhpConstant

at line line 88
$this removeConstant(string $name)

Removes a constant

Parameters

string $name constant name

Return Value

$this

at line line 103
getConstants(boolean $asObjects = false)

Returns constants

Parameters

boolean $asObjects (deprecated, will be replaced with getConstantNames() and getConstant???() [??? = e.g. Map, Array] method)