Neos\Flow\ResourceManagement\ResourceManager::getPublicPersistentResourceUriByHash PHP Method

getPublicPersistentResourceUriByHash() public method

Returns the web accessible URI for the resource object specified by the given SHA1 hash.
public getPublicPersistentResourceUriByHash ( string $resourceHash, string $collectionName = self::DEFAULT_PERSISTENT_COLLECTION_NAME ) : string
$resourceHash string The SHA1 hash identifying the resource content
$collectionName string Name of the collection the resource is part of
return string A URI as a string
    public function getPublicPersistentResourceUriByHash($resourceHash, $collectionName = self::DEFAULT_PERSISTENT_COLLECTION_NAME)
    {
        $this->initialize();
        if (!isset($this->collections[$collectionName])) {
            throw new Exception(sprintf('Could not determine persistent resource URI for "%s" because the specified collection "%s" does not exist.', $resourceHash, $collectionName), 1375197875);
        }
        /** @var TargetInterface $target */
        $target = $this->collections[$collectionName]->getTarget();
        $resource = $this->resourceRepository->findOneBySha1($resourceHash);
        if ($resource === null) {
            throw new Exception(sprintf('Could not determine persistent resource URI for "%s" because no PersistentResource object with that SHA1 hash could be found.', $resourceHash), 1375347691);
        }
        return $target->getPublicPersistentResourceUri($resource);
    }