Skip to content

Commit

Permalink
API Remove deprecated API
Browse files Browse the repository at this point in the history
Note that we will also need to update any composer references to
vendor-plugin to use the new version, since until this we were just
going to keep using 2.x
  • Loading branch information
GuySartorelli committed Jan 6, 2025
1 parent 4149c1f commit 98ae166
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions src/Methods/CopyMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,4 @@ public function exposeDirectory($source, $target)
throw new RuntimeException("Could not write to directory $target");
}
}

/**
* Copies a file or directory from $source to $target.
*
*
* @param string $source
* @param string $target
* @deprecated 5.2 Use Filesystem::copy instead
* @return bool
*/
public function copy($source, $target)
{
if (!is_dir($source ?? '')) {
return copy($source ?? '', $target ?? '');
}
$it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
/** @var RecursiveDirectoryIterator $ri */
$ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
$this->filesystem->ensureDirectoryExists($target);
$result = true;
foreach ($ri as $file) {
$targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
if ($file->isDir()) {
$this->filesystem->ensureDirectoryExists($targetPath);
} else {
$result = $result && copy($file->getPathname() ?? '', $targetPath ?? '');
}
}
return $result;
}
}

0 comments on commit 98ae166

Please sign in to comment.