Code Duplication    Length = 13-14 lines in 2 locations

src/Remote.php 2 locations

@@ 48-61 (lines=14) @@
45
        return $this->http($request);
46
    }
47
48
    public function postJson(string $url, array $data, array $headers = [], string $method = Request::POST): Message
49
    {
50
        $headers['Content-Type'] = 'application/json; charset=utf-8';
51
        $headers['Accept'] = 'application/json';
52
        $data_string = json_encode($data);
53
        $headers['Content-Length'] = strlen($data_string);
54
        $request = (new Message)
55
            ->withType(Message::REQUEST)
56
            ->withUrl($url)
57
            ->withMethod($method)
58
            ->withBody($data_string)
59
            ->withHeaders($headers);
60
        return $this->http($request);
61
    }
62
63
    public function postForm(string $url, array $data, array $headers = [], string $method = Request::POST): Message
64
    {
@@ 63-75 (lines=13) @@
60
        return $this->http($request);
61
    }
62
63
    public function postForm(string $url, array $data, array $headers = [], string $method = Request::POST): Message
64
    {
65
        $headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8';
66
        $data_string = http_build_query($data);
67
        $headers['Content-Length'] = strlen($data_string);
68
        $request = (new Message)
69
            ->withType(Message::REQUEST)
70
            ->withUrl($url)
71
            ->withMethod($method)
72
            ->withBody($data_string)
73
            ->withHeaders($headers);
74
        return $this->http($request);
75
    }
76
77
    public function delete(string $url, array $headers = []): Message
78
    {