PDepend\Metrics\Analyzer\DependencyAnalyzer::analyze PHP Method

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
    public function analyze($namespaces)
    {
        if ($this->nodeMetrics === null) {
            $this->fireStartAnalyzer();
            $this->nodeMetrics = array();
            foreach ($namespaces as $namespace) {
                $namespace->accept($this);
            }
            $this->postProcess();
            $this->calculateAbstractness();
            $this->calculateInstability();
            $this->calculateDistance();
            $this->fireEndAnalyzer();
        }
    }

Usage Example

 /**
  * Tests the generated package metrics.
  *
  * @return void
  */
 public function testGenerateMetrics()
 {
     $visitor = new DependencyAnalyzer();
     $namespaces = self::parseCodeResourceForTest();
     $visitor->analyze($namespaces);
     $actual = array();
     foreach ($namespaces as $namespace) {
         $actual[$namespace->getName()] = $visitor->getStats($namespace);
     }
     $this->assertEquals($this->input, $actual);
 }
All Usage Examples Of PDepend\Metrics\Analyzer\DependencyAnalyzer::analyze