PHP Class PDepend\Metrics\Analyzer\NodeLocAnalyzer

It collects the total Lines Of Code(loc), the None Comment Lines Of Code(ncloc), the Comment Lines Of Code(cloc) and a approximated Executable Lines Of Code(eloc) for files, classes, interfaces, methods, properties and function. The current implementation has a limitation, that affects inline comments. The following code will suppress one line of code. function foo() { foobar(); // Bad behaviour... } The same rule applies to class methods. mapi, PLEASE, FIX THIS ISSUE.
Inheritance: extends PDepend\Metrics\AbstractCachingAnalyzer, implements PDepend\Metrics\AnalyzerNodeAware, implements PDepend\Metrics\AnalyzerFilterAware, implements PDepend\Metrics\AnalyzerProjectAware
Show file Open project: horde/horde 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 given $node instance. If there are no metrics for the requested node, this method will return an empty array.
getProjectMetrics ( ) : array Provides the project summary as an array.
visitClass ( PDepend\Source\AST\ASTClass $class ) : void Visits a class node.
visitCompilationUnit ( ASTCompilationUnit $compilationUnit ) : void Visits a file node.
visitFunction ( PDepend\Source\AST\ASTFunction $function ) : void Visits a function node.
visitInterface ( PDepend\Source\AST\ASTInterface $interface ) : void Visits a code interface object.
visitMethod ( PDepend\Source\AST\ASTMethod $method ) : void Visits a method node.

Private Methods

Method Description
linesOfCode ( array $tokens, boolean $search = false ) : array Counts the Comment Lines Of Code (CLOC) and a pseudo Executable Lines Of Code (ELOC) values.
updateProjectMetrics ( string $id ) : void Updates the project metrics based on the node metrics identifier by the given $id.

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

getNodeMetrics() public method

array( 'loc' => 23, 'cloc' => 17, 'eloc' => 17, 'ncloc' => 42 )
public getNodeMetrics ( PDepend\Source\AST\ASTArtifact $artifact ) : array
$artifact PDepend\Source\AST\ASTArtifact
return array

getProjectMetrics() public method

array( 'loc' => 23, 'cloc' => 17, 'ncloc' => 42 )
public getProjectMetrics ( ) : array
return array

visitClass() public method

Visits a class node.
public visitClass ( PDepend\Source\AST\ASTClass $class ) : void
$class PDepend\Source\AST\ASTClass
return void

visitCompilationUnit() public method

Visits a file node.
public visitCompilationUnit ( ASTCompilationUnit $compilationUnit ) : void
$compilationUnit PDepend\Source\AST\ASTCompilationUnit
return void

visitFunction() public method

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

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