Methods

__construct()

__construct(string $name, string $namespaceName, array | string $flags, string $extends, array $interfaces, array $properties, array $methods, \Zend\Code\Generator\DocBlockGenerator $docBlock) 

Parameters

$name

string

$namespaceName

string

$flags

arraystring

$extends

string

$interfaces

array

$properties

array

$methods

array

Add Constant

addConstant(string $name, string $value) : \Zend\Code\Generator\ClassGenerator

Parameters

$name

string

$value

string

Exceptions

\Zend\Code\Generator\Exception\InvalidArgumentException

Returns

Add constant from PropertyGenerator

addConstantFromGenerator(\Zend\Code\Generator\PropertyGenerator $constant) : \Zend\Code\Generator\ClassGenerator

addConstants()

addConstants(array $constants) : \Zend\Code\Generator\ClassGenerator

addFlag()

addFlag(string $flag) : \Zend\Code\Generator\ClassGenerator

Parameters

$flag

string

Returns

Add Method from scalars

addMethod(string $name, array $parameters, int $flags, string $body, string $docBlock) : \Zend\Code\Generator\ClassGenerator

Parameters

$name

string

$parameters

array

$flags

int

$body

string

$docBlock

string

Exceptions

\Zend\Code\Generator\Exception\InvalidArgumentException

Returns

Add Method from MethodGenerator

addMethodFromGenerator(\Zend\Code\Generator\MethodGenerator $method) : \Zend\Code\Generator\ClassGenerator

addMethods()

addMethods(array $methods) : \Zend\Code\Generator\ClassGenerator

Parameters

$methods

array

Returns

addProperties()

addProperties(array $properties) : \Zend\Code\Generator\ClassGenerator

Parameters

$properties

array

Returns

Add Property from scalars

addProperty(string $name, string | array $defaultValue, int $flags) : \Zend\Code\Generator\ClassGenerator

Parameters

$name

string

$defaultValue

stringarray

$flags

int

Exceptions

\Zend\Code\Generator\Exception\InvalidArgumentException

Returns

Add property from PropertyGenerator

addPropertyFromGenerator(\Zend\Code\Generator\PropertyGenerator $property) : \Zend\Code\Generator\ClassGenerator

addTrait()

addTrait($trait) 

inherit Zend\Code\Generator\TraitUsageInterface

Parameters

$trait

addTraitAlias()

addTraitAlias($method, $alias, $visibility) 

inherit Zend\Code\Generator\TraitUsageInterface

Parameters

$method

$alias

$visibility

addTraitOverride()

addTraitOverride($method, $traitsToReplace) 

inherit Zend\Code\Generator\TraitUsageInterface

Parameters

$method

$traitsToReplace

addTraits()

addTraits(array $traits) 

inherit Zend\Code\Generator\TraitUsageInterface

Parameters

$traits

Add a class to "use" classes

addUse(string $use, string | null $useAlias) : \Zend\Code\Generator\ClassGenerator

Parameters

$use

string

$useAlias

stringnull

Returns

Generate from array

fromArray(array $array) : \Zend\Code\Generator\ClassGenerator

configkey name string [required] Class Name
configkey filegenerator FileGenerator File generator that holds this class
configkey namespacename string The namespace for this class
configkey docblock string The docblock information
configkey flags int Flags, one of ClassGenerator::FLAG_ABSTRACT ClassGenerator::FLAG_FINAL
configkey extendedclass string Class which this class is extending
configkey implementedinterfaces
configkey properties
configkey methods

Parameters

$array

array

Exceptions

\Zend\Code\Generator\Exception\InvalidArgumentException

Returns

Build a Code Generation Php Object from a Class Reflection

fromReflection(\Zend\Code\Reflection\ClassReflection $classReflection) : \Zend\Code\Generator\ClassGenerator

generate()

generate() 

inherit Zend\Code\Generator\GeneratorInterface

getConstant()

getConstant(string $constantName) : \Zend\Code\Generator\PropertyGenerator | false

Parameters

$constantName

string

Returns

getConstants()

getConstants() : \Zend\Code\Generator\PropertyGenerator[]

Returns

getContainingFileGenerator()

getContainingFileGenerator() : \Zend\Code\Generator\FileGenerator

getExtendedClass()

getExtendedClass() : string

Returns

string

getImplementedInterfaces()

getImplementedInterfaces() : array

Returns

array

getIndentation()

getIndentation() : string
Inherited

inherited_from \Zend\Code\Generator\AbstractGenerator::getIndentation()

Returns

string

getMethod()

getMethod(string $methodName) : \Zend\Code\Generator\MethodGenerator | false

Parameters

$methodName

string

Returns

getName()

getName() : string

Returns

string

getNamespaceName()

getNamespaceName() : string

Returns

string

getProperty()

getProperty(string $propertyName) : \Zend\Code\Generator\PropertyGenerator | false

Parameters

$propertyName

string

Returns

getSourceContent()

getSourceContent() : string
Inherited

inherited_from \Zend\Code\Generator\AbstractGenerator::getSourceContent()

Returns

string

getTraitAliases()

getTraitAliases() 

inherit Zend\Code\Generator\TraitUsageInterface

getTraitOverrides()

getTraitOverrides() 

inherit Zend\Code\Generator\TraitUsageInterface

getTraits()

getTraits() 

inherit Zend\Code\Generator\TraitUsageInterface

Returns the "use" classes

getUses() : array

Returns

array

hasConstant()

hasConstant(string $constantName) : bool

Parameters

$constantName

string

Returns

bool

hasMethod()

hasMethod(string $methodName) : bool

Parameters

$methodName

string

Returns

bool

hasProperty()

hasProperty(string $propertyName) : bool

Parameters

$propertyName

string

Returns

bool

hasTrait()

hasTrait($traitName) 

inherit Zend\Code\Generator\TraitUsageInterface

Parameters

$traitName

isAbstract()

isAbstract() : bool

Returns

bool

isFinal()

isFinal() : bool

Returns

bool

isSourceDirty()

isSourceDirty() : bool

Returns

bool

removeFlag()

removeFlag(string $flag) : \Zend\Code\Generator\ClassGenerator

Parameters

$flag

string

Returns

removeMethod()

removeMethod(string $methodName) : \Zend\Code\Generator\ClassGenerator

Parameters

$methodName

string

Returns

removeTrait()

removeTrait($traitName) 

inherit Zend\Code\Generator\TraitUsageInterface

Parameters

$traitName

removeTraitOverride()

removeTraitOverride($method, $overridesToRemove) 

inherit Zend\Code\Generator\TraitUsageInterface

Parameters

$method

$overridesToRemove

setAbstract()

setAbstract(bool $isAbstract) : \Zend\Code\Generator\ClassGenerator

Parameters

$isAbstract

bool

Returns

setContainingFileGenerator()

setContainingFileGenerator(\Zend\Code\Generator\FileGenerator $fileGenerator) : \Zend\Code\Generator\ClassGenerator

setDocBlock()

setDocBlock(\Zend\Code\Generator\DocBlockGenerator $docBlock) : \Zend\Code\Generator\ClassGenerator

setExtendedClass()

setExtendedClass(string $extendedClass) : \Zend\Code\Generator\ClassGenerator

Parameters

$extendedClass

string

Returns

setFinal()

setFinal(bool $isFinal) : \Zend\Code\Generator\ClassGenerator

Parameters

$isFinal

bool

Returns

setFlags()

setFlags(array | string $flags) : \Zend\Code\Generator\ClassGenerator

Parameters

$flags

arraystring

Returns

setImplementedInterfaces()

setImplementedInterfaces(array $implementedInterfaces) : \Zend\Code\Generator\ClassGenerator

Parameters

$implementedInterfaces

array

Returns

setIndentation()

setIndentation(string $indentation) : \Zend\Code\Generator\AbstractGenerator
Inherited

inherited_from \Zend\Code\Generator\AbstractGenerator::setIndentation()

Parameters

$indentation

string

Returns

setName()

setName(string $name) : \Zend\Code\Generator\ClassGenerator

Parameters

$name

string

Returns

setNamespaceName()

setNamespaceName(string $namespaceName) : \Zend\Code\Generator\ClassGenerator

Parameters

$namespaceName

string

Returns

setOptions()

setOptions(array | \Traversable $options) : \Zend\Code\Generator\AbstractGenerator
Inherited

inherited_from \Zend\Code\Generator\AbstractGenerator::setOptions()

Parameters

$options

array\Traversable

Exceptions

\Zend\Code\Generator\Exception\InvalidArgumentException

Returns

setSourceContent()

setSourceContent(string $sourceContent) : \Zend\Code\Generator\AbstractGenerator
Inherited

inherited_from \Zend\Code\Generator\AbstractGenerator::setSourceContent()

Parameters

$sourceContent

string

Returns

setSourceDirty()

setSourceDirty(bool $isSourceDirty) : \Zend\Code\Generator\AbstractGenerator
Inherited

inherited_from \Zend\Code\Generator\AbstractGenerator::setSourceDirty()

Parameters

$isSourceDirty

bool

Returns

 Properties

 

<p>Array of constants</p>

$constants : \Zend\Code\Generator\PropertyGenerator[]

 

$containingFileGenerator

$containingFileGenerator : \Zend\Code\Generator\FileGenerator

 

$docBlock

$docBlock : \Zend\Code\Generator\DocBlockGenerator

 

$extendedClass

$extendedClass : string

 

$flags

$flags : bool

 

<p>Array of string names</p>

$implementedInterfaces : array

 

<p>4 spaces by default</p>

$indentation : int | string
Inherited

inherited_from \Zend\Code\Generator\AbstractGenerator::$$indentation
 

$isSourceDirty

$isSourceDirty : bool
Inherited

inherited_from \Zend\Code\Generator\AbstractGenerator::$$isSourceDirty
 

<p>Array of methods</p>

$methods : \Zend\Code\Generator\MethodGenerator[]

 

$name

$name : string

 

$namespaceName

$namespaceName : string

 

<p>Array of properties</p>

$properties : \Zend\Code\Generator\PropertyGenerator[]

 

$sourceContent

$sourceContent : string
Inherited

inherited_from \Zend\Code\Generator\AbstractGenerator::$$sourceContent
 

<p>Object to encapsulate trait usage logic</p>

$traitUsageGenerator : \Zend\Code\Generator\TraitUsageGenerator

 Constants

 

FLAG_ABSTRACT

FLAG_ABSTRACT 

 

FLAG_FINAL

FLAG_FINAL 

 

Line feed to use in place of EOL

LINE_FEED 
Inherited

inherited_from \Zend\Code\Generator\AbstractGenerator::LINE_FEED
 

OBJECT_TYPE

OBJECT_TYPE