Code Duplication    Length = 5-5 lines in 3 locations

src/lib/Rest.php 2 locations

@@ 148-152 (lines=5) @@
145
        $header = ["Accept:application/$this->BodyType", "Content-Type:application/$this->BodyType;charset=utf-8", "Authorization:$authen"];
146
        // 发送请求
147
        $result = $this->curl_post($url, $body, $header);
148
        if ($this->BodyType === 'json') {//JSON格式
149
            $datas = json_decode($result);
150
        } else { //xml格式
151
            $datas = simplexml_load_string(trim($result, " \t\n\r"));
152
        }
153
        // 重新装填数据
154
        if (isset($datas->templateSMS)) {
155
            $datas->TemplateSMS = $datas->templateSMS;
@@ 211-215 (lines=5) @@
208
        $header = ["Accept:application/$this->BodyType", "Content-Type:application/$this->BodyType;charset=utf-8", "Authorization:$authen"];
209
        // 发送请求
210
        $result = $this->curl_post($url, $body, $header);
211
        if ($this->BodyType === 'json') {//JSON格式
212
            $datas = json_decode($result);
213
        } else { //xml格式
214
            $datas = simplexml_load_string(trim($result, " \t\n\r"));
215
        }
216
217
        return $datas;
218
    }

src/lib/Juhe.php 1 location

@@ 58-62 (lines=5) @@
55
        // 发送请求
56
        $result = $this->curl_post($url, $body, $header, 0);
57
58
        if ($this->BodyType === 'json') {//JSON格式
59
            $datas = json_decode($result);
60
        } else { //xml格式
61
            $datas = simplexml_load_string(trim($result, " \t\n\r"));
62
        }
63
64
        return $datas;
65
    }