Passed
Push — master ( 00776a...9ca1a9 )
by Carlos
05:03 queued 02:15
created

Client::unbindWithUserStr()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
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\OpenPlatform\Authorizer\MiniProgram\Tester;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 *
19
 * @author caikeal <[email protected]>
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * 绑定小程序体验者.
25
     *
26
     * @param string $wechatId
27
     *
28
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
29
     *
30
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
31
     * @throws \GuzzleHttp\Exception\GuzzleException
32
     */
33 1
    public function bind(string $wechatId)
34
    {
35 1
        return $this->httpPostJson('wxa/bind_tester', [
36 1
            'wechatid' => $wechatId,
37
        ]);
38
    }
39
40
    /**
41
     * 解绑小程序体验者.
42
     *
43
     * @param string $wechatId
44
     * @param string $userStr
45
     *
46
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
47
     *
48
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
49
     * @throws \GuzzleHttp\Exception\GuzzleException
50
     */
51 1
    public function unbind(string $wechatId = null,  string $userStr = null)
52
    {   
53 1
        return $this->httpPostJson('wxa/unbind_tester', [
54 1
                ($userStr ? 'userstr' : 'wechatid') => $userStr ?? $wechatId,
55
            ]);
56
    }
57
    
58
    public function unbindWithUserStr(string $userStr)
59
    {   
60
        return $this->httpPostJson('wxa/unbind_tester', [
61
                'userstr' => $userStr,
62
            ]);
63
    }
64
65
    /**
66
     * 获取体验者列表.
67
     *
68
     *
69
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
70
     *
71
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
72
     * @throws \GuzzleHttp\Exception\GuzzleException
73
     */
74 1
    public function list()
75
    {
76 1
        return $this->httpPostJson('wxa/memberauth', [
77 1
            'action' => 'get_experiencer',
78
        ]);
79
    }
80
}
81