Code Duplication    Length = 12-12 lines in 3 locations

src/Api/HttpApi.php 3 locations

@@ 143-154 (lines=12) @@
140
     * @param array|string $body           Request body
141
     * @param array        $requestHeaders Request headers
142
     */
143
    protected function httpPostRaw(string $path, $body, array $requestHeaders = []): ResponseInterface
144
    {
145
        try {
146
            $response = $this->httpClient->sendRequest(
147
                $this->requestBuilder->create('POST', $path, $requestHeaders, $body)
148
            );
149
        } catch (HttplugException\NetworkException $e) {
150
            throw HttpServerException::networkError($e);
151
        }
152
153
        return $response;
154
    }
155
156
    /**
157
     * Send a PUT request.
@@ 163-174 (lines=12) @@
160
     * @param array  $parameters     PUT parameters
161
     * @param array  $requestHeaders Request headers
162
     */
163
    protected function httpPut(string $path, array $parameters = [], array $requestHeaders = []): ResponseInterface
164
    {
165
        try {
166
            $response = $this->httpClient->sendRequest(
167
                $this->requestBuilder->create('PUT', $path, $requestHeaders, $this->createRequestBody($parameters))
168
            );
169
        } catch (HttplugException\NetworkException $e) {
170
            throw HttpServerException::networkError($e);
171
        }
172
173
        return $response;
174
    }
175
176
    /**
177
     * Send a DELETE request.
@@ 183-194 (lines=12) @@
180
     * @param array  $parameters     DELETE parameters
181
     * @param array  $requestHeaders Request headers
182
     */
183
    protected function httpDelete(string $path, array $parameters = [], array $requestHeaders = []): ResponseInterface
184
    {
185
        try {
186
            $response = $this->httpClient->sendRequest(
187
                $this->requestBuilder->create('DELETE', $path, $requestHeaders, $this->createRequestBody($parameters))
188
            );
189
        } catch (HttplugException\NetworkException $e) {
190
            throw HttpServerException::networkError($e);
191
        }
192
193
        return $response;
194
    }
195
196
    /**
197
     * Prepare a set of key-value-pairs to be encoded as multipart/form-data.