PHP Class PDepend\Source\AST\ASTCompilationUnit

Inheritance: extends PDepend\Source\AST\AbstractASTArtifact
Show file Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$cache PDepend\Util\Cache\CacheDriver The internal used cache instance.
$cached boolean Was this file instance restored from the cache?
$childNodes PDepend\Source\AST\AbstractASTArtifact[] List of classes, interfaces and functions that parsed from this file.
$comment string The comment for this type.
$endLine integer The files end line.
$fileName string The source file name/path.
$id string The unique identifier for this function.
$startLine integer The files start line. This property must always have the value 1.

Public Methods

Method Description
__construct ( string $fileName ) Constructs a new source file instance.
__sleep ( ) : array(string) The magic sleep method will be called by PHP's runtime environment right before it serializes an instance of this class. This method returns an array with those property names that should be serialized.
__toString ( ) : string Returns the string representation of this class.
__wakeup ( ) : void The magic wakeup method will is called by PHP's runtime environment when a serialized instance of this class was unserialized. This implementation of the wakeup method restores the references between all parsed entities in this source file and this file instance.
accept ( PDepend\Source\ASTVisitor\ASTVisitor $visitor ) : void ASTVisitor method for node tree traversal.
addChild ( PDepend\Source\AST\AbstractASTArtifact $artifact ) : void Adds a source item that was parsed from this source file.
free ( ) : void This method can be called by the PDepend runtime environment or a utilizing component to free up memory. This methods are required for PHP version < 5.3 where cyclic references can not be resolved automatically by PHP's garbage collector.
getEndLine ( ) : integer Returns the start line number for this source file. For an existing file this value must always be greater 0, while it can be 0 for a not existing dummy file.
getFileName ( ) : string Returns the physical file name for this object.
getId ( ) : string Returns a id for this code node.
getName ( ) : string Returns the physical file name for this object.
getSource ( ) : array(integer=>string) Returns normalized source code with stripped whitespaces.
getStartLine ( ) : integer Returns the start line number for this source file. For an existing file this value must always be 1, while it can be 0 for a not existing dummy file.
getTokens ( ) : array(array) Returns an array with all tokens within this file.
isCached ( ) : boolean This method will return true when this file instance was restored from the cache and not currently parsed. Otherwise this method will return false.
setCache ( PDepend\Util\Cache\CacheDriver $cache ) : ASTCompilationUnit Setter method for the used parser and token cache.
setId ( string $id ) : void Sets the unique identifier for this file instance.
setTokens ( array $tokens ) : void Sets the tokens for this file.

Protected Methods

Method Description
readSource ( ) : void Reads the source file if required.

Method Details

__construct() public method

Constructs a new source file instance.
public __construct ( string $fileName )
$fileName string The source file name/path.

__sleep() public method

The magic sleep method will be called by PHP's runtime environment right before it serializes an instance of this class. This method returns an array with those property names that should be serialized.
Since: 0.10.0
public __sleep ( ) : array(string)
return array(string)

__toString() public method

Returns the string representation of this class.
public __toString ( ) : string
return string

__wakeup() public method

The magic wakeup method will is called by PHP's runtime environment when a serialized instance of this class was unserialized. This implementation of the wakeup method restores the references between all parsed entities in this source file and this file instance.
See also: PDepend\Source\AST\ASTCompilationUnit::$childNodes
Since: 0.10.0
public __wakeup ( ) : void
return void

accept() public method

ASTVisitor method for node tree traversal.
public accept ( PDepend\Source\ASTVisitor\ASTVisitor $visitor ) : void
$visitor PDepend\Source\ASTVisitor\ASTVisitor
return void

addChild() public method

Adds a source item that was parsed from this source file.
Since: 0.10.0
public addChild ( PDepend\Source\AST\AbstractASTArtifact $artifact ) : void
$artifact PDepend\Source\AST\AbstractASTArtifact
return void

free() public method

This method can be called by the PDepend runtime environment or a utilizing component to free up memory. This methods are required for PHP version < 5.3 where cyclic references can not be resolved automatically by PHP's garbage collector.
Deprecation: Since 0.10.0
Since: 0.9.12
public free ( ) : void
return void

getEndLine() public method

Returns the start line number for this source file. For an existing file this value must always be greater 0, while it can be 0 for a not existing dummy file.
Since: 0.10.0
public getEndLine ( ) : integer
return integer

getFileName() public method

Returns the physical file name for this object.
public getFileName ( ) : string
return string

getId() public method

Returns a id for this code node.
public getId ( ) : string
return string

getName() public method

Returns the physical file name for this object.
public getName ( ) : string
return string

getSource() public method

Returns normalized source code with stripped whitespaces.
public getSource ( ) : array(integer=>string)
return array(integer=>string)

getStartLine() public method

Returns the start line number for this source file. For an existing file this value must always be 1, while it can be 0 for a not existing dummy file.
Since: 0.10.0
public getStartLine ( ) : integer
return integer

getTokens() public method

Returns an array with all tokens within this file.
public getTokens ( ) : array(array)
return array(array)

isCached() public method

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

readSource() protected method

Reads the source file if required.
protected readSource ( ) : void
return void

setCache() public method

Setter method for the used parser and token cache.
Since: 0.10.0
public setCache ( PDepend\Util\Cache\CacheDriver $cache ) : ASTCompilationUnit
$cache PDepend\Util\Cache\CacheDriver
return ASTCompilationUnit

setId() public method

Sets the unique identifier for this file instance.
Since: 0.9.12
public setId ( string $id ) : void
$id string Identifier for this file.
return void

setTokens() public method

Sets the tokens for this file.
public setTokens ( array $tokens ) : void
$tokens array
return void

Property Details

$cache protected property

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

$cached protected property

Was this file instance restored from the cache?
Since: 0.10.0
protected bool $cached
return boolean

$childNodes protected property

List of classes, interfaces and functions that parsed from this file.
Since: 0.10.0
protected AbstractASTArtifact[],PDepend\Source\AST $childNodes
return PDepend\Source\AST\AbstractASTArtifact[]

$comment protected property

The comment for this type.
protected string $comment
return string

$endLine protected property

The files end line.
Since: 0.10.0
protected int $endLine
return integer

$fileName protected property

The source file name/path.
protected string $fileName
return string

$id protected property

The unique identifier for this function.
protected string $id
return string

$startLine protected property

The files start line. This property must always have the value 1.
Since: 0.10.0
protected int $startLine
return integer