Client   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 49
ccs 0
cts 9
cp 0
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getHistory() 0 8 1
A getIPList() 0 3 1
A getAppInfo() 0 5 2
1
<?php
2
3
namespace EasyIM\TencentIM\Operate;
4
5
use EasyIM\Kernel\BaseClient;
6
7
/**
8
 * Class Client
9
 *
10
 * @package EasyIM\TencentIM\Operate
11
 * @author  longing <[email protected]>
12
 */
13
class Client extends BaseClient
14
{
15
    /**
16
     *
17
     * Pull operation data.
18
     *
19
     * @param array $fields 指定拉取的字段
20
     *
21
     * @return array|\EasyIM\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
22
     * @throws \EasyIM\Kernel\Exceptions\InvalidConfigException
23
     * @throws \GuzzleHttp\Exception\GuzzleException
24
     */
25
    public function getAppInfo(array $fields = [])
26
    {
27
        $params = count($fields) > 0 ? ['RequestField' => $fields] : $fields;
28
29
        return $this->httpPostJson('openconfigsvr/getappinfo', $params);
30
    }
31
32
    /**
33
     * Download recent message log.
34
     *
35
     * @param string $chatType C2C or Group
36
     * @param string $megTime
37
     *
38
     * @return array|\EasyIM\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
39
     * @throws \EasyIM\Kernel\Exceptions\InvalidConfigException
40
     * @throws \GuzzleHttp\Exception\GuzzleException
41
     */
42
    public function getHistory(string $megTime, string $chatType = 'C2C')
43
    {
44
        $params = [
45
            'ChatType' => $chatType,
46
            'MsgTime' => $megTime
47
        ];
48
49
        return $this->httpPostJson('open_msg_svc/get_history', $params);
50
    }
51
52
    /**
53
     * Get server IP address.
54
     *
55
     * @return array|\EasyIM\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
56
     * @throws \EasyIM\Kernel\Exceptions\InvalidConfigException
57
     * @throws \GuzzleHttp\Exception\GuzzleException
58
     */
59
    public function getIPList()
60
    {
61
        return $this->httpPostJson('ConfigSvc/GetIPList');
62
    }
63
}
64