diff --git a/src/CodeCoverage.php b/src/CodeCoverage.php index fa9d4b9a1..460bc812c 100644 --- a/src/CodeCoverage.php +++ b/src/CodeCoverage.php @@ -306,7 +306,7 @@ public function stop($append = true, $linesToBeCovered = [], array $linesToBeUse $this->currentId = null; - return $data; + return $this->data; } /** diff --git a/src/Filter.php b/src/Filter.php index 771a657ae..db383d712 100644 --- a/src/Filter.php +++ b/src/Filter.php @@ -22,6 +22,14 @@ class Filter */ private $whitelistedFiles = []; + private $ignoreLists = []; + + /** + * @param array $ignoreLists + */ + public function setIgnoreLists($ignoreLists) { + $this->ignoreLists = $ignoreLists; + } /** * Adds a directory to the whitelist (recursively). * @@ -127,8 +135,17 @@ public function isFiltered($filename) } $filename = realpath($filename); - + if (empty($this->whitelistedFiles)){ + foreach($this->ignoreLists as $ignorePattern ){ + $pattern = '/'.$ignorePattern.'/'; + if (preg_match($pattern, $filename)){ + return true; + } + } + return false; + } else{ return !isset($this->whitelistedFiles[$filename]); + } } /**