Code Duplication    Length = 12-12 lines in 3 locations

src/Api/HttpApi.php 3 locations

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