PHP Класс PDepend\Metrics\Analyzer\NPathComplexityAnalyzer

Наследование: extends PDepend\Metrics\AbstractCachingAnalyzer, implements PDepend\Metrics\AnalyzerFilterAware, implements PDepend\Metrics\AnalyzerNodeAware
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
calculateComplexity ( PDepend\Source\AST\AbstractASTCallable $callable ) : void This method will calculate the NPath complexity for the given callable instance.

Описание методов

analyze() публичный Метод

Processes all {@link \PDepend\Source\AST\ASTNamespace} code nodes.
public analyze ( PDepend\Source\AST\ASTNamespace[] $namespaces ) : void
$namespaces PDepend\Source\AST\ASTNamespace[]
Результат void

calculateComplexity() защищенный Метод

This method will calculate the NPath complexity for the given callable instance.
С версии: 0.9.12
protected calculateComplexity ( PDepend\Source\AST\AbstractASTCallable $callable ) : void
$callable PDepend\Source\AST\AbstractASTCallable
Результат void

getNodeMetrics() публичный Метод

array( 'npath' => '17' )
public getNodeMetrics ( PDepend\Source\AST\ASTArtifact $artifact ) : array
$artifact PDepend\Source\AST\ASTArtifact
Результат array

sumComplexity() публичный Метод

Calculates the expression sum of the given node.
С версии: 0.9.12
public sumComplexity ( PDepend\Source\AST\ASTNode $node ) : string
$node PDepend\Source\AST\ASTNode The currently visited node.
Результат string

visitConditionalExpression() публичный Метод

? : -- NP(?) = NP() + NP() + NP() + 2 --
С версии: 0.9.12
public visitConditionalExpression ( $node, string $data ) : string
$data string
Результат string

visitDoWhileStatement() публичный Метод

do while () S; -- NP(do) = NP() + NP() + 1 --
С версии: 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.
Результат string

visitElseIfStatement() публичный Метод

elseif () S; -- NP(elseif) = NP() + NP() + 1 -- elseif () else S; -- NP(if) = NP() + NP() + NP( --
С версии: 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.
Результат string

visitForStatement() публичный Метод

for (; ; ) S; -- NP(for) = NP() + NP() + NP() + NP() + 1 --
С версии: 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.
Результат string

visitForeachStatement() публичный Метод

fpreach () S; -- NP(foreach) = NP() + NP() + 1 --
С версии: 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.
Результат string

visitFunction() публичный Метод

Visits a function node.
public visitFunction ( PDepend\Source\AST\ASTFunction $function ) : void
$function PDepend\Source\AST\ASTFunction
Результат void

visitIfStatement() публичный Метод

if () S; -- NP(if) = NP() + NP() + 1 -- if () else S; -- NP(if) = NP() + NP() + NP( --
С версии: 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.
Результат string

visitInterface() публичный Метод

Visits a code interface object.
public visitInterface ( PDepend\Source\AST\ASTInterface $interface ) : void
$interface PDepend\Source\AST\ASTInterface
Результат void

visitMethod() публичный Метод

Visits a method node.
public visitMethod ( PDepend\Source\AST\ASTMethod $method ) : void
$method PDepend\Source\AST\ASTMethod
Результат void

visitReturnStatement() публичный Метод

return ; -- NP(return) = NP() --
С версии: 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.
Результат string

visitSwitchStatement() публичный Метод

switch () ... -- NP(switch) = NP() + NP() + NP() ... --
С версии: 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.
Результат string

visitTryStatement() публичный Метод

try catch -- NP(try) = NP() + NP() -- try catch catch ... -- NP(try) = NP() + NP() + NP() ... --
С версии: 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.
Результат string

visitWhileStatement() публичный Метод

while () S; -- NP(while) = NP() + NP() + 1 --
С версии: 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.
Результат string