Code Duplication    Length = 12-12 lines in 3 locations

src/Api/HttpApi.php 3 locations

@@ 154-165 (lines=12) @@
151
     * @param array|string $body           Request body
152
     * @param array        $requestHeaders Request headers
153
     */
154
    protected function httpPostRaw(string $path, $body, array $requestHeaders = []): ResponseInterface
155
    {
156
        try {
157
            $response = $this->httpClient->sendRequest(
158
                $this->requestBuilder->create('POST', $path, $requestHeaders, $body)
159
            );
160
        } catch (Psr18\NetworkExceptionInterface $e) {
161
            throw HttpServerException::networkError($e);
162
        }
163
164
        return $response;
165
    }
166
167
    /**
168
     * Send a PUT request.
@@ 174-185 (lines=12) @@
171
     * @param array  $parameters     PUT parameters
172
     * @param array  $requestHeaders Request headers
173
     */
174
    protected function httpPut(string $path, array $parameters = [], array $requestHeaders = []): ResponseInterface
175
    {
176
        try {
177
            $response = $this->httpClient->sendRequest(
178
                $this->requestBuilder->create('PUT', $path, $requestHeaders, $this->createRequestBody($parameters))
179
            );
180
        } catch (Psr18\NetworkExceptionInterface $e) {
181
            throw HttpServerException::networkError($e);
182
        }
183
184
        return $response;
185
    }
186
187
    /**
188
     * Send a DELETE request.
@@ 194-205 (lines=12) @@
191
     * @param array  $parameters     DELETE parameters
192
     * @param array  $requestHeaders Request headers
193
     */
194
    protected function httpDelete(string $path, array $parameters = [], array $requestHeaders = []): ResponseInterface
195
    {
196
        try {
197
            $response = $this->httpClient->sendRequest(
198
                $this->requestBuilder->create('DELETE', $path, $requestHeaders, $this->createRequestBody($parameters))
199
            );
200
        } catch (Psr18\NetworkExceptionInterface $e) {
201
            throw HttpServerException::networkError($e);
202
        }
203
204
        return $response;
205
    }
206
207
    /**
208
     * Prepare a set of key-value-pairs to be encoded as multipart/form-data.