Code Duplication    Length = 16-16 lines in 2 locations

src/HttpClient.php 2 locations

@@ 66-81 (lines=16) @@
63
     * @param $alt
64
     * @return array
65
     */
66
    public function get($uri, $alt)
67
    {
68
        $options = ['headers'=> ['Accept' => 'application/xml']];
69
70
        if ($alt == "json") {
71
            $options = ['headers'=> ['Accept' => 'application/json']];
72
        }
73
        $uri = $this->endpoint. "/api/". $this->version .$uri."?authtoken=".$this->authToken;
74
75
        $response = $this->getClient()->request('GET', $uri, $options);
76
        $xml = simplexml_load_string($response->getBody());
77
        $json = json_encode($xml);
78
        $data = json_decode($json, true);
79
80
        return $data;
81
    }
82
83
    /**
84
     * @param $uri
@@ 88-103 (lines=16) @@
85
     * @param $alt
86
     * @return array
87
     */
88
    public function post($uri, $alt)
89
    {
90
        $options = ['headers'=> ['Accept' => 'application/xml']];
91
92
        if ($alt == "json") {
93
            $options = ['headers'=> ['Accept' => 'application/json']];
94
        }
95
        $uri = $this->endpoint. "/api/". $this->version .$uri."?authtoken=".$this->authToken;
96
97
        $response = $this->getClient()->request('POST', $uri, $options);
98
        $xml = simplexml_load_string($response->getBody());
99
        $json = json_encode($xml);
100
        $data = json_decode($json, true);
101
102
        return $data;
103
    }
104
}
105