PHP Trait gossi\codegen\model\parts\ConstantsPart

For all models that can contain constants
Author: Thomas Gossmann
Datei anzeigen Open project: gossi/php-code-generator

Public Methods

Method Description
clearConstants ( ) Clears all constants
getConstant ( string | PhpConstant $nameOrConstant ) : PhpConstant Returns a constant.
getConstantNames ( ) : phootwork\collection\Set Returns all constant names
getConstants ( ) : phootwork\collection\Map Returns all constants
hasConstant ( string | PhpConstant $nameOrConstant ) : boolean Checks whether a constant exists
removeConstant ( string | PhpConstant $nameOrConstant ) Removes a constant
setConstant ( string | PhpConstant $nameOrConstant, string $value = null, $isExpression = false ) Adds a constant
setConstants ( array $constants ) Sets a collection of constants

Private Methods

Method Description
initConstants ( )

Method Details

clearConstants() public method

Clears all constants
public clearConstants ( )

getConstant() public method

Returns a constant.
public getConstant ( string | PhpConstant $nameOrConstant ) : PhpConstant
$nameOrConstant string | gossi\codegen\model\PhpConstant
return gossi\codegen\model\PhpConstant

getConstantNames() public method

Returns all constant names
public getConstantNames ( ) : phootwork\collection\Set
return phootwork\collection\Set

getConstants() public method

Returns all constants
public getConstants ( ) : phootwork\collection\Map
return phootwork\collection\Map

hasConstant() public method

Checks whether a constant exists
public hasConstant ( string | PhpConstant $nameOrConstant ) : boolean
$nameOrConstant string | gossi\codegen\model\PhpConstant
return boolean

removeConstant() public method

Removes a constant
public removeConstant ( string | PhpConstant $nameOrConstant )
$nameOrConstant string | gossi\codegen\model\PhpConstant constant name

setConstant() public method

Adds a constant
public setConstant ( string | PhpConstant $nameOrConstant, string $value = null, $isExpression = false )
$nameOrConstant string | gossi\codegen\model\PhpConstant constant name or instance
$value string

setConstants() public method

Sets a collection of constants
public setConstants ( array $constants )
$constants array