PHP Класс Zephir\ClassDefinition

Represents a class/interface and their properties and methods
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_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

Открытые методы

Метод Описание
__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

Защищенные методы

Метод Описание
getConstantFromInterfaces ( $name ) : boolean | zephir\ClassConstant
hasConstantFromInterfaces ( $name ) : boolean

Приватные методы

Метод Описание
_convertPhpConstantType ( $phpType )

Описание методов

__construct() публичный Метод

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

addConstant() публичный Метод

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

addInitMethod() публичный Метод

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

addMethod() публичный Метод

Adds a method to the class definition
public addMethod ( ClassMethod $method, array $statement = null ) : void
$method ClassMethod
$statement array
Результат void

addProperty() публичный Метод

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

addStaticInitMethod() публичный Метод

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

buildFromReflection() публичный статический Метод

Builds a class definition from reflection
public static buildFromReflection ( ReflectionClass $class ) : ClassDefinition
$class ReflectionClass
Результат ClassDefinition

checkInterfaceImplements() публичный Метод

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

compile() публичный Метод

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

getAliasManager() публичный Метод

public getAliasManager ( ) : zephir\AliasManager
Результат zephir\AliasManager

getCNamespace() публичный Метод

Returns a valid namespace to be used in C-sources
public getCNamespace ( ) : string
Результат string

getClassEntry() публичный Метод

Returns the name of the zend_class_entry according to the class name
public getClassEntry ( zephir\CompilationContext $compilationContext = null ) : string
$compilationContext zephir\CompilationContext
Результат string

getClassEntryByClassName() публичный Метод

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
Результат string

getCompleteName() публичный Метод

Returns the class name including its namespace
public getCompleteName ( ) : string
Результат string

getConstant() публичный Метод

Returns a constant definition by its name
public getConstant ( string $constantName ) : boolean | zephir\ClassConstant
$constantName string
Результат boolean | zephir\ClassConstant

getConstantFromInterfaces() защищенный Метод

protected getConstantFromInterfaces ( $name ) : boolean | zephir\ClassConstant
$name
Результат boolean | zephir\ClassConstant

getConstants() публичный Метод

Returns all constants defined in the class
public getConstants ( ) : zephir\ClassConstant[]
Результат zephir\ClassConstant[]

getDependencies() публичный Метод

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

getDependencyRank() публичный Метод

Returns the dependency rank for this class
public getDependencyRank ( ) : integer
Результат integer

getDocBlock() публичный Метод

Returns the class/interface docBlock
public getDocBlock ( ) : array
Результат array

getEventsManager() публичный Метод

Get eventsManager for class definition
public getEventsManager ( ) : zephir\EventsManager
Результат zephir\EventsManager

getExtendsClass() публичный Метод

Returns the extended class
public getExtendsClass ( ) : string
Результат string

getExtendsClassDefinition() публичный Метод

Returns the class definition related to the extended class
public getExtendsClassDefinition ( ) : ClassDefinition
Результат ClassDefinition

getExternalHeader() публичный Метод

Returns an absolute location to the class header
public getExternalHeader ( ) : string
Результат string

getImplementedInterfaceDefinitions() публичный Метод

Returns the class definition for the implemented interfaces
public getImplementedInterfaceDefinitions ( ) : ClassDefinition[]
Результат ClassDefinition[]

getImplementedInterfaces() публичный Метод

Returns the implemented interfaces
public getImplementedInterfaces ( ) : array
Результат array

getInitMethod() публичный Метод

Returns the initialization method if any does exist
public getInitMethod ( ) : ClassMethod
Результат ClassMethod

getLocalOrParentInitMethod() публичный Метод

Returns the initialization method if any does exist
public getLocalOrParentInitMethod ( ) : ClassMethod
Результат ClassMethod

getMethod() публичный Метод

Returns a method by its name
public getMethod ( $methodName, boolean | true $checkExtends = true ) : boolean | ClassMethod
$checkExtends boolean | true
Результат boolean | ClassMethod

getMethods() публичный Метод

Returns all methods defined in the class
public getMethods ( ) : ClassMethod[]
Результат ClassMethod[]

getNCNamespace() публичный Метод

Returns a valid namespace to be used in C-sources
public getNCNamespace ( ) : string
Результат string

getName() публичный Метод

Returns the class name
public getName ( ) : string
Результат string

getNamespace() публичный Метод

Return the class namespace
public getNamespace ( ) : string
Результат string

getParsedDocBlock() публичный Метод

Returns the parsed docBlock
public getParsedDocBlock ( ) : DocBlock
Результат DocBlock

getPossibleMethodName() публичный Метод

Tries to find the most similar name
public getPossibleMethodName ( string $methodName ) : string | boolean
$methodName string
Результат string | boolean

getProperties() публичный Метод

Returns all properties defined in the class
public getProperties ( ) : ClassProperty[]
Результат ClassProperty[]

getProperty() публичный Метод

Returns a method definition by its name
public getProperty ( $propertyName ) : boolean | ClassProperty
Результат boolean | ClassProperty

getSCName() публичный Метод

Class name without namespace prefix for class registration
public getSCName ( string $namespace ) : string
$namespace string
Результат string

getShortName() публичный Метод

Returns the class name without namespace
public getShortName ( ) : string
Результат string

getStaticInitMethod() публичный Метод

Returns the initialization method if any does exist
public getStaticInitMethod ( ) : ClassMethod
Результат ClassMethod

getType() публичный Метод

Returns the class type
public getType ( ) : string
Результат string

hasConstant() публичный Метод

Checks if class definition has a property
public hasConstant ( string $name ) : boolean
$name string
Результат boolean

hasConstantFromInterfaces() защищенный Метод

protected hasConstantFromInterfaces ( $name ) : boolean
$name
Результат boolean

hasMethod() публичный Метод

Checks if the class implements an specific name
public hasMethod ( $methodName ) : boolean
Результат boolean

hasProperty() публичный Метод

Checks if a class definition has a property
public hasProperty ( string $name ) : boolean
$name string
Результат boolean

increaseDependencyRank() публичный Метод

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

isAbstract() публичный Метод

Checks whether the class is abstract or not
public isAbstract ( ) : boolean
Результат boolean

isBundled() публичный Метод

Returns whether the class is bundled or not
public isBundled ( ) : boolean
Результат boolean

isExternal() публичный Метод

Returns whether the class is internal or not
public isExternal ( ) : boolean
Результат boolean

isFinal() публичный Метод

Checks whether the class is abstract or not
public isFinal ( ) : boolean
Результат boolean

isGeneratedConstructor() публичный Метод

Returns whether the constructor was generated by zephir
public isGeneratedConstructor ( ) : boolean
Результат boolean

isInterface() публичный Метод

Check if the class definition correspond to an interface
public isInterface ( ) : boolean
Результат boolean

preCompile() публичный Метод

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

setAliasManager() публичный Метод

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

setDocBlock() публичный Метод

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

setExtendsClass() публичный Метод

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

setExtendsClassDefinition() публичный Метод

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

setImplementedInterfaceDefinitions() публичный Метод

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

setImplementsInterfaces() публичный Метод

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

setIsAbstract() публичный Метод

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

setIsBundled() публичный Метод

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

setIsExternal() публичный Метод

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

setIsFinal() публичный Метод

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

setIsGeneratedConstructor() публичный Метод

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

setMethod() публичный Метод

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

setMethods() публичный Метод

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

setOriginalNode() публичный Метод

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

setType() публичный Метод

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

updateMethod() публичный Метод

Updates an existing method definition
public updateMethod ( ClassMethod $method, array $statement = null ) : void
$method ClassMethod
$statement array
Результат void

Описание свойств

$_aliasManager защищенное свойство

protected AliasManager,zephir $_aliasManager
Результат zephir\AliasManager

$abstract защищенное свойство

protected bool $abstract
Результат boolean

$compiler защищенное свойство

protected Compiler,zephir $compiler
Результат Compiler

$constants защищенное свойство

protected ClassConstant[],zephir $constants
Результат zephir\ClassConstant[]

$dependencyRank защищенное свойство

protected int $dependencyRank
Результат integer

$docBlock защищенное свойство

protected array $docBlock
Результат array

$eventsManager защищенное свойство

protected EventsManager,zephir $eventsManager
Результат zephir\EventsManager

$extendsClass защищенное свойство

protected string $extendsClass
Результат string

$extendsClassDefinition защищенное свойство

protected ClassDefinition,zephir $extendsClassDefinition
Результат ClassDefinition

$external защищенное свойство

protected bool $external
Результат boolean

$final защищенное свойство

protected bool $final
Результат boolean

$implementedInterfaceDefinitions защищенное свойство

protected ClassDefinition[],zephir $implementedInterfaceDefinitions
Результат ClassDefinition[]

$interfaces защищенное свойство

protected array $interfaces
Результат array

$isBundled защищенное свойство

protected bool $isBundled
Результат boolean

$isGeneratedConstructor защищенное свойство

Whether the constructor was generated by zephir (-> no constructor existed previously)
protected bool $isGeneratedConstructor
Результат boolean

$methods защищенное свойство

protected ClassMethod[],zephir $methods
Результат ClassMethod[]

$name защищенное свойство

protected string $name
Результат string

$namespace защищенное свойство

protected string $namespace
Результат string

$originalNode защищенное свойство

protected array $originalNode
Результат array

$parsedDocblock защищенное свойство

protected Docblock,Zephir\Documentation $parsedDocblock
Результат Zephir\Documentation\Docblock

$properties защищенное свойство

protected ClassProperty[],zephir $properties
Результат ClassProperty[]

$shortName защищенное свойство

protected string $shortName
Результат string

$type защищенное свойство

protected string $type
Результат string