package Default
inherited_from \Zend\Code\Generator\AbstractGenerator

 Methods

__construct()

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

Parameters

$name

string

$namespaceName

string

$flags

arraystring

$extends

string

$interfaces

array

$properties

array

$methods

array

$docBlock

\Zend\Code\Generator\DocBlockGenerator

__construct()

__construct(array $options = array()
Inherited

Parameters

$options

array

Add Constant

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

Parameters

$name

string

$value

string

Exceptions

\Zend\Code\Generator\Exception\InvalidArgumentException

Returns

\Zend\Code\Generator\ClassGenerator

Add constant from PropertyGenerator

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

Parameters

$constant

\Zend\Code\Generator\PropertyGenerator

Exceptions

\Zend\Code\Generator\Exception\InvalidArgumentException

Returns

\Zend\Code\Generator\ClassGenerator

addConstants()

addConstants(array<mixed,\Zend\Code\Generator\PropertyGenerator>|array<mixed,array> $constants) : \Zend\Code\Generator\ClassGenerator

Parameters

$constants

array<mixed,\Zend\Code\Generator\PropertyGenerator>array<mixed,array>

Returns

\Zend\Code\Generator\ClassGenerator

addFlag()

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

Parameters

$flag

string

Returns

\Zend\Code\Generator\ClassGenerator

Add Method from scalars

addMethod(string $name = null, array $parameters = array(), integer $flags = \Zend\Code\Generator\MethodGenerator::FLAG_PUBLIC, string $body = null, string $docBlock = null) : \Zend\Code\Generator\ClassGenerator

Parameters

$name

string

$parameters

array

$flags

integer

$body

string

$docBlock

string

Exceptions

\Zend\Code\Generator\Exception\InvalidArgumentException

Returns

\Zend\Code\Generator\ClassGenerator

Add Method from MethodGenerator

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

Parameters

$method

\Zend\Code\Generator\MethodGenerator

Exceptions

\Zend\Code\Generator\Exception\InvalidArgumentException

Returns

\Zend\Code\Generator\ClassGenerator

addMethods()

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

Parameters

$methods

array

Returns

\Zend\Code\Generator\ClassGenerator

addProperties()

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

Parameters

$properties

array

Returns

\Zend\Code\Generator\ClassGenerator

Add Property from scalars

addProperty(string $name, string|array $defaultValue = null, integer $flags = \Zend\Code\Generator\PropertyGenerator::FLAG_PUBLIC) : \Zend\Code\Generator\ClassGenerator

Parameters

$name

string

$defaultValue

stringarray

$flags

integer

Exceptions

\Zend\Code\Generator\Exception\InvalidArgumentException

Returns

\Zend\Code\Generator\ClassGenerator

Add property from PropertyGenerator

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

Parameters

$property

\Zend\Code\Generator\PropertyGenerator

Exceptions

\Zend\Code\Generator\Exception\InvalidArgumentException

Returns

\Zend\Code\Generator\ClassGenerator

addTrait()

addTrait($trait) 
inherit Zend\Code\Generator\TraitUsageInterface

Parameters

$trait

addTraitAlias()

addTraitAlias($method, $alias, $visibility = null
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 = null) : \Zend\Code\Generator\ClassGenerator

Parameters

$use

string

$useAlias

stringnull

Returns

\Zend\Code\Generator\ClassGenerator

Generate from array

fromArray(array $array) : \Zend\Code\Generator\ClassGenerator
Static
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

\Zend\Code\Generator\ClassGenerator

Build a Code Generation Php Object from a Class Reflection

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

Parameters

$classReflection

\Zend\Code\Reflection\ClassReflection

Returns

\Zend\Code\Generator\ClassGenerator

generate()

generate() 
inherit Zend\Code\Generator\GeneratorInterface

getConstant()

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

Parameters

$constantName

string

Returns

\Zend\Code\Generator\PropertyGeneratorfalse

getConstants()

getConstants() : array<mixed,\Zend\Code\Generator\PropertyGenerator>

Returns

array<mixed,\Zend\Code\Generator\PropertyGenerator>indexed by constant name

getContainingFileGenerator()

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

Returns

\Zend\Code\Generator\FileGenerator

getDocBlock()

getDocBlock() : \Zend\Code\Generator\DocBlockGenerator

Returns

\Zend\Code\Generator\DocBlockGenerator

getExtendedClass()

getExtendedClass() : string

Returns

string

getImplementedInterfaces()

getImplementedInterfaces() : array

Returns

array

getIndentation()

getIndentation() : string
Inherited

Returns

string

getMethod()

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

Parameters

$methodName

string

Returns

\Zend\Code\Generator\MethodGeneratorfalse

getMethods()

getMethods() : array<mixed,\Zend\Code\Generator\MethodGenerator>

Returns

array<mixed,\Zend\Code\Generator\MethodGenerator>

getName()

getName() : string

Returns

string

getNamespaceName()

getNamespaceName() : string

Returns

string

getProperties()

getProperties() : array<mixed,\Zend\Code\Generator\PropertyGenerator>

Returns

array<mixed,\Zend\Code\Generator\PropertyGenerator>

getProperty()

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

Parameters

$propertyName

string

Returns

\Zend\Code\Generator\PropertyGeneratorfalse

getSourceContent()

getSourceContent() : string
Inherited

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) : boolean

Parameters

$constantName

string

Returns

boolean

hasMethod()

hasMethod(string $methodName) : boolean

Parameters

$methodName

string

Returns

boolean

hasProperty()

hasProperty(string $propertyName) : boolean

Parameters

$propertyName

string

Returns

boolean

hasTrait()

hasTrait($traitName) 
inherit Zend\Code\Generator\TraitUsageInterface

Parameters

$traitName

isAbstract()

isAbstract() : boolean

Returns

boolean

isFinal()

isFinal() : boolean

Returns

boolean

isSourceDirty()

isSourceDirty() : boolean
inherited_from \Zend\Code\Generator\AbstractGenerator::isSourceDirty()

Returns

boolean

isSourceDirty()

isSourceDirty() : boolean
Inherited

Returns

boolean

removeFlag()

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

Parameters

$flag

string

Returns

\Zend\Code\Generator\ClassGenerator

removeMethod()

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

Parameters

$methodName

string

Returns

\Zend\Code\Generator\ClassGenerator

removeTrait()

removeTrait($traitName) 
inherit Zend\Code\Generator\TraitUsageInterface

Parameters

$traitName

removeTraitOverride()

removeTraitOverride($method, $overridesToRemove = null
inherit Zend\Code\Generator\TraitUsageInterface

Parameters

$method

$overridesToRemove

setAbstract()

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

Parameters

$isAbstract

boolean

Returns

\Zend\Code\Generator\ClassGenerator

setContainingFileGenerator()

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

Parameters

$fileGenerator

\Zend\Code\Generator\FileGenerator

Returns

\Zend\Code\Generator\ClassGenerator

setDocBlock()

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

Parameters

$docBlock

\Zend\Code\Generator\DocBlockGenerator

Returns

\Zend\Code\Generator\ClassGenerator

setExtendedClass()

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

Parameters

$extendedClass

string

Returns

\Zend\Code\Generator\ClassGenerator

setFinal()

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

Parameters

$isFinal

boolean

Returns

\Zend\Code\Generator\ClassGenerator

setFlags()

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

Parameters

$flags

arraystring

Returns

\Zend\Code\Generator\ClassGenerator

setImplementedInterfaces()

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

Parameters

$implementedInterfaces

array

Returns

\Zend\Code\Generator\ClassGenerator

setIndentation()

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

Parameters

$indentation

string

Returns

\Zend\Code\Generator\AbstractGenerator

setName()

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

Parameters

$name

string

Returns

\Zend\Code\Generator\ClassGenerator

setNamespaceName()

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

Parameters

$namespaceName

string

Returns

\Zend\Code\Generator\ClassGenerator

setOptions()

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

Parameters

$options

array\Traversable

Exceptions

\Zend\Code\Generator\Exception\InvalidArgumentException

Returns

\Zend\Code\Generator\AbstractGenerator

setSourceContent()

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

Parameters

$sourceContent

string

Returns

\Zend\Code\Generator\AbstractGenerator

setSourceDirty()

setSourceDirty(boolean $isSourceDirty = true) : \Zend\Code\Generator\AbstractGenerator
Inherited

Parameters

$isSourceDirty

boolean

Returns

\Zend\Code\Generator\AbstractGenerator

 Properties

 

Array of constants

$constants : array<mixed,\Zend\Code\Generator\PropertyGenerator>

Default

array()
 

$containingFileGenerator

$containingFileGenerator : \Zend\Code\Generator\FileGenerator

Default

null
 

$docBlock

$docBlock : \Zend\Code\Generator\DocBlockGenerator

Default

null
 

$extendedClass

$extendedClass : string

Default

null
 

$flags

$flags : boolean

Default

0
 

Array of string names

$implementedInterfaces : array

Default

array()
 

4 spaces by default

$indentation : integer | string

Default

' '
 

$isSourceDirty

$isSourceDirty : boolean

Default

true
 

Array of methods

$methods : array<mixed,\Zend\Code\Generator\MethodGenerator>

Default

array()
 

$name

$name : string

Default

null
 

$namespaceName

$namespaceName : string

Default

null
 

Array of properties

$properties : array<mixed,\Zend\Code\Generator\PropertyGenerator>

Default

array()
 

$sourceContent

$sourceContent : string

Default

null
 

Object to encapsulate trait usage logic

$traitUsageGenerator : \Zend\Code\Generator\TraitUsageGenerator

Default

 Constants

 

FLAG_ABSTRACT

FLAG_ABSTRACT = 1 
 

FLAG_FINAL

FLAG_FINAL = 2 
 

Line feed to use in place of EOL

LINE_FEED = "\n" 
 

OBJECT_TYPE

OBJECT_TYPE = "class"