Completed
Push — master ( d63ff6...b9e7b2 )
by mingyoung
01:36
created

Client   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 71
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 4 1
A set() 0 4 1
A add() 0 4 1
A delete() 0 4 1
A modify() 0 12 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\OpenPlatform\Authorizer\MiniProgram\Domain;
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
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
25
     */
26
    public function get()
27
    {
28
        return $this->modify('get');
29
    }
30
31
    /**
32
     * @param array $request
33
     * @param array $wsRequest
34
     * @param array $upload
35
     * @param array $download
36
     *
37
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
38
     */
39
    public function set(array $request, array $wsRequest, array $upload, array $download)
40
    {
41
        return $this->modify('set', $request, $wsRequest, $upload, $download);
42
    }
43
44
    /**
45
     * @param array $request
46
     * @param array $wsRequest
47
     * @param array $upload
48
     * @param array $download
49
     *
50
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
51
     */
52
    public function add(array $request, array $wsRequest, array $upload, array $download)
53
    {
54
        return $this->modify('add', $request, $wsRequest, $upload, $download);
55
    }
56
57
    /**
58
     * @param array $request
59
     * @param array $wsRequest
60
     * @param array $upload
61
     * @param array $download
62
     *
63
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
64
     */
65
    public function delete(array $request, array $wsRequest, array $upload, array $download)
66
    {
67
        return $this->modify('delete', $request, $wsRequest, $upload, $download);
68
    }
69
70
    /**
71
     * @param string $action
72
     * @param array  $request
73
     * @param array  $wsRequest
74
     * @param array  $upload
75
     * @param array  $download
76
     *
77
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
78
     */
79
    protected function modify(string $action, array $request = [], array $wsRequest = [], array $upload = [], array $download = [])
80
    {
81
        $params = array_filter([
82
            'action' => $action,
83
            'requestdomain' => $request,
84
            'wsrequestdomain' => $wsRequest,
85
            'uploaddomain' => $upload,
86
            'downloaddomain' => $download,
87
        ]);
88
89
        return $this->httpPostJson('wxa/modify_domain', $params);
90
    }
91
}
92