Client   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 4
dl 0
loc 39
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
A create() 0 3 1
A delete() 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\Menu;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 *
19
 * @author mingyoung <[email protected]>
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * Get menu.
25
     *
26
     * @return mixed
27
     *
28
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
29
     */
30 1
    public function get()
31
    {
32 1
        return $this->httpGet('cgi-bin/menu/get', ['agentid' => $this->app['config']['agent_id']]);
33
    }
34
35
    /**
36
     * Create menu for the given agent.
37
     *
38
     * @param array $data
39
     *
40
     * @return mixed
41
     *
42
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
43
     * @throws \GuzzleHttp\Exception\GuzzleException
44
     */
45 1
    public function create(array $data)
46
    {
47 1
        return $this->httpPostJson('cgi-bin/menu/create', $data, ['agentid' => $this->app['config']['agent_id']]);
48
    }
49
50
    /**
51
     * Delete menu.
52
     *
53
     * @return mixed
54
     *
55
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
56
     */
57 1
    public function delete()
58
    {
59 1
        return $this->httpGet('cgi-bin/menu/delete', ['agentid' => $this->app['config']['agent_id']]);
60
    }
61
}
62