PHP Class Zephir\ClassDefinition

Represents a class/interface and their properties and methods
Afficher le fichier Open project: phalcon/zephir Class Usage Examples

Protected Properties

Свойство Type Description
$_aliasManager zephir\AliasManager
$abstract boolean
$compiler Compiler
$constants zephir\ClassConstant[]
$dependencyRank integer
$docBlock array
$eventsManager zephir\EventsManager
$extendsClass string
$extendsClassDefinition ClassDefinition
$external boolean
$final boolean
$implementedInterfaceDefinitions ClassDefinition[]
$interfaces array
$isBundled boolean
$isGeneratedConstructor boolean Whether the constructor was generated by zephir (-> no constructor existed previously)
$methods ClassMethod[]
$name string
$namespace string
$originalNode array
$parsedDocblock Zephir\Documentation\Docblock
$properties ClassProperty[]
$shortName string
$type string

Méthodes publiques

Méthode Description
__construct ( string $namespace, string $name, string $shortName = null ) ClassDefinition
addConstant ( zephir\ClassConstant $constant ) Adds a constant to the definition
addInitMethod ( zephir\StatementsBlock $statementsBlock ) Creates the initialization method
addMethod ( ClassMethod $method, array $statement = null ) : void Adds a method to the class definition
addProperty ( ClassProperty $property ) Adds a property to the definition
addStaticInitMethod ( zephir\StatementsBlock $statementsBlock ) Creates the static initialization method
buildFromReflection ( ReflectionClass $class ) : ClassDefinition Builds a class definition from reflection
checkInterfaceImplements ( ClassDefinition $classDefinition, ClassDefinition $interfaceDefinition ) Checks if a class implements an interface
compile ( zephir\CompilationContext $compilationContext ) Compiles a class/interface
getAliasManager ( ) : zephir\AliasManager
getCNamespace ( ) : string Returns a valid namespace to be used in C-sources
getClassEntry ( zephir\CompilationContext $compilationContext = null ) : string Returns the name of the zend_class_entry according to the class name
getClassEntryByClassName ( string $className, zephir\CompilationContext $compilationContext, boolean $check = true ) : string Convert Class/Interface name to C ClassEntry
getCompleteName ( ) : string Returns the class name including its namespace
getConstant ( string $constantName ) : boolean | zephir\ClassConstant Returns a constant definition by its name
getConstants ( ) : zephir\ClassConstant[] Returns all constants defined in the class
getDependencies ( ) Calculate the dependency rank of the class based on its dependencies
getDependencyRank ( ) : integer Returns the dependency rank for this class
getDocBlock ( ) : array Returns the class/interface docBlock
getEventsManager ( ) : zephir\EventsManager Get eventsManager for class definition
getExtendsClass ( ) : string Returns the extended class
getExtendsClassDefinition ( ) : ClassDefinition Returns the class definition related to the extended class
getExternalHeader ( ) : string Returns an absolute location to the class header
getImplementedInterfaceDefinitions ( ) : ClassDefinition[] Returns the class definition for the implemented interfaces
getImplementedInterfaces ( ) : array Returns the implemented interfaces
getInitMethod ( ) : ClassMethod Returns the initialization method if any does exist
getLocalOrParentInitMethod ( ) : ClassMethod Returns the initialization method if any does exist
getMethod ( $methodName, boolean | true $checkExtends = true ) : boolean | ClassMethod Returns a method by its name
getMethods ( ) : ClassMethod[] Returns all methods defined in the class
getNCNamespace ( ) : string Returns a valid namespace to be used in C-sources
getName ( ) : string Returns the class name
getNamespace ( ) : string Return the class namespace
getParsedDocBlock ( ) : DocBlock Returns the parsed docBlock
getPossibleMethodName ( string $methodName ) : string | boolean Tries to find the most similar name
getProperties ( ) : ClassProperty[] Returns all properties defined in the class
getProperty ( $propertyName ) : boolean | ClassProperty Returns a method definition by its name
getSCName ( string $namespace ) : string Class name without namespace prefix for class registration
getShortName ( ) : string Returns the class name without namespace
getStaticInitMethod ( ) : ClassMethod Returns the initialization method if any does exist
getType ( ) : string Returns the class type
hasConstant ( string $name ) : boolean Checks if class definition has a property
hasMethod ( $methodName ) : boolean Checks if the class implements an specific name
hasProperty ( string $name ) : boolean Checks if a class definition has a property
increaseDependencyRank ( integer $rank ) A class definition calls this method to mark this class as a dependency of another
isAbstract ( ) : boolean Checks whether the class is abstract or not
isBundled ( ) : boolean Returns whether the class is bundled or not
isExternal ( ) : boolean Returns whether the class is internal or not
isFinal ( ) : boolean Checks whether the class is abstract or not
isGeneratedConstructor ( ) : boolean Returns whether the constructor was generated by zephir
isInterface ( ) : boolean Check if the class definition correspond to an interface
preCompile ( zephir\CompilationContext $compilationContext ) Pre-compiles a class/interface gathering method information required by other methods
setAliasManager ( zephir\AliasManager $aliasManager )
setDocBlock ( array $docBlock ) Sets the class/interface docBlock
setExtendsClass ( string $extendsClass ) Sets the extended class
setExtendsClassDefinition ( $classDefinition ) Sets the class definition for the extended class
setImplementedInterfaceDefinitions ( array $implementedInterfaceDefinitions ) Sets the class definition for the implemented interfaces
setImplementsInterfaces ( array $implementedInterfaces ) Sets the implemented interfaces
setIsAbstract ( boolean $abstract ) Sets if the class is final
setIsBundled ( boolean $isBundled ) Sets if the class is internal or not
setIsExternal ( boolean $isExternal ) Sets whether the class is external or not
setIsFinal ( boolean $final ) Sets if the class is final
setIsGeneratedConstructor ( boolean $isGeneratedConstructor ) Sets if the class constructor was generated by zephir
setMethod ( $methodName, ClassMethod $method ) Set a method and its body
setMethods ( array $methods ) Sets class methods externally
setOriginalNode ( array $originalNode ) Set the original node where the class was declared
setType ( string $type ) Set the class' type (class/interface)
updateMethod ( ClassMethod $method, array $statement = null ) : void Updates an existing method definition

Méthodes protégées

Méthode Description
getConstantFromInterfaces ( $name ) : boolean | zephir\ClassConstant
hasConstantFromInterfaces ( $name ) : boolean

Private Methods

Méthode Description
_convertPhpConstantType ( $phpType )

Method Details

__construct() public méthode

ClassDefinition
public __construct ( string $namespace, string $name, string $shortName = null )
$namespace string
$name string
$shortName string

addConstant() public méthode

Adds a constant to the definition
public addConstant ( zephir\ClassConstant $constant )
$constant zephir\ClassConstant

addInitMethod() public méthode

Creates the initialization method
public addInitMethod ( zephir\StatementsBlock $statementsBlock )
$statementsBlock zephir\StatementsBlock

addMethod() public méthode

Adds a method to the class definition
public addMethod ( ClassMethod $method, array $statement = null ) : void
$method ClassMethod
$statement array
Résultat void

addProperty() public méthode

Adds a property to the definition
public addProperty ( ClassProperty $property )
$property ClassProperty

addStaticInitMethod() public méthode

Creates the static initialization method
public addStaticInitMethod ( zephir\StatementsBlock $statementsBlock )
$statementsBlock zephir\StatementsBlock

buildFromReflection() public static méthode

Builds a class definition from reflection
public static buildFromReflection ( ReflectionClass $class ) : ClassDefinition
$class ReflectionClass
Résultat ClassDefinition

checkInterfaceImplements() public méthode

Checks if a class implements an interface
public checkInterfaceImplements ( ClassDefinition $classDefinition, ClassDefinition $interfaceDefinition )
$classDefinition ClassDefinition
$interfaceDefinition ClassDefinition

compile() public méthode

Compiles a class/interface
public compile ( zephir\CompilationContext $compilationContext )
$compilationContext zephir\CompilationContext

getAliasManager() public méthode

public getAliasManager ( ) : zephir\AliasManager
Résultat zephir\AliasManager

getCNamespace() public méthode

Returns a valid namespace to be used in C-sources
public getCNamespace ( ) : string
Résultat string

getClassEntry() public méthode

Returns the name of the zend_class_entry according to the class name
public getClassEntry ( zephir\CompilationContext $compilationContext = null ) : string
$compilationContext zephir\CompilationContext
Résultat string

getClassEntryByClassName() public méthode

Convert Class/Interface name to C ClassEntry
public getClassEntryByClassName ( string $className, zephir\CompilationContext $compilationContext, boolean $check = true ) : string
$className string
$compilationContext zephir\CompilationContext
$check boolean
Résultat string

getCompleteName() public méthode

Returns the class name including its namespace
public getCompleteName ( ) : string
Résultat string

getConstant() public méthode

Returns a constant definition by its name
public getConstant ( string $constantName ) : boolean | zephir\ClassConstant
$constantName string
Résultat boolean | zephir\ClassConstant

getConstantFromInterfaces() protected méthode

protected getConstantFromInterfaces ( $name ) : boolean | zephir\ClassConstant
$name
Résultat boolean | zephir\ClassConstant

getConstants() public méthode

Returns all constants defined in the class
public getConstants ( ) : zephir\ClassConstant[]
Résultat zephir\ClassConstant[]

getDependencies() public méthode

Calculate the dependency rank of the class based on its dependencies
public getDependencies ( )

getDependencyRank() public méthode

Returns the dependency rank for this class
public getDependencyRank ( ) : integer
Résultat integer

getDocBlock() public méthode

Returns the class/interface docBlock
public getDocBlock ( ) : array
Résultat array

getEventsManager() public méthode

Get eventsManager for class definition
public getEventsManager ( ) : zephir\EventsManager
Résultat zephir\EventsManager

getExtendsClass() public méthode

Returns the extended class
public getExtendsClass ( ) : string
Résultat string

getExtendsClassDefinition() public méthode

Returns the class definition related to the extended class
public getExtendsClassDefinition ( ) : ClassDefinition
Résultat ClassDefinition

getExternalHeader() public méthode

Returns an absolute location to the class header
public getExternalHeader ( ) : string
Résultat string

getImplementedInterfaceDefinitions() public méthode

Returns the class definition for the implemented interfaces
public getImplementedInterfaceDefinitions ( ) : ClassDefinition[]
Résultat ClassDefinition[]

getImplementedInterfaces() public méthode

Returns the implemented interfaces
public getImplementedInterfaces ( ) : array
Résultat array

getInitMethod() public méthode

Returns the initialization method if any does exist
public getInitMethod ( ) : ClassMethod
Résultat ClassMethod

getLocalOrParentInitMethod() public méthode

Returns the initialization method if any does exist
public getLocalOrParentInitMethod ( ) : ClassMethod
Résultat ClassMethod

getMethod() public méthode

Returns a method by its name
public getMethod ( $methodName, boolean | true $checkExtends = true ) : boolean | ClassMethod
$checkExtends boolean | true
Résultat boolean | ClassMethod

getMethods() public méthode

Returns all methods defined in the class
public getMethods ( ) : ClassMethod[]
Résultat ClassMethod[]

getNCNamespace() public méthode

Returns a valid namespace to be used in C-sources
public getNCNamespace ( ) : string
Résultat string

getName() public méthode

Returns the class name
public getName ( ) : string
Résultat string

getNamespace() public méthode

Return the class namespace
public getNamespace ( ) : string
Résultat string

getParsedDocBlock() public méthode

Returns the parsed docBlock
public getParsedDocBlock ( ) : DocBlock
Résultat DocBlock

getPossibleMethodName() public méthode

Tries to find the most similar name
public getPossibleMethodName ( string $methodName ) : string | boolean
$methodName string
Résultat string | boolean

getProperties() public méthode

Returns all properties defined in the class
public getProperties ( ) : ClassProperty[]
Résultat ClassProperty[]

getProperty() public méthode

Returns a method definition by its name
public getProperty ( $propertyName ) : boolean | ClassProperty
Résultat boolean | ClassProperty

getSCName() public méthode

Class name without namespace prefix for class registration
public getSCName ( string $namespace ) : string
$namespace string
Résultat string

getShortName() public méthode

Returns the class name without namespace
public getShortName ( ) : string
Résultat string

getStaticInitMethod() public méthode

Returns the initialization method if any does exist
public getStaticInitMethod ( ) : ClassMethod
Résultat ClassMethod

getType() public méthode

Returns the class type
public getType ( ) : string
Résultat string

hasConstant() public méthode

Checks if class definition has a property
public hasConstant ( string $name ) : boolean
$name string
Résultat boolean

hasConstantFromInterfaces() protected méthode

protected hasConstantFromInterfaces ( $name ) : boolean
$name
Résultat boolean

hasMethod() public méthode

Checks if the class implements an specific name
public hasMethod ( $methodName ) : boolean
Résultat boolean

hasProperty() public méthode

Checks if a class definition has a property
public hasProperty ( string $name ) : boolean
$name string
Résultat boolean

increaseDependencyRank() public méthode

A class definition calls this method to mark this class as a dependency of another
public increaseDependencyRank ( integer $rank )
$rank integer

isAbstract() public méthode

Checks whether the class is abstract or not
public isAbstract ( ) : boolean
Résultat boolean

isBundled() public méthode

Returns whether the class is bundled or not
public isBundled ( ) : boolean
Résultat boolean

isExternal() public méthode

Returns whether the class is internal or not
public isExternal ( ) : boolean
Résultat boolean

isFinal() public méthode

Checks whether the class is abstract or not
public isFinal ( ) : boolean
Résultat boolean

isGeneratedConstructor() public méthode

Returns whether the constructor was generated by zephir
public isGeneratedConstructor ( ) : boolean
Résultat boolean

isInterface() public méthode

Check if the class definition correspond to an interface
public isInterface ( ) : boolean
Résultat boolean

preCompile() public méthode

Pre-compiles a class/interface gathering method information required by other methods
public preCompile ( zephir\CompilationContext $compilationContext )
$compilationContext zephir\CompilationContext

setAliasManager() public méthode

public setAliasManager ( zephir\AliasManager $aliasManager )
$aliasManager zephir\AliasManager

setDocBlock() public méthode

Sets the class/interface docBlock
public setDocBlock ( array $docBlock )
$docBlock array

setExtendsClass() public méthode

Sets the extended class
public setExtendsClass ( string $extendsClass )
$extendsClass string

setExtendsClassDefinition() public méthode

Sets the class definition for the extended class
public setExtendsClassDefinition ( $classDefinition )
$classDefinition

setImplementedInterfaceDefinitions() public méthode

Sets the class definition for the implemented interfaces
public setImplementedInterfaceDefinitions ( array $implementedInterfaceDefinitions )
$implementedInterfaceDefinitions array

setImplementsInterfaces() public méthode

Sets the implemented interfaces
public setImplementsInterfaces ( array $implementedInterfaces )
$implementedInterfaces array

setIsAbstract() public méthode

Sets if the class is final
public setIsAbstract ( boolean $abstract )
$abstract boolean

setIsBundled() public méthode

Sets if the class is internal or not
public setIsBundled ( boolean $isBundled )
$isBundled boolean

setIsExternal() public méthode

Sets whether the class is external or not
public setIsExternal ( boolean $isExternal )
$isExternal boolean

setIsFinal() public méthode

Sets if the class is final
public setIsFinal ( boolean $final )
$final boolean

setIsGeneratedConstructor() public méthode

Sets if the class constructor was generated by zephir
public setIsGeneratedConstructor ( boolean $isGeneratedConstructor )
$isGeneratedConstructor boolean

setMethod() public méthode

Set a method and its body
public setMethod ( $methodName, ClassMethod $method )
$methodName
$method ClassMethod

setMethods() public méthode

Sets class methods externally
public setMethods ( array $methods )
$methods array

setOriginalNode() public méthode

Set the original node where the class was declared
public setOriginalNode ( array $originalNode )
$originalNode array

setType() public méthode

Set the class' type (class/interface)
public setType ( string $type )
$type string

updateMethod() public méthode

Updates an existing method definition
public updateMethod ( ClassMethod $method, array $statement = null ) : void
$method ClassMethod
$statement array
Résultat void

Property Details

$_aliasManager protected_oe property

protected AliasManager,zephir $_aliasManager
Résultat zephir\AliasManager

$abstract protected_oe property

protected bool $abstract
Résultat boolean

$compiler protected_oe property

protected Compiler,zephir $compiler
Résultat Compiler

$constants protected_oe property

protected ClassConstant[],zephir $constants
Résultat zephir\ClassConstant[]

$dependencyRank protected_oe property

protected int $dependencyRank
Résultat integer

$docBlock protected_oe property

protected array $docBlock
Résultat array

$eventsManager protected_oe property

protected EventsManager,zephir $eventsManager
Résultat zephir\EventsManager

$extendsClass protected_oe property

protected string $extendsClass
Résultat string

$extendsClassDefinition protected_oe property

protected ClassDefinition,zephir $extendsClassDefinition
Résultat ClassDefinition

$external protected_oe property

protected bool $external
Résultat boolean

$final protected_oe property

protected bool $final
Résultat boolean

$implementedInterfaceDefinitions protected_oe property

protected ClassDefinition[],zephir $implementedInterfaceDefinitions
Résultat ClassDefinition[]

$interfaces protected_oe property

protected array $interfaces
Résultat array

$isBundled protected_oe property

protected bool $isBundled
Résultat boolean

$isGeneratedConstructor protected_oe property

Whether the constructor was generated by zephir (-> no constructor existed previously)
protected bool $isGeneratedConstructor
Résultat boolean

$methods protected_oe property

protected ClassMethod[],zephir $methods
Résultat ClassMethod[]

$name protected_oe property

protected string $name
Résultat string

$namespace protected_oe property

protected string $namespace
Résultat string

$originalNode protected_oe property

protected array $originalNode
Résultat array

$parsedDocblock protected_oe property

protected Docblock,Zephir\Documentation $parsedDocblock
Résultat Zephir\Documentation\Docblock

$properties protected_oe property

protected ClassProperty[],zephir $properties
Résultat ClassProperty[]

$shortName protected_oe property

protected string $shortName
Résultat string

$type protected_oe property

protected string $type
Résultat string