Code Duplication    Length = 19-23 lines in 2 locations

src/Gaufrette/Adapter/AzureBlobStorage.php 2 locations

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