PHP Class PDepend\Source\AST\AbstractASTType

Since: 1.0.0
Inheritance: extends PDepend\Source\AST\AbstractASTArtifact
Datei anzeigen Open project: pdepend/pdepend Class Usage Examples

Protected Properties

Property Type Description
$cache PDepend\Util\Cache\CacheDriver The internal used cache instance.
$constants array(string=>mixed) An array with all constants defined in this class or interface.
$context PDepend\Source\Builder\BuilderContext The currently used builder context.
$methods PDepend\Source\AST\ASTMethod[] Temporary property that only holds methods during the parsing process.
$modifiers integer The modifiers for this class instance.
$namespaceName string Name of the parent namespace for this class or interface instance. Or NULL when no namespace was specified.
$nodes PDepend\Source\AST\ASTNode[] List of all parsed child nodes.
$userDefined boolean The parser marks all classes and interfaces as user defined that have a source file and were part of parsing process.

Public Methods

Method Description
__sleep ( ) : array The magic sleep method is called by the PHP runtime environment before an instance of this class gets serialized. It returns an array with the names of all those properties that should be cached for this class or interface instance.
__wakeup ( ) : void The magic wakeup method is called by the PHP runtime environment when a serialized instance of this class gets unserialized and all properties are restored. This implementation of the __wakeup() method sets a flag that this object was restored from the cache and it restores the dependency between this class or interface and it's child methods.
addChild ( PDepend\Source\AST\ASTNode $node ) : void Adds a parsed child node to this node.
addMethod ( PDepend\Source\AST\ASTMethod $method ) : PDepend\Source\AST\ASTMethod Adds the given method to this type.
findChildrenOfType ( string $targetType, array &$results = [] ) : PDepend\Source\AST\ASTNode[] Will find all children for the given type.
getAllMethods ( ) : PDepend\Source\AST\ASTMethod[] Returns a list of all methods provided by this type or one of its parents.
getChild ( integer $index ) : PDepend\Source\AST\ASTNode Returns the child at the given index.
getChildren ( ) : PDepend\Source\AST\ASTNode[] Returns all child nodes of this class.
getFirstChildOfType ( string $targetType ) : PDepend\Source\AST\ASTNode This method will search recursive for the first child node that is an instance of the given $targetType. The returned value will be null if no child exists for that.
getMethods ( ) : PDepend\Source\AST\ASTMethod[] Returns all {@link \PDepend\Source\AST\ASTMethod} objects in this type.
getNamespace ( ) : PDepend\Source\AST\ASTNamespace Returns the parent namespace for this class.
getNamespaceName ( ) : string Returns the name of the parent namespace.
getTokens ( ) : PDepend\Source\Tokenizer\Token[] Returns an array with all tokens within this type.
isCached ( ) : boolean This method will return true when this class or interface instance was restored from the cache and not currently parsed. Otherwise this method will return false.
isSubtypeOf ( AbstractASTType $type ) : boolean Checks that this user type is a subtype of the given $type instance.
isUserDefined ( ) : boolean This method will return true when this type has a declaration in the analyzed source files.
setCache ( PDepend\Util\Cache\CacheDriver $cache ) : AbstractASTType Setter method for the currently used token cache, where this class or interface instance can store the associated tokens.
setContext ( PDepend\Source\Builder\BuilderContext $context ) : AbstractASTType Sets the currently active builder context.
setNamespace ( PDepend\Source\AST\ASTNamespace $namespace ) : void Sets the parent namespace for this type.
setTokens ( array $tokens ) : void Sets the tokens for this type.
setUserDefined ( ) : void This method can be used to mark a type as user defined. User defined means that the type has a valid declaration in the analyzed source files.
unsetNamespace ( ) : void Resets the associated namespace reference.

Protected Methods

Method Description
getTraitMethods ( ) : PDepend\Source\AST\ASTMethod[] Returns an array with {@link \PDepend\Source\AST\ASTMethod} objects that are imported through traits.

Method Details

__sleep() public method

The magic sleep method is called by the PHP runtime environment before an instance of this class gets serialized. It returns an array with the names of all those properties that should be cached for this class or interface instance.
public __sleep ( ) : array
return array

__wakeup() public method

The magic wakeup method is called by the PHP runtime environment when a serialized instance of this class gets unserialized and all properties are restored. This implementation of the __wakeup() method sets a flag that this object was restored from the cache and it restores the dependency between this class or interface and it's child methods.
public __wakeup ( ) : void
return void

addChild() public method

Adds a parsed child node to this node.
public addChild ( PDepend\Source\AST\ASTNode $node ) : void
$node PDepend\Source\AST\ASTNode
return void

addMethod() public method

Adds the given method to this type.
public addMethod ( PDepend\Source\AST\ASTMethod $method ) : PDepend\Source\AST\ASTMethod
$method PDepend\Source\AST\ASTMethod
return PDepend\Source\AST\ASTMethod

findChildrenOfType() public method

Will find all children for the given type.
public findChildrenOfType ( string $targetType, array &$results = [] ) : PDepend\Source\AST\ASTNode[]
$targetType string The target class or interface type.
$results array
return PDepend\Source\AST\ASTNode[]

getAllMethods() abstract public method

Returns a list of all methods provided by this type or one of its parents.
abstract public getAllMethods ( ) : PDepend\Source\AST\ASTMethod[]
return PDepend\Source\AST\ASTMethod[]

getChild() public method

Returns the child at the given index.
public getChild ( integer $index ) : PDepend\Source\AST\ASTNode
$index integer
return PDepend\Source\AST\ASTNode

getChildren() public method

Returns all child nodes of this class.
public getChildren ( ) : PDepend\Source\AST\ASTNode[]
return PDepend\Source\AST\ASTNode[]

getFirstChildOfType() public method

This method will search recursive for the first child node that is an instance of the given $targetType. The returned value will be null if no child exists for that.
public getFirstChildOfType ( string $targetType ) : PDepend\Source\AST\ASTNode
$targetType string Searched class or interface type.
return PDepend\Source\AST\ASTNode

getMethods() public method

Returns all {@link \PDepend\Source\AST\ASTMethod} objects in this type.
public getMethods ( ) : PDepend\Source\AST\ASTMethod[]
return PDepend\Source\AST\ASTMethod[]

getNamespace() public method

Returns the parent namespace for this class.
public getNamespace ( ) : PDepend\Source\AST\ASTNamespace
return PDepend\Source\AST\ASTNamespace

getNamespaceName() public method

Returns the name of the parent namespace.
public getNamespaceName ( ) : string
return string

getTokens() public method

Returns an array with all tokens within this type.
public getTokens ( ) : PDepend\Source\Tokenizer\Token[]
return PDepend\Source\Tokenizer\Token[]

getTraitMethods() protected method

Returns an array with {@link \PDepend\Source\AST\ASTMethod} objects that are imported through traits.
Since: 1.0.0
protected getTraitMethods ( ) : PDepend\Source\AST\ASTMethod[]
return PDepend\Source\AST\ASTMethod[]

isCached() public method

This method will return true when this class or interface instance was restored from the cache and not currently parsed. Otherwise this method will return false.
public isCached ( ) : boolean
return boolean

isSubtypeOf() abstract public method

Checks that this user type is a subtype of the given $type instance.
Since: 1.0.6
abstract public isSubtypeOf ( AbstractASTType $type ) : boolean
$type AbstractASTType
return boolean

isUserDefined() public method

This method will return true when this type has a declaration in the analyzed source files.
public isUserDefined ( ) : boolean
return boolean

setCache() public method

Setter method for the currently used token cache, where this class or interface instance can store the associated tokens.
public setCache ( PDepend\Util\Cache\CacheDriver $cache ) : AbstractASTType
$cache PDepend\Util\Cache\CacheDriver
return AbstractASTType

setContext() public method

Sets the currently active builder context.
public setContext ( PDepend\Source\Builder\BuilderContext $context ) : AbstractASTType
$context PDepend\Source\Builder\BuilderContext
return AbstractASTType

setNamespace() public method

Sets the parent namespace for this type.
public setNamespace ( PDepend\Source\AST\ASTNamespace $namespace ) : void
$namespace PDepend\Source\AST\ASTNamespace
return void

setTokens() public method

Sets the tokens for this type.
public setTokens ( array $tokens ) : void
$tokens array The generated tokens.
return void

setUserDefined() public method

This method can be used to mark a type as user defined. User defined means that the type has a valid declaration in the analyzed source files.
public setUserDefined ( ) : void
return void

unsetNamespace() public method

Resets the associated namespace reference.
public unsetNamespace ( ) : void
return void

Property Details

$cache protected_oe property

The internal used cache instance.
protected CacheDriver,PDepend\Util\Cache $cache
return PDepend\Util\Cache\CacheDriver

$constants protected_oe property

An array with all constants defined in this class or interface.
protected array(string=>mixed) $constants
return array(string=>mixed)

$context protected_oe property

The currently used builder context.
protected BuilderContext,PDepend\Source\Builder $context
return PDepend\Source\Builder\BuilderContext

$methods protected_oe property

Temporary property that only holds methods during the parsing process.
Since: 1.0.2
protected ASTMethod[],PDepend\Source\AST $methods
return PDepend\Source\AST\ASTMethod[]

$modifiers protected_oe property

The modifiers for this class instance.
protected int $modifiers
return integer

$namespaceName protected_oe property

Name of the parent namespace for this class or interface instance. Or NULL when no namespace was specified.
protected string $namespaceName
return string

$nodes protected_oe property

List of all parsed child nodes.
protected ASTNode[],PDepend\Source\AST $nodes
return PDepend\Source\AST\ASTNode[]

$userDefined protected_oe property

The parser marks all classes and interfaces as user defined that have a source file and were part of parsing process.
protected bool $userDefined
return boolean