Code Duplication    Length = 11-13 lines in 5 locations

src/phpsms/agents/JuHeAgent.php 1 location

@@ 49-59 (lines=11) @@
46
        $this->setResult($result);
47
    }
48
49
    protected function setResult($result)
50
    {
51
        if ($result['request']) {
52
            $this->result(Agent::INFO, $result['response']);
53
            $result = json_decode($result['response'], true);
54
            $this->result(Agent::SUCCESS, $result['error_code'] === 0);
55
            $this->result(Agent::CODE, $result['error_code']);
56
        } else {
57
            $this->result(Agent::INFO, 'request failed');
58
        }
59
    }
60
}
61

src/phpsms/agents/LuosimaoAgent.php 1 location

@@ 46-56 (lines=11) @@
43
        $this->setResult($result);
44
    }
45
46
    protected function setResult($result)
47
    {
48
        if ($result['request']) {
49
            $this->result(Agent::INFO, $result['response']);
50
            $result = json_decode($result['response'], true);
51
            $this->result(Agent::SUCCESS, $result['error'] === 0);
52
            $this->result(Agent::CODE, $result['error']);
53
        } else {
54
            $this->result(Agent::INFO, 'request failed');
55
        }
56
    }
57
}
58

src/phpsms/agents/SendCloudAgent.php 1 location

@@ 54-66 (lines=13) @@
51
        return md5($stringToBeSigned);
52
    }
53
54
    protected function setResult($result)
55
    {
56
        if ($result['request']) {
57
            $this->result(Agent::INFO, $result['response']);
58
            $result = json_decode($result['response'], true);
59
            if (isset($result['result'])) {
60
                $this->result(Agent::SUCCESS, (bool) $result['result']);
61
                $this->result(Agent::CODE, $result['statusCode']);
62
            }
63
        } else {
64
            $this->result(Agent::INFO, 'request failed');
65
        }
66
    }
67
68
    protected function getTempDataString(array $data)
69
    {

src/phpsms/agents/YunPianAgent.php 1 location

@@ 47-57 (lines=11) @@
44
        $this->setResult($result);
45
    }
46
47
    protected function setResult($result)
48
    {
49
        if ($result['request']) {
50
            $this->result(Agent::INFO, $result['response']);
51
            $result = json_decode($result['response'], true);
52
            $this->result(Agent::SUCCESS, $result['code'] === 0);
53
            $this->result(Agent::CODE, $result['code']);
54
        } else {
55
            $this->result(Agent::INFO, 'request failed');
56
        }
57
    }
58
}
59

src/phpsms/agents/AliyunAgent.php 1 location

@@ 77-89 (lines=13) @@
74
        return $res;
75
    }
76
77
    protected function setResult($result)
78
    {
79
        if ($result['request']) {
80
            $this->result(Agent::INFO, $result['response']);
81
            $result = json_decode($result['response'], true);
82
            $this->result(Agent::CODE, $result['Code']);
83
            if ($result['Code'] === 'OK') {
84
                $this->result(Agent::SUCCESS, true);
85
            }
86
        } else {
87
            $this->result(Agent::INFO, 'request failed');
88
        }
89
    }
90
91
    protected function getTempDataString(array $data)
92
    {