forPath() public static method

Creates a new exception for a resource path.
public static forPath ( string $path, Exception $cause = null ) : static
$path string The path which was not found.
$cause Exception The exception that caused this exception.
return static The created exception.
示例#1
0
 /**
  * {@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);
 }
示例#3
0
 /**
  * {@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);
 }
示例#4
0
 /**
  * {@inheritdoc}
  */
 public function getVersions($path)
 {
     throw NoVersionFoundException::forPath($path);
 }
示例#5
0
 /**
  * {@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);
 }
示例#6
0
 /**
  * {@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);
 }