public function getVersions($path, ResourceRepository $repository = null)
{
if (null === $this->json) {
$this->load();
}
if (!isset($this->json[$path])) {
throw NoVersionFoundException::forPath($path);
}
$versions = array();
foreach ($this->json[$path] as $resource) {
$resource = unserialize($resource);
if (null !== $repository) {
$resource->attachTo($repository, $path);
}
$versions[] = $resource;
}
return new VersionList($path, $versions);
}