ClassyDeclaration
A declared interface, trait, or class.
- Copyright
- 2016 Appertly
- License
- Apache-2.0
Constructors / Destructors
| Returns | Signature and Description | 
|---|---|
| void | __construct(,,,,,)Creates a new ClassDeclaration. | 
Instance Methods
| Returns | Signature and Description | 
|---|---|
| ?ConstantDeclaration | getConstant()Gets a constant by name | 
| ConstMap<string,ConstantDeclaration> | Gets all constants in this class by name | 
| Block | Gets the doc comment block. | 
| string | Gets the source filename. | 
| ?MethodDeclaration | getMethod()Gets a method by name | 
| ConstMap<string,MethodDeclaration> | Gets all methods in this class by name | 
| string | getName()Gets the name of the declaration. | 
| ConstMap<string,PropertyDeclaration> | Gets all properties in this class by name | 
| ?PropertyDeclaration | getProperty()Gets a property by name | 
| ScannedClass | getToken()Gets the scanned token. | 
| ?TypeConstantDeclaration | getTypeConstant()Gets a type constant by name | 
| ConstMap<string,TypeConstantDeclaration> | Gets all type constants in this class by name | 
| bool | Whether this class is an interface | 
| bool | isTrait()Whether this class is a trait | 
Static Methods
| Returns | Signature and Description | 
|---|---|
| ClassyDeclaration | Convenience method to create a new ClassyDeclaration. | 
| Returns | Signature and Description | 
|---|---|
| ConstMap<string,ConstantDeclaration> | mergeConstants(,,)Grab any inherited constants and make sure doc blocks are inherited. | 
| ConstMap<string,MethodDeclaration> | mergeMethods(,,)Grab any inherited methods and make sure doc blocks are inherited. | 
| ConstMap<string,PropertyDeclaration> | mergeProperties(,,)Grab any inherited properties and make sure doc blocks are inherited. | 
| ConstMap<string,TypeConstantDeclaration> | mergeTypeConstants(,,)Grab any inherited constants and make sure doc blocks are inherited. | 
Method Details
__construct
__construct(ScannedClass $classBlock $blockConstMap<string,PropertyDeclaration> $propertiesConstMap<string,MethodDeclaration> $methodsConstMap<string,ConstantDeclaration> $constantsConstMap<string,TypeConstantDeclaration> $typeConstantsCreates a new ClassDeclaration.
| Name | Type | Description | 
|---|---|---|
| $class | ScannedClass | The interface, trait, or class | 
| $block | Block | |
| $properties | ConstMap<string,PropertyDeclaration> | |
| $methods | ConstMap<string,MethodDeclaration> | |
| $constants | ConstMap<string,ConstantDeclaration> | |
| $typeConstants | ConstMap<string,TypeConstantDeclaration> | 
factory
Convenience method to create a new ClassyDeclaration.
| Name | Type | Description | 
|---|---|---|
| $token | ScannedClass | The class to read | 
| $parser | Parser | The doc comment parser | 
| $mapper | Mapper | The mapper | 
| Type | Description | 
|---|---|
| ClassyDeclaration | The created ClassyDeclaration | 
getConstant
getConstant(string $nameGets a constant by name
| Name | Type | Description | 
|---|---|---|
| $name | string | The constant name | 
| Type | Description | 
|---|---|
| ?ConstantDeclaration | The constant found or  | 
getConstants
getConstants()Gets all constants in this class by name
| Type | Description | 
|---|---|
| ConstMap<string,ConstantDeclaration> | All constants in this class | 
getDocBlock
getDocBlock()Gets the doc comment block.
| Type | Description | 
|---|---|
| Block | The doc block, which could be empty | 
getFilename
getFilename()Gets the source filename.
| Type | Description | 
|---|---|
| string | The filename | 
getMethod
getMethod(string $nameGets a method by name
| Name | Type | Description | 
|---|---|---|
| $name | string | The method name | 
| Type | Description | 
|---|---|
| ?MethodDeclaration | The method found or  | 
getMethods
getMethods()Gets all methods in this class by name
| Type | Description | 
|---|---|
| ConstMap<string,MethodDeclaration> | All methods in this class | 
getName
getName()Gets the name of the declaration.
| Type | Description | 
|---|---|
| string | The declaration name | 
getProperties
getProperties()Gets all properties in this class by name
| Type | Description | 
|---|---|
| ConstMap<string,PropertyDeclaration> | All properties in this class | 
getProperty
getProperty(string $nameGets a property by name
| Name | Type | Description | 
|---|---|---|
| $name | string | The property name | 
| Type | Description | 
|---|---|
| ?PropertyDeclaration | The property found or  | 
getToken
getToken()Gets the scanned token.
| Type | Description | 
|---|---|
| ScannedClass | The scanned token | 
getTypeConstant
getTypeConstant(string $nameGets a type constant by name
| Name | Type | Description | 
|---|---|---|
| $name | string | The constant name | 
| Type | Description | 
|---|---|
| ?TypeConstantDeclaration | The type constant found or  | 
getTypeConstants
getTypeConstants()Gets all type constants in this class by name
| Type | Description | 
|---|---|
| ConstMap<string,TypeConstantDeclaration> | All type constants in this class | 
isInterface
isInterface()Whether this class is an interface
| Type | Description | 
|---|---|
| bool | 
 | 
isTrait
isTrait()Whether this class is a trait
| Type | Description | 
|---|---|
| bool | 
 | 
mergeConstants
Grab any inherited constants and make sure doc blocks are inherited.
| Name | Type | Description | 
|---|---|---|
| $c | ScannedClass | The token | 
| $parser | Parser | The doc block parser | 
| $mapper | Mapper | The mapper | 
| Type | Description | 
|---|---|
| ConstMap<string,ConstantDeclaration> | The constants by name | 
mergeMethods
Grab any inherited methods and make sure doc blocks are inherited.
| Name | Type | Description | 
|---|---|---|
| $c | ScannedClass | The token | 
| $parser | Parser | The doc block parser | 
| $mapper | Mapper | The mapper | 
| Type | Description | 
|---|---|
| ConstMap<string,MethodDeclaration> | The methods by name | 
mergeProperties
Grab any inherited properties and make sure doc blocks are inherited.
| Name | Type | Description | 
|---|---|---|
| $c | ScannedClass | The token | 
| $parser | Parser | The doc block parser | 
| $mapper | Mapper | The mapper | 
| Type | Description | 
|---|---|
| ConstMap<string,PropertyDeclaration> | The properties by name | 
mergeTypeConstants
Grab any inherited constants and make sure doc blocks are inherited.
| Name | Type | Description | 
|---|---|---|
| $c | ScannedClass | The token | 
| $parser | Parser | The doc block parser | 
| $mapper | Mapper | The mapper | 
| Type | Description | 
|---|---|
| ConstMap<string,TypeConstantDeclaration> | The constants by name |