/** * {@inheritdoc} */ public function getChild($relPath) { if (!$this->getRepository()) { throw ResourceNotFoundException::forPath($this->getRepositoryPath() . '/' . $relPath); } return $this->getRepository()->get($this->getRepositoryPath() . '/' . $relPath); }
/** * {@inheritdoc} */ public function get($path) { $path = $this->sanitizePath($path); if (!isset($this->resources[$path])) { throw ResourceNotFoundException::forPath($path); } return $this->resources[$path]; }
/** * {@inheritdoc} */ public function get($path) { Assert::stringNotEmpty($path, 'The path must be a non-empty string. Got: %s'); Assert::startsWith($path, '/', 'The path %s is not absolute.'); $path = Path::canonicalize($path); if (!isset($this->resources[$path])) { throw ResourceNotFoundException::forPath($path); } return $this->resources[$path]; }
/** * {@inheritdoc} */ public function getChild($relPath) { // Use attached repository if possible if ($this->getRepository()) { return $this->getRepository()->get($this->getRepositoryPath() . '/' . $relPath); } $filesystemPath = $this->getFilesystemPath() . '/' . $relPath; if (!file_exists($filesystemPath)) { throw ResourceNotFoundException::forPath($this->getPath() . '/' . $relPath); } return is_dir($filesystemPath) ? new DirectoryResource($filesystemPath) : new FileResource($filesystemPath); }
public function getChild($relPath) { throw ResourceNotFoundException::forPath($this->getPath() . '/' . $relPath); }
/** * {@inheritdoc} */ public function get($path) { throw ResourceNotFoundException::forPath($path); }
/** * {@inheritdoc} */ public function hasChildren($path) { if (null === $this->json) { $this->load(); } $path = $this->sanitizePath($path); $results = $this->getReferencesInDirectory($path, self::STOP_ON_FIRST); if (empty($results)) { $pathResults = $this->getReferencesForPath($path); if (empty($pathResults)) { throw ResourceNotFoundException::forPath($path); } return false; } return true; }
private function getFilesystemPath($path) { $path = $this->sanitizePath($path); $filesystemPath = $this->baseDir . $path; if (!file_exists($filesystemPath)) { throw ResourceNotFoundException::forPath($path); } return $filesystemPath; }
/** * {@inheritdoc} */ public function findByPath($resourcePath, $typeName = null) { if (!$this->repo->contains($resourcePath)) { throw ResourceNotFoundException::forPath($resourcePath); } if (null === $typeName) { return $this->findAllForPath($resourcePath); } return $this->findByPathAndType($resourcePath, $typeName); }
private function getFilesystemPath($path) { Assert::stringNotEmpty($path, 'The path must be a non-empty string. Got: %s'); Assert::startsWith($path, '/', 'The path %s is not absolute.'); $path = Path::canonicalize($path); $filesystemPath = $this->baseDir . $path; if (!file_exists($filesystemPath)) { throw ResourceNotFoundException::forPath($path); } return $filesystemPath; }