PHP Class Zend\Code\Generator\ClassGenerator

Inheritance: extends Zend\Code\Generator\AbstractGenerator
Afficher le fichier Open project: zendframework/zend-code Class Usage Examples

Protected Properties

Свойство Type Description
$constants Array of constants
$containingFileGenerator Zend\Code\Generator\FileGenerator
$docBlock Zend\Code\Generator\DocBlockGenerator
$extendedClass string
$flags boolean
$implementedInterfaces Array of string names
$methods Array of methods
$name string
$namespaceName string
$properties Array of properties
$traitUsageGenerator Object to encapsulate trait usage logic

Méthodes publiques

Méthode Description
__construct ( string $name = null, string $namespaceName = null, array | string $flags = null, string $extends = null, array $interfaces = [], array $properties = [], array $methods = [], Zend\Code\Generator\DocBlockGenerator $docBlock = null )
addConstant ( string $name, string | integer | null | float | array $value ) : self Add Constant
addConstantFromGenerator ( Zend\Code\Generator\PropertyGenerator $constant ) : self Add constant from PropertyGenerator
addConstants ( array $constants ) : self
addFlag ( string $flag ) : self
addMethod ( string $name, array $parameters = [], integer $flags = MethodGenerator::FLAG_PUBLIC, string $body = null, string $docBlock = null ) : self Add Method from scalars
addMethodFromGenerator ( MethodGenerator $method ) : self Add Method from MethodGenerator
addMethods ( array $methods ) : self
addProperties ( array $properties ) : self
addProperty ( string $name, string | array $defaultValue = null, integer $flags = PropertyGenerator::FLAG_PUBLIC ) : self Add Property from scalars
addPropertyFromGenerator ( Zend\Code\Generator\PropertyGenerator $property ) : self Add property from PropertyGenerator
addTrait ( $trait )
addTraitAlias ( $method, $alias, $visibility = null )
addTraitOverride ( $method, $traitsToReplace )
addTraits ( array $traits )
addUse ( string $use, string | null $useAlias = null ) : self Add a class to "use" classes
fromArray ( array $array ) : self Generate from array
fromReflection ( Zend\Code\Reflection\ClassReflection $classReflection ) : self Build a Code Generation Php Object from a Class Reflection
generate ( )
getConstant ( string $constantName ) : Zend\Code\Generator\PropertyGenerator | false
getConstants ( ) : Zend\Code\Generator\PropertyGenerator[]
getContainingFileGenerator ( ) : Zend\Code\Generator\FileGenerator
getDocBlock ( ) : Zend\Code\Generator\DocBlockGenerator
getExtendedClass ( ) : string
getImplementedInterfaces ( ) : array
getMethod ( string $methodName ) : MethodGenerator | false
getMethods ( ) : MethodGenerator[]
getName ( ) : string
getNamespaceName ( ) : string
getProperties ( ) : Zend\Code\Generator\PropertyGenerator[]
getProperty ( string $propertyName ) : Zend\Code\Generator\PropertyGenerator | false
getTraitAliases ( )
getTraitOverrides ( )
getTraits ( )
getUses ( ) : array Returns the "use" classes
hasConstant ( string $constantName ) : boolean
hasExtentedClass ( ) : boolean
hasImplementedInterface ( string $implementedInterface ) : boolean
hasMethod ( string $methodName ) : boolean
hasProperty ( string $propertyName ) : boolean
hasTrait ( $traitName )
hasUse ( string $use ) : self
hasUseAlias ( string $use ) : boolean
isAbstract ( ) : boolean
isFinal ( ) : boolean
isSourceDirty ( ) : boolean
removeConstant ( string $constantName ) : self
removeExtentedClass ( ) : self
removeFlag ( string $flag ) : self
removeImplementedInterface ( $implementedInterface ) : self
removeMethod ( string $methodName ) : self
removeProperty ( string $propertyName ) : self
removeTrait ( $traitName )
removeTraitOverride ( $method, $overridesToRemove = null )
removeUse ( string $use ) : self
removeUseAlias ( $use ) : self
setAbstract ( boolean $isAbstract ) : self
setContainingFileGenerator ( Zend\Code\Generator\FileGenerator $fileGenerator ) : self
setDocBlock ( Zend\Code\Generator\DocBlockGenerator $docBlock ) : self
setExtendedClass ( string $extendedClass ) : self
setFinal ( boolean $isFinal ) : self
setFlags ( array | string $flags ) : self
setImplementedInterfaces ( array $implementedInterfaces ) : self
setName ( string $name ) : self
setNamespaceName ( string $namespaceName ) : self

Private Methods

Méthode Description
generateShortOrCompleteClassname ( string $fqnClassName ) : string
validateConstantValue ( mixed $value ) : void

Method Details

__construct() public méthode

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

addConstant() public méthode

Add Constant
public addConstant ( string $name, string | integer | null | float | array $value ) : self
$name string non-empty string
$value string | integer | null | float | array scalar
Résultat self

addConstantFromGenerator() public méthode

Add constant from PropertyGenerator
public addConstantFromGenerator ( Zend\Code\Generator\PropertyGenerator $constant ) : self
$constant Zend\Code\Generator\PropertyGenerator
Résultat self

addConstants() public méthode

public addConstants ( array $constants ) : self
$constants array
Résultat self

addFlag() public méthode

public addFlag ( string $flag ) : self
$flag string
Résultat self

addMethod() public méthode

Add Method from scalars
public addMethod ( string $name, array $parameters = [], integer $flags = MethodGenerator::FLAG_PUBLIC, string $body = null, string $docBlock = null ) : self
$name string
$parameters array
$flags integer
$body string
$docBlock string
Résultat self

addMethodFromGenerator() public méthode

Add Method from MethodGenerator
public addMethodFromGenerator ( MethodGenerator $method ) : self
$method MethodGenerator
Résultat self

addMethods() public méthode

public addMethods ( array $methods ) : self
$methods array
Résultat self

addProperties() public méthode

public addProperties ( array $properties ) : self
$properties array
Résultat self

addProperty() public méthode

Add Property from scalars
public addProperty ( string $name, string | array $defaultValue = null, integer $flags = PropertyGenerator::FLAG_PUBLIC ) : self
$name string
$defaultValue string | array
$flags integer
Résultat self

addPropertyFromGenerator() public méthode

Add property from PropertyGenerator
public addPropertyFromGenerator ( Zend\Code\Generator\PropertyGenerator $property ) : self
$property Zend\Code\Generator\PropertyGenerator
Résultat self

addTrait() public méthode

public addTrait ( $trait )

addTraitAlias() public méthode

public addTraitAlias ( $method, $alias, $visibility = null )

addTraitOverride() public méthode

public addTraitOverride ( $method, $traitsToReplace )

addTraits() public méthode

public addTraits ( array $traits )
$traits array

addUse() public méthode

Add a class to "use" classes
public addUse ( string $use, string | null $useAlias = null ) : self
$use string
$useAlias string | null
Résultat self

fromArray() public static méthode

Generate from array
public static fromArray ( array $array ) : self
$array array
Résultat self

fromReflection() public static méthode

Build a Code Generation Php Object from a Class Reflection
public static fromReflection ( Zend\Code\Reflection\ClassReflection $classReflection ) : self
$classReflection Zend\Code\Reflection\ClassReflection
Résultat self

generate() public méthode

public generate ( )

getConstant() public méthode

public getConstant ( string $constantName ) : Zend\Code\Generator\PropertyGenerator | false
$constantName string
Résultat Zend\Code\Generator\PropertyGenerator | false

getConstants() public méthode

public getConstants ( ) : Zend\Code\Generator\PropertyGenerator[]
Résultat Zend\Code\Generator\PropertyGenerator[] indexed by constant name

getContainingFileGenerator() public méthode

public getContainingFileGenerator ( ) : Zend\Code\Generator\FileGenerator
Résultat Zend\Code\Generator\FileGenerator

getDocBlock() public méthode

public getDocBlock ( ) : Zend\Code\Generator\DocBlockGenerator
Résultat Zend\Code\Generator\DocBlockGenerator

getExtendedClass() public méthode

public getExtendedClass ( ) : string
Résultat string

getImplementedInterfaces() public méthode

public getImplementedInterfaces ( ) : array
Résultat array

getMethod() public méthode

public getMethod ( string $methodName ) : MethodGenerator | false
$methodName string
Résultat MethodGenerator | false

getMethods() public méthode

public getMethods ( ) : MethodGenerator[]
Résultat MethodGenerator[]

getName() public méthode

public getName ( ) : string
Résultat string

getNamespaceName() public méthode

public getNamespaceName ( ) : string
Résultat string

getProperties() public méthode

public getProperties ( ) : Zend\Code\Generator\PropertyGenerator[]
Résultat Zend\Code\Generator\PropertyGenerator[]

getProperty() public méthode

public getProperty ( string $propertyName ) : Zend\Code\Generator\PropertyGenerator | false
$propertyName string
Résultat Zend\Code\Generator\PropertyGenerator | false

getTraitAliases() public méthode

public getTraitAliases ( )

getTraitOverrides() public méthode

public getTraitOverrides ( )

getTraits() public méthode

public getTraits ( )

getUses() public méthode

Returns the "use" classes
public getUses ( ) : array
Résultat array

hasConstant() public méthode

public hasConstant ( string $constantName ) : boolean
$constantName string
Résultat boolean

hasExtentedClass() public méthode

public hasExtentedClass ( ) : boolean
Résultat boolean

hasImplementedInterface() public méthode

public hasImplementedInterface ( string $implementedInterface ) : boolean
$implementedInterface string
Résultat boolean

hasMethod() public méthode

public hasMethod ( string $methodName ) : boolean
$methodName string
Résultat boolean

hasProperty() public méthode

public hasProperty ( string $propertyName ) : boolean
$propertyName string
Résultat boolean

hasTrait() public méthode

public hasTrait ( $traitName )

hasUse() public méthode

public hasUse ( string $use ) : self
$use string
Résultat self

hasUseAlias() public méthode

public hasUseAlias ( string $use ) : boolean
$use string
Résultat boolean

isAbstract() public méthode

public isAbstract ( ) : boolean
Résultat boolean

isFinal() public méthode

public isFinal ( ) : boolean
Résultat boolean

isSourceDirty() public méthode

public isSourceDirty ( ) : boolean
Résultat boolean

removeConstant() public méthode

public removeConstant ( string $constantName ) : self
$constantName string
Résultat self

removeExtentedClass() public méthode

public removeExtentedClass ( ) : self
Résultat self

removeFlag() public méthode

public removeFlag ( string $flag ) : self
$flag string
Résultat self

removeImplementedInterface() public méthode

public removeImplementedInterface ( $implementedInterface ) : self
$implementedInterface
Résultat self

removeMethod() public méthode

public removeMethod ( string $methodName ) : self
$methodName string
Résultat self

removeProperty() public méthode

public removeProperty ( string $propertyName ) : self
$propertyName string
Résultat self

removeTrait() public méthode

public removeTrait ( $traitName )

removeTraitOverride() public méthode

public removeTraitOverride ( $method, $overridesToRemove = null )

removeUse() public méthode

public removeUse ( string $use ) : self
$use string
Résultat self

removeUseAlias() public méthode

public removeUseAlias ( $use ) : self
$use
Résultat self

setAbstract() public méthode

public setAbstract ( boolean $isAbstract ) : self
$isAbstract boolean
Résultat self

setContainingFileGenerator() public méthode

public setContainingFileGenerator ( Zend\Code\Generator\FileGenerator $fileGenerator ) : self
$fileGenerator Zend\Code\Generator\FileGenerator
Résultat self

setDocBlock() public méthode

public setDocBlock ( Zend\Code\Generator\DocBlockGenerator $docBlock ) : self
$docBlock Zend\Code\Generator\DocBlockGenerator
Résultat self

setExtendedClass() public méthode

public setExtendedClass ( string $extendedClass ) : self
$extendedClass string
Résultat self

setFinal() public méthode

public setFinal ( boolean $isFinal ) : self
$isFinal boolean
Résultat self

setFlags() public méthode

public setFlags ( array | string $flags ) : self
$flags array | string
Résultat self

setImplementedInterfaces() public méthode

public setImplementedInterfaces ( array $implementedInterfaces ) : self
$implementedInterfaces array
Résultat self

setName() public méthode

public setName ( string $name ) : self
$name string
Résultat self

setNamespaceName() public méthode

public setNamespaceName ( string $namespaceName ) : self
$namespaceName string
Résultat self

Property Details

$constants protected_oe property

Array of constants
protected $constants

$containingFileGenerator protected_oe property

protected FileGenerator,Zend\Code\Generator $containingFileGenerator
Résultat Zend\Code\Generator\FileGenerator

$docBlock protected_oe property

protected DocBlockGenerator,Zend\Code\Generator $docBlock
Résultat Zend\Code\Generator\DocBlockGenerator

$extendedClass protected_oe property

protected string $extendedClass
Résultat string

$flags protected_oe property

protected bool $flags
Résultat boolean

$implementedInterfaces protected_oe property

Array of string names
protected $implementedInterfaces

$methods protected_oe property

Array of methods
protected $methods

$name protected_oe property

protected string $name
Résultat string

$namespaceName protected_oe property

protected string $namespaceName
Résultat string

$properties protected_oe property

Array of properties
protected $properties

$traitUsageGenerator protected_oe property

Object to encapsulate trait usage logic
protected $traitUsageGenerator