Psr2 Code Generator

ConstantsPart

Constants part.

For all models that can contain constants

Tags
author

Thomas Gossmann

author

Cristiano Cinotti

Table of Contents

$constants  : Map
clearConstants()  : $this
Clears all constants.
getConstant()  : PhpConstant
Returns a constant.
getConstantNames()  : Set
Returns all constant names.
getConstants()  : Map
Returns all 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.
setConstant()  : $this
Add a PhpConstant object.
setConstantByName()  : $this
Create a PhpConstant instance and adds it to the constants Map.
setConstants()  : $this
Sets a collection of constants.
initConstants()  : void

Properties

Methods

clearConstants()

Clears all constants.

public clearConstants() : $this
Return values
$this

getConstant()

Returns a constant.

public getConstant(string $name) : PhpConstant
Parameters
$name : string

constant name

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 all constants.

public getConstants() : Map
Return values
Map

hasConstantByName()

Checks whether a constant exists.

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

constant name

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.

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

constant name

Tags
throws
InvalidArgumentException

If the constant cannot be found

Return values
$this

setConstantByName()

Create a PhpConstant instance and adds it to the constants Map.

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

constant name

$value : mixed = null
$isExpression : bool = false
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

initConstants()

private initConstants() : void
Return values
void

Search results