/** * Returns the node matching the given ID * * @param int $nodeId ID of the resource to locate * * @return Node * @throws NotFoundServiceException */ private function getNode($nodeId) { try { $node = $this->environment->getResourceFromId($nodeId); return $node; } catch (\Exception $exception) { throw new NotFoundServiceException($exception->getMessage()); } }
/** * Returns the node matching the given ID * * @param int $nodeId ID of the resource to locate * * @return Node * @throws NotFoundServiceException */ public function getResourceFromId($nodeId) { try { $node = $this->environment->getResourceFromId($nodeId); // Making extra sure that we can actually do something with the file if (!$node->getMimetype() || !$node->isReadable()) { throw new NotFoundServiceException("Can't access the file"); } return $node; } catch (\Exception $exception) { throw new NotFoundServiceException($exception->getMessage()); } }