Skip to content
Snippets Groups Projects
Commit 2768e5ee authored by Daniel Hürtgen's avatar Daniel Hürtgen
Browse files

TASK: Optimize finder code

parent 7140293e
No related merge requests found
...@@ -51,7 +51,10 @@ class Finder ...@@ -51,7 +51,10 @@ class Finder
*/ */
public function in($path) public function in($path)
{ {
$finder = SymfonyFinder::create()->files()->in($path)->name('ruleset.xml'); $finder = $this->getSymfonyFinder()
->in($path)
->files()
->name('ruleset.xml');
$paths = iterator_to_array($finder, false); $paths = iterator_to_array($finder, false);
$paths = array_map( $paths = array_map(
function (SplFileInfo $file) { function (SplFileInfo $file) {
...@@ -63,6 +66,16 @@ class Finder ...@@ -63,6 +66,16 @@ class Finder
return $this->createStandardsFromPaths($paths); return $this->createStandardsFromPaths($paths);
} }
/**
* Creates new symfony finder instance.
*
* @return SymfonyFinder
*/
protected function getSymfonyFinder()
{
return SymfonyFinder::create();
}
/** /**
* Creates PHPCodeSniffer standards from paths. * Creates PHPCodeSniffer standards from paths.
* *
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment