Client   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 46
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 7 1
A set() 0 3 1
A list() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the overtrue/wechat.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace EasyWeChat\Work\Agent;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * This is WeWork Agent Client.
18
 *
19
 * @author mingyoung <[email protected]>
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * Get agent.
25
     *
26
     * @param int $agentId
27
     *
28
     * @return mixed
29
     *
30
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
31
     */
32 1
    public function get(int $agentId)
33
    {
34
        $params = [
35 1
            'agentid' => $agentId,
36
        ];
37
38 1
        return $this->httpGet('cgi-bin/agent/get', $params);
39
    }
40
41
    /**
42
     * Set agent.
43
     *
44
     * @param int   $agentId
45
     * @param array $attributes
46
     *
47
     * @return mixed
48
     *
49
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
50
     * @throws \GuzzleHttp\Exception\GuzzleException
51
     */
52 1
    public function set(int $agentId, array $attributes)
53
    {
54 1
        return $this->httpPostJson('cgi-bin/agent/set', array_merge(['agentid' => $agentId], $attributes));
55
    }
56
57
    /**
58
     * Get agent list.
59
     *
60
     * @return mixed
61
     *
62
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
63
     */
64 1
    public function list()
65
    {
66 1
        return $this->httpGet('cgi-bin/agent/list');
67
    }
68
}
69