Reducing complexity of phpdocblockchecker::execute(), see #402

This commit is contained in:
Dan Cryer 2014-05-09 16:05:21 +01:00
parent af0d5147ea
commit f561cd636a

View file

@ -89,13 +89,7 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
*/ */
public function execute() public function execute()
{ {
$ignore = ''; // Check that the binary exists:
if (count($this->ignore)) {
$ignore = ' --exclude="' . implode(',', $this->ignore) . '"';
}
var_dump($ignore);
$checker = $this->phpci->findBinary('phpdoccheck'); $checker = $this->phpci->findBinary('phpdoccheck');
if (!$checker) { if (!$checker) {
@ -103,9 +97,25 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
return false; return false;
} }
$path = $this->phpci->buildPath . $this->path; // Build ignore string:
$ignore = '';
if (count($this->ignore)) {
$ignore = ' --exclude="' . implode(',', $this->ignore) . '"';
}
$cmd = $checker . ' --json --directory="%s"%s%s%s'; // Are we skipping any checks?
$add = '';
if ($this->skipClasses) {
$add .= ' --skip-classes';
}
if ($this->skipMethods) {
$add .= ' --skip-methods';
}
// Build command string:
$path = $this->phpci->buildPath . $this->path;
$cmd = $checker . ' --json --directory="%s"%s%s';
// Disable exec output logging, as we don't want the XML report in the log: // Disable exec output logging, as we don't want the XML report in the log:
$this->phpci->logExecOutput(false); $this->phpci->logExecOutput(false);
@ -115,8 +125,7 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$cmd, $cmd,
$path, $path,
$ignore, $ignore,
($this->skipClasses ? ' --skip-classes' : ''), $add
($this->skipMethods ? ' --skip-methods' : '')
); );
// Re-enable exec output logging: // Re-enable exec output logging: