private function removeResource($filesystemPath, &$removed)
{
// Skip paths that have already been removed
if (!file_exists($filesystemPath)) {
return;
}
$this->removeVersions($this->getPath($filesystemPath));
++$removed;
if (is_dir($filesystemPath) && !is_link($filesystemPath)) {
$iterator = $this->getDirectoryIterator($filesystemPath);
foreach ($iterator as $childFilesystemPath) {
// Remove children and child versions
$this->removeResource($childFilesystemPath, $removed);
}
}
$this->filesystem->remove($filesystemPath);
}