PHP Class PDepend\Metrics\Analyzer\NPathComplexityAnalyzer

Inheritance: extends PDepend\Metrics\AbstractCachingAnalyzer, implements PDepend\Metrics\AnalyzerFilterAware, implements PDepend\Metrics\AnalyzerNodeAware
Afficher le fichier Open project: pdepend/pdepend Class Usage Examples

Méthodes publiques

Méthode Description
analyze ( PDepend\Source\AST\ASTNamespace[] $namespaces ) : void Processes all {@link \PDepend\Source\AST\ASTNamespace} code nodes.
getNodeMetrics ( PDepend\Source\AST\ASTArtifact $artifact ) : array This method will return an array with all generated metric values for the node with the given $id identifier. If there are no metrics for the requested node, this method will return an empty array.
sumComplexity ( PDepend\Source\AST\ASTNode $node ) : string Calculates the expression sum of the given node.
visitConditionalExpression ( $node, string $data ) : string This method calculates the NPath Complexity of a conditional-statement, the meassured value is then returned as a string.
visitDoWhileStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string This method calculates the NPath Complexity of a do-while-statement, the meassured value is then returned as a string.
visitElseIfStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string This method calculates the NPath Complexity of an elseif-statement, the meassured value is then returned as a string.
visitForStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string This method calculates the NPath Complexity of a for-statement, the meassured value is then returned as a string.
visitForeachStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string This method calculates the NPath Complexity of a for-statement, the meassured value is then returned as a string.
visitFunction ( PDepend\Source\AST\ASTFunction $function ) : void Visits a function node.
visitIfStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string This method calculates the NPath Complexity of an if-statement, the meassured value is then returned as a string.
visitInterface ( PDepend\Source\AST\ASTInterface $interface ) : void Visits a code interface object.
visitMethod ( PDepend\Source\AST\ASTMethod $method ) : void Visits a method node.
visitReturnStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string This method calculates the NPath Complexity of a return-statement, the meassured value is then returned as a string.
visitSwitchStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string This method calculates the NPath Complexity of a switch-statement, the meassured value is then returned as a string.
visitTryStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string This method calculates the NPath Complexity of a try-catch-statement, the meassured value is then returned as a string.
visitWhileStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string This method calculates the NPath Complexity of a while-statement, the meassured value is then returned as a string.

Méthodes protégées

Méthode Description
calculateComplexity ( PDepend\Source\AST\AbstractASTCallable $callable ) : void This method will calculate the NPath complexity for the given callable instance.

Method Details

analyze() public méthode

Processes all {@link \PDepend\Source\AST\ASTNamespace} code nodes.
public analyze ( PDepend\Source\AST\ASTNamespace[] $namespaces ) : void
$namespaces PDepend\Source\AST\ASTNamespace[]
Résultat void

calculateComplexity() protected méthode

This method will calculate the NPath complexity for the given callable instance.
Since: 0.9.12
protected calculateComplexity ( PDepend\Source\AST\AbstractASTCallable $callable ) : void
$callable PDepend\Source\AST\AbstractASTCallable
Résultat void

getNodeMetrics() public méthode

array( 'npath' => '17' )
public getNodeMetrics ( PDepend\Source\AST\ASTArtifact $artifact ) : array
$artifact PDepend\Source\AST\ASTArtifact
Résultat array

sumComplexity() public méthode

Calculates the expression sum of the given node.
Since: 0.9.12
public sumComplexity ( PDepend\Source\AST\ASTNode $node ) : string
$node PDepend\Source\AST\ASTNode The currently visited node.
Résultat string

visitConditionalExpression() public méthode

? : -- NP(?) = NP() + NP() + NP() + 2 --
Since: 0.9.12
public visitConditionalExpression ( $node, string $data ) : string
$data string
Résultat string

visitDoWhileStatement() public méthode

do while () S; -- NP(do) = NP() + NP() + 1 --
Since: 0.9.12
public visitDoWhileStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string
$node PDepend\Source\AST\ASTNode The currently visited node.
$data string The previously calculated npath value.
Résultat string

visitElseIfStatement() public méthode

elseif () S; -- NP(elseif) = NP() + NP() + 1 -- elseif () else S; -- NP(if) = NP() + NP() + NP( --
Since: 0.9.12
public visitElseIfStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string
$node PDepend\Source\AST\ASTNode The currently visited node.
$data string The previously calculated npath value.
Résultat string

visitForStatement() public méthode

for (; ; ) S; -- NP(for) = NP() + NP() + NP() + NP() + 1 --
Since: 0.9.12
public visitForStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string
$node PDepend\Source\AST\ASTNode The currently visited node.
$data string The previously calculated npath value.
Résultat string

visitForeachStatement() public méthode

fpreach () S; -- NP(foreach) = NP() + NP() + 1 --
Since: 0.9.12
public visitForeachStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string
$node PDepend\Source\AST\ASTNode The currently visited node.
$data string The previously calculated npath value.
Résultat string

visitFunction() public méthode

Visits a function node.
public visitFunction ( PDepend\Source\AST\ASTFunction $function ) : void
$function PDepend\Source\AST\ASTFunction
Résultat void

visitIfStatement() public méthode

if () S; -- NP(if) = NP() + NP() + 1 -- if () else S; -- NP(if) = NP() + NP() + NP( --
Since: 0.9.12
public visitIfStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string
$node PDepend\Source\AST\ASTNode The currently visited node.
$data string The previously calculated npath value.
Résultat string

visitInterface() public méthode

Visits a code interface object.
public visitInterface ( PDepend\Source\AST\ASTInterface $interface ) : void
$interface PDepend\Source\AST\ASTInterface
Résultat void

visitMethod() public méthode

Visits a method node.
public visitMethod ( PDepend\Source\AST\ASTMethod $method ) : void
$method PDepend\Source\AST\ASTMethod
Résultat void

visitReturnStatement() public méthode

return ; -- NP(return) = NP() --
Since: 0.9.12
public visitReturnStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string
$node PDepend\Source\AST\ASTNode The currently visited node.
$data string The previously calculated npath value.
Résultat string

visitSwitchStatement() public méthode

switch () ... -- NP(switch) = NP() + NP() + NP() ... --
Since: 0.9.12
public visitSwitchStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string
$node PDepend\Source\AST\ASTNode The currently visited node.
$data string The previously calculated npath value.
Résultat string

visitTryStatement() public méthode

try catch -- NP(try) = NP() + NP() -- try catch catch ... -- NP(try) = NP() + NP() + NP() ... --
Since: 0.9.12
public visitTryStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string
$node PDepend\Source\AST\ASTNode The currently visited node.
$data string The previously calculated npath value.
Résultat string

visitWhileStatement() public méthode

while () S; -- NP(while) = NP() + NP() + 1 --
Since: 0.9.12
public visitWhileStatement ( PDepend\Source\AST\ASTNode $node, string $data ) : string
$node PDepend\Source\AST\ASTNode The currently visited node.
$data string The previously calculated npath value.
Résultat string