/**
  * @param string $path
  *
  * @return ProxyMediaInterface
  *
  * @throws MediaStorageClientProxyMediaManagerException
  * @throws \Avtonom\MediaStorageClientBundle\Exception\MediaStorageClientApiException
  */
 public function find($path)
 {
     if (empty($path)) {
         throw new MediaStorageClientProxyMediaManagerException('Path is empty');
     }
     $referenceFull = parse_url($path, PHP_URL_PATH);
     $response = $this->apiService->getMedia($referenceFull);
     $proxyMedia = $this->createFromResponse($response);
     return $proxyMedia;
 }
 /**
  * @param UploadedFile $file
  * @param string $clientName
  * @param string $context
  *
  * @return \Avtonom\MediaStorageClientBundle\Entity\ProxyMediaInterface
  *
  * @throws MediaStorageClientManagerException
  * @throws \Avtonom\MediaStorageClientBundle\Exception\MediaStorageClientProxyMediaManagerException
  */
 public function sendFile(UploadedFile $file, $clientName, $context)
 {
     try {
         $response = $this->apiService->sendFile($file, $clientName, $context);
     } catch (MediaStorageClientApiException $e) {
         $this->logger->error($e->getMessage());
         throw new MediaStorageClientManagerException($e->getMessage());
     }
     if ($response && $response->isOk()) {
         $content = json_decode($response->getContent(), true);
         if ($content && !json_last_error() && is_array($content) && array_key_exists('reference_full', $content)) {
             $proxyMedia = $this->proxyMediaManager->createFromResponse($response);
             return $proxyMedia;
         }
         $this->logger->warning('Client not response new value: ' . $content);
         throw new MediaStorageClientManagerException('Client not response new value');
     }
     $this->logger->warning('Client response code: ' . $response->getStatusCode() . ' ' . $response->getContent());
     throw new MediaStorageClientManagerException('Client response code: ' . $response->getStatusCode());
 }