public function getStreamByResource(PersistentResource $resource) { $pathAndFilename = $this->getStoragePathAndFilenameByHash($resource->getSha1()); return file_exists($pathAndFilename) ? fopen($pathAndFilename, 'rb') : false; }