public function getVersions($path)
{
if (!$this->json) {
$this->load();
}
$references = $this->searchReferences($path);
if (!isset($references[$path])) {
throw NoVersionFoundException::forPath($path);
}
$resources = array();
$pathReferences = $references[$path];
// The first reference is the last (current) version
// Hence traverse in reverse order
for ($ref = end($pathReferences); null !== key($pathReferences); $ref = prev($pathReferences)) {
$resources[] = $this->createResource($path, $ref);
}
return new VersionList($path, $resources);
}