Esempio n. 1
0
 /**
  * Analyze source
  *
  * @param string $path
  * @return void
  */
 public function analyze($path)
 {
     $process = new \SystemProcess\SystemProcess('oxphpmd');
     $process->argument($path)->argument('xml')->argument('oxid')->argument('--reportfile')->argument($this->resultDir . '/oxphpmd.xml');
     $process->execute();
     $this->processAnnotations($path, $this->resultDir . '/oxphpmd.xml');
 }
Esempio n. 2
0
 /**
  * Analyze source
  *
  * @param string $path
  * @return void
  */
 public function analyze($path)
 {
     $process = new \SystemProcess\SystemProcess(__DIR__ . '/../../../../library/bin/' . 'phplint');
     $process->argument('--format=checkstyle')->argument('--output=' . $this->resultDir . '/phplint.xml')->argument($path);
     $process->execute();
     $this->processAnnotations($path, $this->resultDir . '/phplint.xml');
 }
Esempio n. 3
0
 /**
  * Analyze source
  *
  * @param string $path
  * @return void
  */
 public function analyze($path)
 {
     $process = new \SystemProcess\SystemProcess(__DIR__ . '/../../../../library/bin/' . 'phpmd');
     $process->argument($path)->argument('xml')->argument('codesize,design')->argument('--reportfile')->argument($this->resultDir . '/phpmd.xml');
     $process->execute();
     $this->processAnnotations($path, $this->resultDir . '/phpmd.xml');
 }
Esempio n. 4
0
 public function analyze($path)
 {
     $process = new \SystemProcess\SystemProcess('phpalizer');
     $process->argument('run')->argument('--format')->argument('xml')->argument('--output-file')->argument($this->resultDir . '/analyzer.xml')->argument($path);
     $process->execute();
     $this->processAnnotations();
 }
Esempio n. 5
0
 /**
  * Analyze source
  *
  * @param string $path
  * @return void
  */
 public function analyze($path)
 {
     $process = new \SystemProcess\SystemProcess(__DIR__ . '/../../../../library/bin/' . 'phpcs');
     $process->argument('--standard=' . __DIR__ . '/../../../../config/code_sniffer_rules.xml')->argument('--extensions=php')->argument('--report=xml')->argument('--report-file=' . $this->resultFile)->argument($path);
     $process->execute();
     $this->processAnnotations($path, $this->resultFile);
 }
Esempio n. 6
0
 /**
  * Analyze source
  *
  * @param string $path
  * @return void
  */
 public function analyze($path)
 {
     $process = new \SystemProcess\SystemProcess(__DIR__ . '/../../../../library/bin/' . 'pdepend');
     $process->nonZeroExitCodeException = true;
     $process->argument('--jdepend-chart=' . $this->resultDir . '/pdepend_jdepend.svg')->argument('--coderank-mode=inheritance,property,method')->argument('--overview-pyramid=' . $this->resultDir . '/pdepend_pyramid.svg')->argument('--summary-xml=' . $this->resultDir . '/pdepend_summary.xml')->argument($path);
     $process->execute();
     $this->processAnnotations($path, $this->resultDir . '/pdepend_summary.xml');
 }
Esempio n. 7
0
 /**
  * Analyze source
  *
  * @param string $path
  * @return void
  */
 public function analyze($path)
 {
     $process = new \SystemProcess\SystemProcess(__DIR__ . '/../../../../library/bin/' . 'phpcpd');
     $process->argument('--min-lines')->argument(4)->argument('--min-tokens')->argument(30)->argument('--log-pmd')->argument($this->resultDir . '/phpcpd.xml')->argument($path);
     $process->execute();
     // Fix file names
     $doc = new \DOMDocument();
     $doc->load($this->resultDir . '/phpcpd.xml');
     $xpath = new \DOMXPath($doc);
     foreach ($xpath->query('//file') as $fileNode) {
         $fileNode->setAttribute('path', str_replace($path, '', $fileNode->getAttribute('path')));
     }
     $doc->save($this->resultDir . '/phpcpd.xml');
 }
Esempio n. 8
0
    /**
     * Render a class diagram using dot
     *
     * @param array $classes
     * @return void
     */
    protected function renderDiagram(array $classes)
    {
        $dotInput = 'digraph ClassDiagram {
            node [
                fontname  = Arial,
                fontcolor = "#2e3436",
                fontsize  = 10,
            ];

            mindist  = 0.1;
            rankdir  = LR;
            splines  = true;
            overlap  = false;
            penwidth = .5;
        ';
        foreach ($classes as $className => $data) {
            $dotInput .= sprintf('    "%s" [%s]' . PHP_EOL, addslashes($className), $this->getClassLabel($className, $data));
            foreach ($data['extends'] as $parent) {
                $dotInput .= sprintf('    "%s" -> "%s" [arrowhead="onorman"]' . PHP_EOL, addslashes($className), addslashes($parent));
            }
            foreach ($data['uses'] as $parent) {
                $dotInput .= sprintf('    "%s" -> "%s" [constraint=false, arrowhead="none", color="#dddddd"]' . PHP_EOL, addslashes($className), addslashes($parent));
            }
        }
        $dotInput .= '}';
        file_put_contents($dotFile = $this->resultDir . '/uml.dot', $dotInput);
        $process = new \SystemProcess\SystemProcess('dot');
        $process->argument('-Tsvg')->argument('-o' . $this->resultDir . '/uml.svg')->argument($dotFile);
        $process->execute();
    }