Code Duplication    Length = 18-20 lines in 2 locations

src/Gaufrette/Adapter/AzureBlobStorage.php 2 locations

@@ 336-353 (lines=18) @@
333
     * {@inheritdoc}
334
     * @throws \RuntimeException
335
     */
336
    public function setMetadata($key, $content)
337
    {
338
        $this->init();
339
340
        try {
341
            $this->blobProxy->setBlobMetadata($this->containerName, $key, $content);
342
        } catch (ServiceException $e) {
343
            $errorCode = $this->getErrorCodeFromServiceException($e);
344
345
            throw new \RuntimeException(sprintf(
346
                'Failed to set metadata for blob "%s" in container "%s": %s (%s).',
347
                $key,
348
                $this->containerName,
349
                $e->getErrorText(),
350
                $errorCode
351
            ), $e->getCode());
352
        }
353
    }
354
355
    /**
356
     * {@inheritdoc}
@@ 359-378 (lines=20) @@
356
     * {@inheritdoc}
357
     * @throws \RuntimeException
358
     */
359
    public function getMetadata($key)
360
    {
361
        $this->init();
362
363
        try {
364
            $properties = $this->blobProxy->getBlobProperties($this->containerName, $key);
365
366
            return $properties->getMetadata();
367
        } catch (ServiceException $e) {
368
            $errorCode = $this->getErrorCodeFromServiceException($e);
369
370
            throw new \RuntimeException(sprintf(
371
                'Failed to get metadata for blob "%s" in container "%s": %s (%s).',
372
                $key,
373
                $this->containerName,
374
                $e->getErrorText(),
375
                $errorCode
376
            ), $e->getCode());
377
        }
378
    }
379
380
    /**
381
     * Lazy initialization, automatically called when some method is called after construction.