Code Duplication    Length = 14-14 lines in 2 locations

src/Client.php 2 locations

@@ 319-332 (lines=14) @@
316
     *
317
     * @return bool
318
     */
319
    public function put($url, $data, $contentType = 'application/json')
320
    {
321
        $uri = $this->buildUrl($url);
322
        $headers = [];
323
        if (!is_null($contentType)) {
324
            $headers['Content-Type'] = $contentType;
325
            $headers['Accept'] = $contentType;
326
        }
327
        $request = $this->messageFactory->createRequest('PUT', $uri, $headers, $data);
328
        $response = $this->request($request);
329
330
        // Consider it a success if status code is 2XX
331
        return substr($response->getStatusCode(), 0, 1) == '2';
332
    }
333
334
    /**
335
     * Make a PUT request, sending JSON data.
@@ 371-384 (lines=14) @@
368
     *
369
     * @return bool
370
     */
371
    public function post($url, $data, $contentType = 'application/json')
372
    {
373
        $uri = $this->buildUrl($url);
374
        $headers = [];
375
        if (!is_null($contentType)) {
376
            $headers['Content-Type'] = $contentType;
377
            $headers['Accept'] = $contentType;
378
        }
379
        $request = $this->messageFactory->createRequest('POST', $uri, $headers, $data);
380
        $response = $this->request($request);
381
382
        // Consider it a success if status code is 2XX
383
        return substr($response->getStatusCode(), 0, 1) == '2';
384
    }
385
386
    /**
387
     * Make a POST request, sending JSON data.