src/Http.php
protected function decodeResponse($data) {
        foreach ($this->decodeFunc as $func) {
            if (is_callable($func)) {
                $data = call_user_func($func, $data);
                continue;
            }
            if ($func == self::JSON) {
                $data = Json::decode($data);
                continue;
            }
            if ($func == self::XML) {
                $data = Xml::decode($data);
                continue;
            }
            if (!is_null($func)) {
                continue;
            }
            if (preg_match($this->_jsonPattern, $this->getContentType())) {
                $data = Json::decode($data);
                continue;
            }
            if (preg_match($this->_xmlPattern, $this->getContentType())) {
                $data = Xml::decode($data);
                continue;
            }
        }
        return $data;
    }
protected function decodeResponse($data) {
        foreach ($this->decodeFunc as $func) {
            if (is_callable($func)) {
                $data = call_user_func($func, $data);
                continue;
            }
            if ($func == self::JSON) {
                $data = Json::decode($data);
                continue;
            }
            if ($func == self::XML) {
                $data = Xml::decode($data);
                continue;
            }
            if (!is_null($func)) {
                continue;
            }
            if (preg_match($this->_jsonPattern, $this->getContentType())) {
                $data = Json::decode($data);
                continue;
            }
            if (preg_match($this->_xmlPattern, $this->getContentType())) {
                $data = Xml::decode($data);
                continue;
            }
        }
        return $data;
    }
自动解码结果
@param $data
@return array|mixed|object
@throws \Exception