Skip to content
Permalink
Browse files

AbstractGenerator::getCommonFilesPath() replaced by Helpers::findComm…

…onDirectory()
  • Loading branch information...
milo authored and dg committed Feb 20, 2019
1 parent 7921975 commit b7da70e865c0e5ce418983899901c530d5acbb10
Showing with 8 additions and 13 deletions.
  1. +5 −12 src/CodeCoverage/Generators/AbstractGenerator.php
  2. +3 −1 src/CodeCoverage/Generators/HtmlGenerator.php
@@ -9,6 +9,8 @@
namespace Tester\CodeCoverage\Generators;
use Tester\Helpers;
/**
* Code coverage report generator.
@@ -56,7 +58,7 @@ public function __construct(string $file, array $sources = [])
}, ARRAY_FILTER_USE_KEY);
if (!$sources) {
$sources = [self::getCommonFilesPath(array_keys($this->data))];
$sources = [Helpers::findCommonDirectory(array_keys($this->data))];
} else {
foreach ($sources as $source) {
@@ -118,19 +120,10 @@ protected function getSourceIterator(): \Iterator
}
/** @deprecated */
protected static function getCommonFilesPath(array $files): string
{
$path = reset($files);
for ($i = 0; $i < strlen($path); $i++) {
foreach ($files as $file) {
if (!isset($file[$i]) || $path[$i] !== $file[$i]) {
$path = substr($path, 0, $i);
break 2;
}
}
}
return rtrim(is_dir($path) ? $path : dirname($path), DIRECTORY_SEPARATOR);
return Helpers::findCommonDirectory($files);
}
@@ -9,6 +9,8 @@
namespace Tester\CodeCoverage\Generators;
use Tester\Helpers;
/**
* Code coverage report generator.
@@ -70,7 +72,7 @@ private function parse(): void
}
$this->files = [];
$commonSourcesPath = self::getCommonFilesPath($this->sources) . DIRECTORY_SEPARATOR;
$commonSourcesPath = Helpers::findCommonDirectory($this->sources) . DIRECTORY_SEPARATOR;
foreach ($this->getSourceIterator() as $entry) {
$entry = (string) $entry;

0 comments on commit b7da70e

Please sign in to comment.
You can’t perform that action at this time.