public function getBinary(File $file) { $id = trim($file->getId(), '/'); $fileName = pathinfo($id, PATHINFO_FILENAME); if ($fileName != '') { return @file_get_contents($this->baseFolder . '/' . $id); } return false; }
public function getBinary(File $file) { $url = 'file/' . trim($file->getId(), '/'); try { $response = $this->getClient()->get($url); return $response->getBody()->getContents(); } catch (ClientException $e) { if ($e->getResponse()->getStatusCode() == 404) { return false; } throw new ClientException($e->getMessage(), $e->getRequest(), $e->getResponse(), $e); } }
public function getBinary(File $file) { $this->connect(); if (file_exists($this->scheme . '/' . $file->getId())) { return @file_get_contents($this->scheme . '/' . $file->getId()); } return false; }
protected function getBinary(File $file) { if ($this->cacheBinaries == true) { if (array_key_exists($file->getId(), $this->cachedBinaries)) { return $this->cachedBinaries[$file->getId()]; } $binary = $this->repository->getBinary($file); $this->cachedBinaries[$file->getId()] = $binary; } else { $binary = $this->repository->getBinary($file); } return $binary; }