Code Duplication    Length = 11-13 lines in 2 locations

src/phpsms/agents/JuHeAgent.php 1 location

@@ 53-65 (lines=13) @@
50
        $this->setResult($result);
51
    }
52
53
    protected function setResult($result)
54
    {
55
        if ($result['request']) {
56
            $result = json_decode($result['response'], true);
57
            if ($result['error_code'] === 0) {
58
                $this->result(Agent::SUCCESS, true);
59
            }
60
            $this->result(Agent::INFO, json_encode($result));
61
            $this->result(Agent::CODE, $result['error_code']);
62
        } else {
63
            $this->result(Agent::INFO, '请求失败');
64
        }
65
    }
66
67
    public function sendContentSms($to, $content)
68
    {

src/phpsms/agents/LuosimaoAgent.php 1 location

@@ 53-63 (lines=11) @@
50
        $this->setResult($result);
51
    }
52
53
    protected function setResult($result)
54
    {
55
        if ($result['request']) {
56
            $result = json_decode($result['response'], true);
57
            $this->result(Agent::INFO, $result);
58
            $this->result(Agent::SUCCESS, $result['error'] === 0);
59
            $this->result(Agent::CODE, $result['error']);
60
        } else {
61
            $this->result(Agent::INFO, '请求失败');
62
        }
63
    }
64
65
    public function sendTemplateSms($to, $tempId, array $data)
66
    {