Fixed TapParser::parseLine Cyclomatic Complexity

This commit is contained in:
corpsee 2015-05-24 12:43:43 +06:00
parent c20ee0533b
commit 3f02e63c92

View file

@ -124,22 +124,6 @@ class TapParser
return false; return false;
} }
/**
* @param string $line
*
* @return boolean
*/
protected function testCountLine($line)
{
if (preg_match(self::TEST_COUNTS_PATTERN, $line, $matches)) {
$this->testCount = intval($matches[1]);
return true;
}
return false;
}
/** /**
* @param string $line * @param string $line
* *
@ -183,20 +167,6 @@ class TapParser
return false; return false;
} }
/**
* @param string $line
*
* @return boolean
*/
protected function garbageLine($line)
{
if (preg_match(self::TEST_DIAGNOSTIC, $line) || preg_match(self::TEST_COVERAGE, $line) || !$line) {
return true;
}
return false;
}
/** Parse a single line. /** Parse a single line.
* *
* @param string $line * @param string $line
@ -205,11 +175,13 @@ class TapParser
*/ */
protected function parseLine($line) protected function parseLine($line)
{ {
if ($this->garbageLine($line)) { if (preg_match(self::TEST_DIAGNOSTIC, $line) || preg_match(self::TEST_COVERAGE, $line) || !$line) {
return; return;
} }
if ($this->testCountLine($line)) { if (preg_match(self::TEST_COUNTS_PATTERN, $line, $matches)) {
$this->testCount = intval($matches[1]);
return; return;
} }