Code Duplication    Length = 13-13 lines in 2 locations

src/Client.php 2 locations

@@ 337-349 (lines=13) @@
334
     *
335
     * @return string The response body
336
     */
337
    public function put($url, $data, $contentType = 'application/json')
338
    {
339
        $uri = $this->buildUrl($url);
340
        $headers = [];
341
        if (!is_null($contentType)) {
342
            $headers['Content-Type'] = $contentType;
343
            $headers['Accept'] = $contentType;
344
        }
345
        $request = $this->messageFactory->createRequest('PUT', $uri, $headers, $data);
346
        $response = $this->request($request);
347
348
        return strval($response->getBody());
349
    }
350
351
    /**
352
     * Make a PUT request, sending JSON data.
@@ 390-402 (lines=13) @@
387
     *
388
     * @return string The response body
389
     */
390
    public function post($url, $data, $contentType = 'application/json')
391
    {
392
        $uri = $this->buildUrl($url);
393
        $headers = [];
394
        if (!is_null($contentType)) {
395
            $headers['Content-Type'] = $contentType;
396
            $headers['Accept'] = $contentType;
397
        }
398
        $request = $this->messageFactory->createRequest('POST', $uri, $headers, $data);
399
        $response = $this->request($request);
400
401
        return strval($response->getBody());
402
    }
403
404
    /**
405
     * Make a POST request, sending JSON data.