Psr2 Code Generator

ConstantsInterface

Interface to all php structs that can have constants.

Implementation is realized in the ConstantsPart

Tags
author

Thomas Gossmann

Table of Contents

clearConstants()  : $this
Clears all constants.
getConstant()  : PhpConstant
Returns a constant.
getConstantNames()  : Set
Returns all constant names.
getConstants()  : Map
Returns constants.
hasConstant()  : bool
Checks whether a constant exists.
hasConstantByName()  : bool
Checks whether a constant exists.
removeConstant()  : $this
Removes a constant.
removeConstantByName()  : $this
Removes a constant passing its name.
setConstant()  : $this
Adds a constant.
setConstantByName()  : $this
Adds a constant passing its name.
setConstants()  : $this
Sets a collection of constants.

Methods

clearConstants()

Clears all constants.

public clearConstants() : $this
Return values
$this

getConstant()

Returns a constant.

public getConstant(string $name) : PhpConstant
Parameters
$name : string
Tags
throws
InvalidArgumentException

If the constant cannot be found

Return values
PhpConstant

getConstantNames()

Returns all constant names.

public getConstantNames() : Set
Return values
Set

getConstants()

Returns constants.

public getConstants() : Map
Return values
Map

hasConstantByName()

Checks whether a constant exists.

public hasConstantByName(string $name) : bool
Parameters
$name : string
Return values
bool

removeConstant()

Removes a constant.

public removeConstant(PhpConstant $constant) : $this
Parameters
$constant : PhpConstant
Tags
throws
InvalidArgumentException

If the constant cannot be found

Return values
$this

removeConstantByName()

Removes a constant passing its name.

public removeConstantByName(string $name) : $this
Parameters
$name : string

constant name

Tags
throws
InvalidArgumentException

If the constant cannot be found

Return values
$this

setConstantByName()

Adds a constant passing its name.

public setConstantByName(string $name[, string $value = null ]) : $this
Parameters
$name : string

constant name

$value : string = null
Return values
$this

setConstants()

Sets a collection of constants.

public setConstants(array<string|int, mixed>|array<string|int, PhpConstant$constants) : $this
Parameters
$constants : array<string|int, mixed>|array<string|int, PhpConstant>
Return values
$this

Search results