public function getVersions($path, ResourceRepository $repository = null)
{
$versions = $this->store->get($path, array());
if (empty($versions)) {
throw NoVersionFoundException::forPath($path);
}
if (null !== $repository) {
foreach ($versions as $key => $resource) {
$resource = clone $resource;
$resource->attachTo($repository);
$versions[$key] = $resource;
}
}
return new VersionList($path, $versions);
}