Code Duplication    Length = 8-9 lines in 3 locations

src/phpsms/agents/YunPianAgent.php 2 locations

@@ 17-25 (lines=9) @@
14
        $this->sendContentSms($to, $content);
15
    }
16
17
    public function sendContentSms($to, $content)
18
    {
19
        $url = 'http://yunpian.com/v1/sms/send.json';
20
        $apikey = $this->apikey;
21
        $content = urlencode("$content");
22
        $postString = "apikey=$apikey&text=$content&mobile=$to";
23
        $response = $this->sockPost($url, $postString);
24
        $this->setResult($response);
25
    }
26
27
    public function voiceVerify($to, $code, $tempId, array $data)
28
    {
@@ 27-34 (lines=8) @@
24
        $this->setResult($response);
25
    }
26
27
    public function voiceVerify($to, $code, $tempId, array $data)
28
    {
29
        $url = 'http://voice.yunpian.com/v1/voice/send.json';
30
        $apikey = $this->apikey;
31
        $postString = "apikey=$apikey&code=$code&mobile=$to";
32
        $response = $this->sockPost($url, $postString);
33
        $this->setResult($response);
34
    }
35
36
    protected function setResult($result)
37
    {

src/phpsms/agents/SmsbaoAgent.php 1 location

@@ 67-75 (lines=9) @@
64
     * @param       $tempId
65
     * @param array $tempData
66
     */
67
    public function voiceVerify($to, $code, $tempId, array $tempData)
68
    {
69
        $url = 'http://api.smsbao.com/voice';
70
        $username = $this->smsUser;
71
        $password = md5($this->smsPassword);
72
        $postString = "u=$username&p=$password&m=$to&c=$code";
73
        $response = $this->sockPost($url, $postString);
74
        $this->setResult($response);
75
    }
76
77
    protected function setResult($result)
78
    {