/** * {@inheritdoc} */ public function getVersions($path) { // Non-editable repositories always contain only one version of a resource try { return new VersionList($path, array($this->get($path))); } catch (ResourceNotFoundException $e) { throw NoVersionFoundException::forPath($path, $e); } }
/** * {@inheritdoc} */ 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); }
/** * {@inheritdoc} */ public function getVersions($path, ResourceRepository $repository = null) { if (!isset($this->versions[$path])) { throw NoVersionFoundException::forPath($path); } $versions = array(); foreach ($this->versions[$path] as $resource) { if (null !== $repository) { $resource = clone $resource; $resource->attachTo($repository, $path); } $versions[] = $resource; } return new VersionList($path, $versions); }
/** * {@inheritdoc} */ public function getVersions($path) { throw NoVersionFoundException::forPath($path); }
/** * {@inheritdoc} */ 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); }
/** * {@inheritdoc} */ 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); }