Code Duplication    Length = 19-21 lines in 2 locations

src/Gaufrette/Adapter/AzureBlobStorage.php 2 locations

@@ 393-411 (lines=19) @@
390
     * @throws \RuntimeException
391
     * @throws \InvalidArgumentException
392
     */
393
    public function setMetadata($key, $content)
394
    {
395
        $this->init();
396
        list($containerName, $key) = $this->tokenizeKey($key);
397
398
        try {
399
            $this->blobProxy->setBlobMetadata($containerName, $key, $content);
400
        } catch (ServiceException $e) {
401
            $errorCode = $this->getErrorCodeFromServiceException($e);
402
403
            throw new \RuntimeException(sprintf(
404
                'Failed to set metadata for blob "%s" in container "%s": %s (%s).',
405
                $key,
406
                $containerName,
407
                $e->getErrorText(),
408
                $errorCode
409
            ), $e->getCode());
410
        }
411
    }
412
413
    /**
414
     * {@inheritdoc}
@@ 418-438 (lines=21) @@
415
     * @throws \RuntimeException
416
     * @throws \InvalidArgumentException
417
     */
418
    public function getMetadata($key)
419
    {
420
        $this->init();
421
        list($containerName, $key) = $this->tokenizeKey($key);
422
423
        try {
424
            $properties = $this->blobProxy->getBlobProperties($containerName, $key);
425
426
            return $properties->getMetadata();
427
        } catch (ServiceException $e) {
428
            $errorCode = $this->getErrorCodeFromServiceException($e);
429
430
            throw new \RuntimeException(sprintf(
431
                'Failed to get metadata for blob "%s" in container "%s": %s (%s).',
432
                $key,
433
                $containerName,
434
                $e->getErrorText(),
435
                $errorCode
436
            ), $e->getCode());
437
        }
438
    }
439
440
    /**
441
     * Lazy initialization, automatically called when some method is called after construction.