PDepend\Engine::analyze PHP Method

analyze() public method

Analyzes the registered directories and returns the collection of analyzed namespace.
public analyze ( ) : PDepend\Source\AST\ASTNamespace[]
return PDepend\Source\AST\ASTNamespace[]
    public function analyze()
    {
        $this->builder = new PHPBuilder();
        $this->performParseProcess();
        // Get global filter collection
        $collection = CollectionArtifactFilter::getInstance();
        $collection->setFilter($this->codeFilter);
        $collection->setFilter();
        $this->performAnalyzeProcess();
        // Set global filter for logging
        $collection->setFilter($this->codeFilter);
        $namespaces = $this->builder->getNamespaces();
        $this->fireStartLogProcess();
        foreach ($this->generators as $generator) {
            // Check for code aware loggers
            if ($generator instanceof CodeAwareGenerator) {
                $generator->setArtifacts($namespaces);
            }
            $generator->close();
        }
        $this->fireEndLogProcess();
        return $this->namespaces = $namespaces;
    }

Usage Example

Example #1
0
 /**
  * Parses the projects source and reports all detected errors and violations.
  *
  * @param \PHPMD\Report $report
  * @return void
  */
 public function parse(Report $report)
 {
     $this->setReport($report);
     $this->pdepend->addReportGenerator($this);
     $this->pdepend->analyze();
     foreach ($this->pdepend->getExceptions() as $exception) {
         $report->addError(new ProcessingError($exception->getMessage()));
     }
 }