Code Duplication    Length = 12-12 lines in 3 locations

src/Api/HttpApi.php 3 locations

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