/** * Handle provided directory * * Optionally an existing result file can be provided * * If a valid file could be generated the file name is supposed to be * returned, otherwise return null. * * @param Project $project * @param string $existingResult * @return string */ public function handle(Project $project, $existingResult = null) { $resultFile = $this->shell->getTempFile() . '.json'; $result = array('3' => $this->countGitChangesPerFile($project, new \DateTime('-3 months')), '12' => $this->countGitChangesPerFile($project, new \DateTime('-1 year')), 'all' => $this->countGitChangesPerFile($project)); file_put_contents($resultFile, json_encode($result)); return $resultFile; }
/** * Handle provided directory * * Optionally an existing result file can be provided * * If a valid file could be generated the file name is supposed to be * returned, otherwise return null. * * @param Project $project * @param string $existingResult * @return string */ public function handle(Project $project, $existingResult = null) { if ($existingResult) { // @TODO: Verify file is actually sensible? return $existingResult; } $options = array('--log-pmd=' . ($tmpFile = $this->shell->getTempFile())); foreach ($project->excludes as $exclude) { $options[] = '--exclude=' . $exclude; } $this->shell->exec('vendor/bin/phpcpd', array_merge($options, array($project->baseDir)), array(0, 1)); return $tmpFile; }
/** * Handle provided directory * * Optionally an existing result file can be provided * * @param string $dir * @param array $excludes * @param string $file * @return void */ public function handle($dir, array $excludes, $file = null) { if ($file) { // @TODO: Verify file is actually sensible? return $file; } $options = array('--log-pmd=' . ($tmpFile = $this->shell->getTempFile())); foreach ($excludes as $exclude) { $options[] = '--exclude=' . $exclude; } $this->shell->exec('vendor/bin/phpcpd', array_merge($options, array($dir)), array(0, 1)); return $tmpFile; }
/** * Handle provided directory * * Optionally an existing result file can be provided * * If a valid file could be generated the file name is supposed to be * returned, otherwise return null. * * @param Project $project * @param string $existingResult * @return string */ public function handle(Project $project, $existingResult = null) { if ($existingResult) { // @TODO: Verify file is actually sensible? return $existingResult; } $options = array('--dependency-xml=' . ($tmpFile = $this->shell->getTempFile())); if ($project->excludes) { $options[] = '--ignore=' . implode(',', $project->excludes); } $this->shell->exec('vendor/bin/pdepend', array_merge($options, array($project->baseDir))); return $tmpFile; }
/** * Handle provided directory * * Optionally an existing result file can be provided * * @param string $dir * @param array $excludes * @param string $file * @return void */ public function handle($dir, array $excludes, $file = null) { if ($file) { // @TODO: Verify file is actually sensible? return $file; } $options = array('--standard=PSR2', '--extensions=php', '--report-checkstyle=' . ($tmpFile = $this->shell->getTempFile())); if ($excludes) { $options[] = '--ignore=' . implode(',', $excludes); } $this->shell->exec('vendor/bin/phpcs', array_merge($options, array($dir)), array(0, 1)); return $tmpFile; }
/** * Handle provided directory * * Optionally an existing result file can be provided * * @param string $dir * @param array $excludes * @param string $file * @return void */ public function handle($dir, array $excludes, $file = null) { if ($file) { // @TODO: Verify file is actually sensible? return $file; } $options = array('--dependency-xml=' . ($tmpFile = $this->shell->getTempFile())); if ($excludes) { $options[] = '--ignore=' . implode(',', $excludes); } $this->shell->exec('vendor/bin/pdepend', array_merge($options, array($dir))); return $tmpFile; }
/** * Handle provided directory * * Optionally an existing result file can be provided * * @param string $dir * @param array $excludes * @param string $file * @return void */ public function handle($dir, array $excludes, $file = null) { if ($file) { // @TODO: Verify file is actually sensible? return $file; } $options = array('--reportfile', $tmpFile = $this->shell->getTempFile()); if ($excludes) { $options[] = '--exclude'; $options[] = implode(',', $excludes); } $this->shell->exec('vendor/bin/phpmd', array_merge($options, array($dir, 'xml', 'cleancode,codesize,design')), array(0, 2)); return $tmpFile; }
/** * Handle provided directory * * Optionally an existing result file can be provided * * @param string $dir * @param string[] $excludes * @param string|null $file * @param string|null $coverage * @return void */ public function handle($dir, array $excludes, $file = null, $coverage = null) { if ($file) { // @TODO: Verify file is actually sensible? return $file; } $options = array('--summary-xml=' . ($tmpFile = $this->shell->getTempFile()), '--coderank-mode=inheritance,property,method'); if ($coverage) { $options[] = '--coverage-report=' . $coverage; } if ($excludes) { $options[] = '--ignore=' . implode(',', $excludes); } $this->shell->exec('vendor/bin/pdepend', array_merge($options, array($dir))); return $tmpFile; }