The PDepend is a php port/adaption of the Java class file analyzer JDepend.
Ejemplo n.º 1
0
 /**
  * Initializes the accepted php source file extensions.
  *
  * @param \PDepend\Engine $pdepend The context php depend instance.
  * @param PHP_PMD    $phpmd   The calling/parent php mess detector.
  *
  * @return void
  */
 private function initExtensions(Engine $pdepend, PHP_PMD $phpmd)
 {
     if (count($phpmd->getFileExtensions()) > 0) {
         $pdepend->addFileFilter(new ExtensionFilter($phpmd->getFileExtensions()));
     }
 }
Ejemplo n.º 2
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()));
     }
 }
Ejemplo n.º 3
0
 /**
  * Configures the input source.
  *
  * @param PDepend\Engine $pdepend The context php depend instance.
  * @param PHP_PMD    $phpmd   The calling/parent php mess detector.
  *
  * @return void
  */
 private function initInput(PDepend\Engine $pdepend, PHP_PMD $phpmd)
 {
     foreach (explode(',', $phpmd->getInput()) as $path) {
         if (is_dir(trim($path))) {
             $pdepend->addDirectory(trim($path));
         } else {
             $pdepend->addFile(trim($path));
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * Initializes additional options for pdepend.
  *
  * @param \PDepend\Engine $pdepend
  * @param \PHPMD\PHPMD $phpmd
  * @return void
  */
 private function initOptions(Engine $pdepend, PHPMD $phpmd)
 {
     $options = array();
     foreach (array_filter($phpmd->getOptions()) as $name => $value) {
         if (isset($this->phpmd2pdepend[$name])) {
             $options[$this->phpmd2pdepend[$name]] = $value;
         }
     }
     $pdepend->setOptions($options);
 }