ClassGenerator
extends AbstractClassGenerator
in package
Uses
UseTrait, PropertiesTrait, AbstractFinalTrait
Class generator class
Tags
Table of Contents
Properties
- $abstract : bool
- Method abstract flag
- $constants : array<string|int, mixed>
- Array of constant generator objects
- $docblock : DocblockGenerator|null
- Docblock generator object
- $final : bool
- Method final flag
- $indent : int
- Code indent spaces
- $interfaces : array<string|int, mixed>
- Interfaces that are implemented
- $methods : array<string|int, mixed>
- Array of method generator objects
- $name : string|null
- Name
- $namespace : NamespaceGenerator|null
- Namespace generator object
- $output : string|null
- Output string
- $parent : string|null
- Parent class that is extended
- $properties : array<string|int, mixed>
- Array of property generator objects
- $uses : array<string|int, mixed>
- Array of namespaces to use
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Print class
- addConstant() : AbstractClassGenerator
- Add a constant
- addConstants() : AbstractClassGenerator
- Add constants
- addInterface() : ClassGenerator
- Add a class interface
- addInterfaces() : ClassGenerator
- Add a class interface
- addMethod() : AbstractClassGenerator
- Add a method
- addMethods() : AbstractClassGenerator
- Add methods
- addProperties() : static
- Add class properties
- addProperty() : static
- Add a class property
- addUse() : static
- Add a namespace to use
- addUses() : static
- Add namespaces to use
- getConstant() : ConstantGenerator|null
- Get a constant
- getConstants() : array<string|int, mixed>
- Get all constants
- getDesc() : string|null
- Get the docblock description
- getDocblock() : DocblockGenerator|null
- Access the docblock generator object
- getIndent() : int
- Get the indent
- getInterfaces() : array<string|int, mixed>
- Get the class interfaces
- getMethod() : MethodGenerator|null
- Get a method
- getMethods() : array<string|int, mixed>
- Get all methods
- getName() : string|null
- Get the name
- getNamespace() : NamespaceGenerator|null
- Access the namespace generator object
- getOutput() : string
- Get the output
- getParent() : string|null
- Get the class parent
- getProperties() : array<string|int, mixed>
- Get all properties
- getProperty() : PropertyGenerator|null
- Get a class property
- getUses() : array<string|int, mixed>
- Get uses
- hasConstant() : bool
- Has a constant
- hasConstants() : bool
- Has constants
- hasDesc() : bool
- Has a docblock description
- hasDocblock() : bool
- Has docblock generator object
- hasIndent() : bool
- Has indent
- hasInterface() : bool
- Has class interface
- hasInterfaces() : bool
- Has class interfaces
- hasMethod() : bool
- Has a method
- hasMethods() : bool
- Has methods
- hasName() : bool
- Get the name
- hasNamespace() : bool
- Has a namespace generator object
- hasOutput() : bool
- Has output
- hasParent() : bool
- Has parent
- hasProperties() : bool
- Has properties
- hasProperty() : bool
- Has a class property
- hasUse() : bool
- Has use
- hasUses() : bool
- Has uses
- isAbstract() : bool
- Get the method abstract flag
- isFinal() : bool
- Get the method final flag
- isRendered() : bool
- Is rendered (alias to hasOutput())
- printIndent() : string
- Print the indent
- removeConstant() : AbstractClassGenerator
- Remove a constant
- removeInterface() : ClassGenerator
- Remove class interface
- removeMethod() : AbstractClassGenerator
- Remove a method
- removeProperty() : static
- Remove a class property
- render() : string
- Render class
- setAsAbstract() : static
- Set the method abstract flag
- setAsFinal() : static
- Set the method final flag
- setDesc() : static
- Set the docblock description
- setDocblock() : static
- Set the docblock generator object
- setIndent() : AbstractGenerator
- Set the indent
- setName() : static
- Set the name
- setNamespace() : static
- Set the namespace generator object
- setParent() : ClassGenerator
- Set the class parent
- formatConstants() : string
- Format the constants
- formatMethods() : string
- Format the methods
- formatProperties() : string
- Format the properties
Properties
$abstract
Method abstract flag
protected
bool
$abstract
= false
$constants
Array of constant generator objects
protected
array<string|int, mixed>
$constants
= []
$docblock
Docblock generator object
protected
DocblockGenerator|null
$docblock
= null
$final
Method final flag
protected
bool
$final
= false
$indent
Code indent spaces
protected
int
$indent
= 4
$interfaces
Interfaces that are implemented
protected
array<string|int, mixed>
$interfaces
= []
$methods
Array of method generator objects
protected
array<string|int, mixed>
$methods
= []
$name
Name
protected
string|null
$name
= null
$namespace
Namespace generator object
protected
NamespaceGenerator|null
$namespace
= null
$output
Output string
protected
string|null
$output
= null
$parent
Parent class that is extended
protected
string|null
$parent
= null
$properties
Array of property generator objects
protected
array<string|int, mixed>
$properties
= []
$uses
Array of namespaces to use
protected
array<string|int, mixed>
$uses
= []
Methods
__construct()
Constructor
public
__construct(string $name[, string|null $parent = null ][, mixed $interface = null ][, bool $abstract = false ]) : mixed
Instantiate the class generator object
Parameters
- $name : string
- $parent : string|null = null
- $interface : mixed = null
- $abstract : bool = false
__toString()
Print class
public
__toString() : string
Return values
stringaddConstant()
Add a constant
public
addConstant(ConstantGenerator $constant) : AbstractClassGenerator
Parameters
- $constant : ConstantGenerator
Return values
AbstractClassGeneratoraddConstants()
Add constants
public
addConstants(array<string|int, mixed> $constants) : AbstractClassGenerator
Parameters
- $constants : array<string|int, mixed>
Return values
AbstractClassGeneratoraddInterface()
Add a class interface
public
addInterface(string $interface) : ClassGenerator
Parameters
- $interface : string
Return values
ClassGeneratoraddInterfaces()
Add a class interface
public
addInterfaces(array<string|int, mixed> $interfaces) : ClassGenerator
Parameters
- $interfaces : array<string|int, mixed>
Return values
ClassGeneratoraddMethod()
Add a method
public
addMethod(MethodGenerator $method) : AbstractClassGenerator
Parameters
- $method : MethodGenerator
Return values
AbstractClassGeneratoraddMethods()
Add methods
public
addMethods(array<string|int, mixed> $methods) : AbstractClassGenerator
Parameters
- $methods : array<string|int, mixed>
Return values
AbstractClassGeneratoraddProperties()
Add class properties
public
addProperties(array<string|int, mixed> $properties) : static
Parameters
- $properties : array<string|int, mixed>
Return values
staticaddProperty()
Add a class property
public
addProperty(PropertyGenerator $property) : static
Parameters
- $property : PropertyGenerator
Return values
staticaddUse()
Add a namespace to use
public
addUse(string $use[, string|null $as = null ]) : static
Parameters
- $use : string
- $as : string|null = null
Return values
staticaddUses()
Add namespaces to use
public
addUses(array<string|int, mixed> $uses) : static
Parameters
- $uses : array<string|int, mixed>
Return values
staticgetConstant()
Get a constant
public
getConstant(mixed $constant) : ConstantGenerator|null
Parameters
- $constant : mixed
Return values
ConstantGenerator|nullgetConstants()
Get all constants
public
getConstants() : array<string|int, mixed>
Return values
array<string|int, mixed>getDesc()
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
intgetInterfaces()
Get the class interfaces
public
getInterfaces() : array<string|int, mixed>
Return values
array<string|int, mixed>getMethod()
Get a method
public
getMethod(mixed $method) : MethodGenerator|null
Parameters
- $method : mixed
Return values
MethodGenerator|nullgetMethods()
Get all methods
public
getMethods() : array<string|int, mixed>
Return values
array<string|int, mixed>getName()
Get the name
public
getName() : string|null
Return values
string|nullgetNamespace()
Access the namespace generator object
public
getNamespace() : NamespaceGenerator|null
Return values
NamespaceGenerator|nullgetOutput()
Get the output
public
getOutput() : string
Return values
stringgetParent()
Get the class parent
public
getParent() : string|null
Return values
string|nullgetProperties()
Get all properties
public
getProperties() : array<string|int, mixed>
Return values
array<string|int, mixed>getProperty()
Get a class property
public
getProperty(mixed $property) : PropertyGenerator|null
Parameters
- $property : mixed
Return values
PropertyGenerator|nullgetUses()
Get uses
public
getUses() : array<string|int, mixed>
Return values
array<string|int, mixed>hasConstant()
Has a constant
public
hasConstant(mixed $constant) : bool
Parameters
- $constant : mixed
Return values
boolhasConstants()
Has constants
public
hasConstants() : bool
Return values
boolhasDesc()
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
boolhasInterface()
Has class interface
public
hasInterface(string $interface) : bool
Parameters
- $interface : string
Return values
boolhasInterfaces()
Has class interfaces
public
hasInterfaces() : bool
Return values
boolhasMethod()
Has a method
public
hasMethod(mixed $method) : bool
Parameters
- $method : mixed
Return values
boolhasMethods()
Has methods
public
hasMethods() : bool
Return values
boolhasName()
Get the name
public
hasName() : bool
Return values
boolhasNamespace()
Has a namespace generator object
public
hasNamespace() : bool
Return values
boolhasOutput()
Has output
public
hasOutput() : bool
Return values
boolhasParent()
Has parent
public
hasParent() : bool
Return values
boolhasProperties()
Has properties
public
hasProperties() : bool
Return values
boolhasProperty()
Has a class property
public
hasProperty(mixed $property) : bool
Parameters
- $property : mixed
Return values
boolhasUse()
Has use
public
hasUse(string $use) : bool
Parameters
- $use : string
Return values
boolhasUses()
Has uses
public
hasUses() : bool
Return values
boolisAbstract()
Get the method abstract flag
public
isAbstract() : bool
Return values
boolisFinal()
Get the method final flag
public
isFinal() : bool
Return values
boolisRendered()
Is rendered (alias to hasOutput())
public
isRendered() : bool
Return values
boolprintIndent()
Print the indent
public
printIndent() : string
Return values
stringremoveConstant()
Remove a constant
public
removeConstant(mixed $constant) : AbstractClassGenerator
Parameters
- $constant : mixed
Return values
AbstractClassGeneratorremoveInterface()
Remove class interface
public
removeInterface(string $interface) : ClassGenerator
Parameters
- $interface : string
Return values
ClassGeneratorremoveMethod()
Remove a method
public
removeMethod(mixed $method) : AbstractClassGenerator
Parameters
- $method : mixed
Return values
AbstractClassGeneratorremoveProperty()
Remove a class property
public
removeProperty(mixed $property) : static
Parameters
- $property : mixed
Return values
staticrender()
Render class
public
render() : string
Return values
stringsetAsAbstract()
Set the method abstract flag
public
setAsAbstract([bool $abstract = true ]) : static
Parameters
- $abstract : bool = true
Return values
staticsetAsFinal()
Set the method final flag
public
setAsFinal([bool $final = true ]) : static
Parameters
- $final : bool = true
Return values
staticsetDesc()
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
staticsetNamespace()
Set the namespace generator object
public
setNamespace(NamespaceGenerator $namespace) : static
Parameters
- $namespace : NamespaceGenerator
Return values
staticsetParent()
Set the class parent
public
setParent([string|null $parent = null ]) : ClassGenerator
Parameters
- $parent : string|null = null
Return values
ClassGeneratorformatConstants()
Format the constants
protected
formatConstants() : string
Return values
stringformatMethods()
Format the methods
protected
formatMethods() : string
Return values
stringformatProperties()
Format the properties
protected
formatProperties() : string