Client::getAppInfo()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 2
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 6
rs 10
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