Code Duplication    Length = 19-21 lines in 2 locations

src/Gaufrette/Adapter/AzureBlobStorage.php 2 locations

@@ 371-389 (lines=19) @@
368
     * @throws \RuntimeException
369
     * @throws \InvalidArgumentException
370
     */
371
    public function setMetadata($key, $content)
372
    {
373
        $this->init();
374
        list($containerName, $key) = $this->tokenizeKey($key);
375
376
        try {
377
            $this->blobProxy->setBlobMetadata($containerName, $key, $content);
378
        } catch (ServiceException $e) {
379
            $errorCode = $this->getErrorCodeFromServiceException($e);
380
381
            throw new \RuntimeException(sprintf(
382
                'Failed to set metadata for blob "%s" in container "%s": %s (%s).',
383
                $key,
384
                $containerName,
385
                $e->getErrorText(),
386
                $errorCode
387
            ), $e->getCode());
388
        }
389
    }
390
391
    /**
392
     * {@inheritdoc}
@@ 396-416 (lines=21) @@
393
     * @throws \RuntimeException
394
     * @throws \InvalidArgumentException
395
     */
396
    public function getMetadata($key)
397
    {
398
        $this->init();
399
        list($containerName, $key) = $this->tokenizeKey($key);
400
401
        try {
402
            $properties = $this->blobProxy->getBlobProperties($containerName, $key);
403
404
            return $properties->getMetadata();
405
        } catch (ServiceException $e) {
406
            $errorCode = $this->getErrorCodeFromServiceException($e);
407
408
            throw new \RuntimeException(sprintf(
409
                'Failed to get metadata for blob "%s" in container "%s": %s (%s).',
410
                $key,
411
                $containerName,
412
                $e->getErrorText(),
413
                $errorCode
414
            ), $e->getCode());
415
        }
416
    }
417
418
    /**
419
     * Lazy initialization, automatically called when some method is called after construction.