Client::user()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 11
ccs 5
cts 5
cp 1
crap 2
rs 10
c 0
b 0
f 0
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\OfficialAccount\ShakeAround;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 *
19
 * @author overtrue <[email protected]>
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * @param array $data
25
     *
26
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
27
     *
28
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
29
     * @throws \GuzzleHttp\Exception\GuzzleException
30
     */
31 1
    public function register($data)
32
    {
33 1
        return $this->httpPostJson('shakearound/account/register', $data);
34
    }
35
36
    /**
37
     * Get audit status.
38
     *
39
     * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
40
     *
41
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
42
     */
43 1
    public function status()
44
    {
45 1
        return $this->httpGet('shakearound/account/auditstatus');
46
    }
47
48
    /**
49
     * Get shake info.
50
     *
51
     * @param string $ticket
52
     * @param bool   $needPoi
53
     *
54
     * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
55
     *
56
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
57
     * @throws \GuzzleHttp\Exception\GuzzleException
58
     */
59 1
    public function user(string $ticket, bool $needPoi = false)
60
    {
61
        $params = [
62 1
            'ticket' => $ticket,
63
        ];
64
65 1
        if ($needPoi) {
66 1
            $params['need_poi'] = 1;
67
        }
68
69 1
        return $this->httpPostJson('shakearound/user/getshakeinfo', $params);
70
    }
71
72
    /**
73
     * @param string $ticket
74
     *
75
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
76
     */
77 1
    public function userWithPoi(string $ticket)
78
    {
79 1
        return $this->user($ticket, true);
80
    }
81
}
82