Skip to content

Commit

Permalink
[FoundationBundle] removed Finder dependency in Filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jun 30, 2010
1 parent 6ba48ff commit 99c33ca
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/Symfony/Framework/FoundationBundle/Util/Filesystem.php
Expand Up @@ -2,8 +2,6 @@

namespace Symfony\Framework\FoundationBundle\Util;

use Symfony\Components\Finder\Finder;

/*
* This file is part of the Symfony framework.
*
Expand Down Expand Up @@ -197,20 +195,20 @@ public function symlink($originDir, $targetDir, $copyOnWindows = false)
/**
* Mirrors a directory to another.
*
* @param string $originDir The origin directory
* @param string $targetDir The target directory
* @param Finder $finder An Finder instance
* @param array $options An array of options (see copy())
* @param string $originDir The origin directory
* @param string $targetDir The target directory
* @param \Traversable $iterator A Traversable instance
* @param array $options An array of options (see copy())
*
* @throws \RuntimeException When file type is unknown
*/
public function mirror($originDir, $targetDir, Finder $finder = null, $options = array())
public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
{
if (null === $finder) {
$finder = new Finder();
if (null === $iterator) {
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
}

foreach ($finder->in($originDir) as $file) {
foreach ($iterator as $file) {
$target = $targetDir.DIRECTORY_SEPARATOR.str_replace(realpath($originDir), '', $file->getRealPath());

if (is_dir($file)) {
Expand Down

0 comments on commit 99c33ca

Please sign in to comment.