Code Duplication    Length = 19-23 lines in 2 locations

src/Gaufrette/Adapter/AzureBlobStorage.php 2 locations

@@ 107-129 (lines=23) @@
104
     *
105
     * @throws \RuntimeException if cannot create the container
106
     */
107
    public function createContainer($containerName, CreateContainerOptions $options = null)
108
    {
109
        $this->init();
110
111
        if (null === $options) {
112
            $options = $this->getCreateContainerOptions();
113
        }
114
115
        try {
116
            $this->blobProxy->createContainer($containerName, $options);
117
        } catch (ServiceException $e) {
118
            $errorCode = $this->getErrorCodeFromServiceException($e);
119
120
            if ($errorCode !== self::ERROR_CONTAINER_ALREADY_EXISTS) {
121
                throw new \RuntimeException(sprintf(
122
                    'Failed to create the configured container "%s": %s (%s).',
123
                    $containerName,
124
                    $e->getErrorText(),
125
                    $errorCode
126
                ));
127
            }
128
        }
129
    }
130
131
    /**
132
     * Deletes a container.
@@ 139-157 (lines=19) @@
136
     *
137
     * @throws \RuntimeException if cannot delete the container
138
     */
139
    public function deleteContainer($containerName, DeleteContainerOptions $options = null)
140
    {
141
        $this->init();
142
143
        try {
144
            $this->blobProxy->deleteContainer($containerName, $options);
145
        } catch (ServiceException $e) {
146
            $errorCode = $this->getErrorCodeFromServiceException($e);
147
148
            if ($errorCode !== self::ERROR_CONTAINER_NOT_FOUND) {
149
                throw new \RuntimeException(sprintf(
150
                    'Failed to delete the configured container "%s": %s (%s).',
151
                    $containerName,
152
                    $e->getErrorText(),
153
                    $errorCode
154
                ), $e->getCode());
155
            }
156
        }
157
    }
158
159
    /**
160
     * {@inheritdoc}