Code Duplication    Length = 18-19 lines in 2 locations

src/apis/Api.php 1 location

@@ 91-109 (lines=19) @@
88
     *
89
     * @return array
90
     */
91
    protected function _parseResponse($result)
92
    {
93
        if (!$this->isJsonResponse) {
94
            return $result;
95
        }
96
        $result = json_decode($result, true);
97
        if (!$result || !isset($result['errNum'])) {
98
            return ['errcode' => 1, 'errmsg' => 'fetch data error'];
99
        }
100
        if ($result['errNum'] == 0) {
101
            return [
102
                'errcode' => 0,
103
                'errmsg' => 'success',
104
                'data' => $result['retData'],
105
            ];
106
        }
107
108
        return ['errcode' => $result['errNum'], 'errmsg' => $result['errMsg']];
109
    }
110
}
111

src/apis/IdCard.php 1 location

@@ 38-55 (lines=18) @@
35
    /**
36
     * {@inheritdoc}
37
     */
38
    protected function _parseResponse($result)
39
    {
40
        $result = json_decode($result, true);
41
        // @codeCoverageIgnoreStart
42
        if (!$result || !isset($result['errNum'])) {
43
            return ['errcode' => 1, 'errmsg' => 'fetch data error'];
44
        }
45
        // @codeCoverageIgnoreEnd
46
        if ($result['errNum'] == 0) {
47
            return [
48
                'errcode' => 0,
49
                'errmsg' => 'success',
50
                'data' => $result['retData'],
51
            ];
52
        }
53
54
        return ['errcode' => $result['errNum'], 'errmsg' => $result['retMsg']];
55
    }
56
}
57