Code Duplication    Length = 10-11 lines in 7 locations

src/HttpCallsTrait.php 3 locations

@@ 57-67 (lines=11) @@
54
     *
55
     * @return ResponseInterface
56
     */
57
    protected function post(
58
        string $uri,
59
        array $data = [],
60
        array $headers = [],
61
        array $cookies = [],
62
        array $files = []
63
    ): ResponseInterface {
64
        $headers['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
65
66
        return $this->call('POST', $uri, [], $data, $headers, $cookies, $files);
67
    }
68
69
    /**
70
     * @param string $uri
@@ 78-88 (lines=11) @@
75
     *
76
     * @return ResponseInterface
77
     */
78
    protected function put(
79
        string $uri,
80
        array $data = [],
81
        array $headers = [],
82
        array $cookies = [],
83
        array $files = []
84
    ): ResponseInterface {
85
        $headers['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
86
87
        return $this->call('PUT', $uri, [], $data, $headers, $cookies, $files);
88
    }
89
90
    /**
91
     * @param string $uri
@@ 99-109 (lines=11) @@
96
     *
97
     * @return ResponseInterface
98
     */
99
    protected function patch(
100
        string $uri,
101
        array $data = [],
102
        array $headers = [],
103
        array $cookies = [],
104
        array $files = []
105
    ): ResponseInterface {
106
        $headers['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
107
108
        return $this->call('PATCH', $uri, [], $data, $headers, $cookies, $files);
109
    }
110
111
    /**
112
     * @param string $uri

src/JsonApiCallsTrait.php 4 locations

@@ 42-52 (lines=11) @@
39
     *
40
     * @return ResponseInterface
41
     */
42
    protected function postJsonApi(
43
        string $uri,
44
        string $json,
45
        array $headers = [],
46
        array $cookies = [],
47
        array $files = []
48
    ): ResponseInterface {
49
        $headers['CONTENT_TYPE'] = 'application/vnd.api+json';
50
51
        return $this->call('POST', $uri, [], [], $headers, $cookies, $files, [], $this->streamFromString($json));
52
    }
53
54
    /**
55
     * @param string $uri
@@ 63-73 (lines=11) @@
60
     *
61
     * @return ResponseInterface
62
     */
63
    protected function putJsonApi(
64
        string $uri,
65
        string $json,
66
        array $headers = [],
67
        array $cookies = [],
68
        array $files = []
69
    ): ResponseInterface {
70
        $headers['CONTENT_TYPE'] = 'application/vnd.api+json';
71
72
        return $this->call('PUT', $uri, [], [], $headers, $cookies, $files, [], $this->streamFromString($json));
73
    }
74
75
    /**
76
     * @param string $uri
@@ 84-94 (lines=11) @@
81
     *
82
     * @return ResponseInterface
83
     */
84
    protected function patchJsonApi(
85
        string $uri,
86
        string $json,
87
        array $headers = [],
88
        array $cookies = [],
89
        array $files = []
90
    ): ResponseInterface {
91
        $headers['CONTENT_TYPE'] = 'application/vnd.api+json';
92
93
        return $this->call('PATCH', $uri, [], [], $headers, $cookies, $files, [], $this->streamFromString($json));
94
    }
95
96
    /**
97
     * @param string $uri
@@ 104-113 (lines=10) @@
101
     *
102
     * @return ResponseInterface
103
     */
104
    protected function deleteJsonApi(
105
        string $uri,
106
        string $json,
107
        array $headers = [],
108
        array $cookies = []
109
    ): ResponseInterface {
110
        $headers['CONTENT_TYPE'] = 'application/vnd.api+json';
111
112
        return $this->call('DELETE', $uri, [], [], $headers, $cookies, [], [], $this->streamFromString($json));
113
    }
114
115
    /**
116
     * @param string $content