PHP Class PDepend\Metrics\Analyzer\NPathComplexityAnalyzer

Inheritance: extends PDepend\Metrics\AbstractCachingAnalyzer, implements PDepend\Metrics\AnalyzerFilterAware, implements PDepend\Metrics\AnalyzerNodeAware
ファイルを表示 Open project: pdepend/pdepend Class Usage Examples

Public Methods

Method 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.

Protected Methods

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

Method Details

analyze() public method

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

calculateComplexity() protected method

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
return void

getNodeMetrics() public method

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

sumComplexity() public method

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.
return string

visitConditionalExpression() public method

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

visitDoWhileStatement() public method

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.
return string

visitElseIfStatement() public method

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.
return string

visitForStatement() public method

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.
return string

visitForeachStatement() public method

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.
return string

visitFunction() public method

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

visitIfStatement() public method

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.
return string

visitInterface() public method

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

visitMethod() public method

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

visitReturnStatement() public method

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.
return string

visitSwitchStatement() public method

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.
return string

visitTryStatement() public method

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.
return string

visitWhileStatement() public method

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.
return string