ConstantGenerator
extends AbstractClassElementGenerator
in package
Uses
NameTrait, DocblockTrait
Constant generator class
Tags
Table of Contents
Properties
- $docblock : DocblockGenerator|null
- Docblock generator object
- $indent : int
- Code indent spaces
- $name : string|null
- Name
- $output : string|null
- Output string
- $static : bool
- Static flag
- $type : string|null
- Constant type
- $value : mixed
- Constant value
- $visibility : string
- Visibility
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Print constant
- getDesc() : string|null
- Get the docblock description
- getDocblock() : DocblockGenerator|null
- Access the docblock generator object
- getIndent() : int
- Get the indent
- getName() : string|null
- Get the name
- getOutput() : string
- Get the output
- getType() : string
- Get the constant type
- getValue() : mixed
- Get the constant value
- getVisibility() : string
- Get the visibility
- hasDesc() : bool
- Has a docblock description
- hasDocblock() : bool
- Has docblock generator object
- hasIndent() : bool
- Has indent
- hasName() : bool
- Get the name
- hasOutput() : bool
- Has output
- hasValue() : bool
- Has constant value
- isPrivate() : bool
- Set the visibility to private
- isProtected() : bool
- Set the visibility to protected
- isPublic() : bool
- Is visibility public
- isRendered() : bool
- Is rendered (alias to hasOutput())
- isStatic() : bool
- Get the static flag
- printIndent() : string
- Print the indent
- render() : string
- Render constant
- setAsPrivate() : AbstractClassElementGenerator
- Set the visibility to public
- setAsProtected() : AbstractClassElementGenerator
- Set the visibility to protected
- setAsPublic() : AbstractClassElementGenerator
- Set the visibility to public
- setAsStatic() : AbstractClassElementGenerator
- Set the static flag
- setDesc() : static
- Set the docblock description
- setDocblock() : static
- Set the docblock generator object
- setIndent() : AbstractGenerator
- Set the indent
- setName() : static
- Set the name
- setType() : ConstantGenerator
- Set the constant type
- setValue() : ConstantGenerator
- Set the constant value
- setVisibility() : AbstractClassElementGenerator
- Set the visibility
- formatArrayValues() : string
- Format array value
Properties
$docblock
Docblock generator object
protected
DocblockGenerator|null
$docblock
= null
$indent
Code indent spaces
protected
int
$indent
= 4
$name
Name
protected
string|null
$name
= null
$output
Output string
protected
string|null
$output
= null
$static
Static flag
protected
bool
$static
= false
$type
Constant type
protected
string|null
$type
= null
$value
Constant value
protected
mixed
$value
= null
$visibility
Visibility
protected
string
$visibility
= 'public'
Methods
__construct()
Constructor
public
__construct(string $name, string $type[, mixed $value = null ]) : mixed
Instantiate the constant generator object
Parameters
- $name : string
- $type : string
- $value : mixed = null
__toString()
Print constant
public
__toString() : string
Return values
stringgetDesc()
Get the docblock description
public
getDesc() : string|null
Return values
string|nullgetDocblock()
Access the docblock generator object
public
getDocblock() : DocblockGenerator|null
Return values
DocblockGenerator|nullgetIndent()
Get the indent
public
getIndent() : int
Return values
intgetName()
Get the name
public
getName() : string|null
Return values
string|nullgetOutput()
Get the output
public
getOutput() : string
Return values
stringgetType()
Get the constant type
public
getType() : string
Return values
stringgetValue()
Get the constant value
public
getValue() : mixed
getVisibility()
Get the visibility
public
getVisibility() : string
Return values
stringhasDesc()
Has a docblock description
public
hasDesc() : bool
Return values
boolhasDocblock()
Has docblock generator object
public
hasDocblock() : bool
Return values
boolhasIndent()
Has indent
public
hasIndent() : bool
Return values
boolhasName()
Get the name
public
hasName() : bool
Return values
boolhasOutput()
Has output
public
hasOutput() : bool
Return values
boolhasValue()
Has constant value
public
hasValue() : bool
Return values
boolisPrivate()
Set the visibility to private
public
isPrivate() : bool
Return values
boolisProtected()
Set the visibility to protected
public
isProtected() : bool
Return values
boolisPublic()
Is visibility public
public
isPublic() : bool
Return values
boolisRendered()
Is rendered (alias to hasOutput())
public
isRendered() : bool
Return values
boolisStatic()
Get the static flag
public
isStatic() : bool
Return values
boolprintIndent()
Print the indent
public
printIndent() : string
Return values
stringrender()
Render constant
public
render() : string
Return values
stringsetAsPrivate()
Set the visibility to public
public
setAsPrivate() : AbstractClassElementGenerator
Tags
Return values
AbstractClassElementGeneratorsetAsProtected()
Set the visibility to protected
public
setAsProtected() : AbstractClassElementGenerator
Tags
Return values
AbstractClassElementGeneratorsetAsPublic()
Set the visibility to public
public
setAsPublic() : AbstractClassElementGenerator
Tags
Return values
AbstractClassElementGeneratorsetAsStatic()
Set the static flag
public
setAsStatic([bool $static = true ]) : AbstractClassElementGenerator
Parameters
- $static : bool = true
Return values
AbstractClassElementGeneratorsetDesc()
Set the docblock description
public
setDesc([string|null $desc = null ]) : static
Parameters
- $desc : string|null = null
Return values
staticsetDocblock()
Set the docblock generator object
public
setDocblock(DocblockGenerator $docblock) : static
Parameters
- $docblock : DocblockGenerator
Return values
staticsetIndent()
Set the indent
public
setIndent(int $indent) : AbstractGenerator
Parameters
- $indent : int
Return values
AbstractGeneratorsetName()
Set the name
public
setName(string $name) : static
Parameters
- $name : string
Return values
staticsetType()
Set the constant type
public
setType(string $type) : ConstantGenerator
Parameters
- $type : string
Return values
ConstantGeneratorsetValue()
Set the constant value
public
setValue([mixed $value = null ]) : ConstantGenerator
Parameters
- $value : mixed = null
Return values
ConstantGeneratorsetVisibility()
Set the visibility
public
setVisibility([string $visibility = 'public' ]) : AbstractClassElementGenerator
Parameters
- $visibility : string = 'public'
Tags
Return values
AbstractClassElementGeneratorformatArrayValues()
Format array value
protected
formatArrayValues() : string