This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace EntWeChat\User; |
||
4 | |||
5 | use EntWeChat\Core\AbstractAPI; |
||
6 | |||
7 | /** |
||
8 | * Class User. |
||
9 | */ |
||
10 | class User extends AbstractAPI |
||
11 | { |
||
12 | const API_CREATE = 'https://qyapi.weixin.qq.com/cgi-bin/user/create'; |
||
13 | const API_UPDATE = 'https://qyapi.weixin.qq.com/cgi-bin/user/update'; |
||
14 | const API_DELETE = 'https://qyapi.weixin.qq.com/cgi-bin/user/delete'; |
||
15 | const API_BATCH_DELETE = 'https://qyapi.weixin.qq.com/cgi-bin/user/batchdelete'; |
||
16 | const API_GET = 'https://qyapi.weixin.qq.com/cgi-bin/user/get'; |
||
17 | const API_BATCH_GET = 'https://qyapi.weixin.qq.com/cgi-bin/user/simplelist'; |
||
18 | const API_LIST = 'https://qyapi.weixin.qq.com/cgi-bin/user/list'; |
||
19 | const API_TO_OPENID = 'https://qyapi.weixin.qq.com/cgi-bin/user/convert_to_openid'; |
||
20 | const API_TO_USERID = 'https://qyapi.weixin.qq.com/cgi-bin/user/convert_to_userid'; |
||
21 | |||
22 | /** |
||
23 | * Fetch a user by user id. |
||
24 | * |
||
25 | * @param string $userId |
||
26 | * |
||
27 | * @return array |
||
28 | */ |
||
29 | View Code Duplication | public function get($userId) |
|
0 ignored issues
–
show
|
|||
30 | { |
||
31 | $params = [ |
||
32 | 'userid' => $userId, |
||
33 | ]; |
||
34 | |||
35 | return $this->parseJSON('get', [self::API_GET, $params]); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Batch get users. |
||
40 | * |
||
41 | * @param int $departmentId |
||
42 | * @param int|null $fetchChild |
||
43 | * @param int|null $status |
||
44 | * |
||
45 | * @return \EntWeChat\Support\Collection |
||
46 | */ |
||
47 | View Code Duplication | public function batchGet($departmentId, $fetchChild = null, $status = null) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
48 | { |
||
49 | $params = [ |
||
50 | 'department_id' => $departmentId, |
||
51 | 'fetch_child' => $fetchChild, |
||
52 | 'status' => $status, |
||
53 | ]; |
||
54 | |||
55 | return $this->parseJSON('get', [self::API_BATCH_GET, $params]); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * List users. |
||
60 | * |
||
61 | * @param int $departmentId |
||
62 | * @param int|null $fetchChild |
||
63 | * @param int|null $status |
||
64 | * |
||
65 | * @return \EntWeChat\Support\Collection |
||
66 | */ |
||
67 | View Code Duplication | public function lists($departmentId, $fetchChild = null, $status = null) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
68 | { |
||
69 | $params = [ |
||
70 | 'department_id' => $departmentId, |
||
71 | 'fetch_child' => $fetchChild, |
||
72 | 'status' => $status, |
||
73 | ]; |
||
74 | |||
75 | return $this->parseJSON('get', [self::API_LIST, $params]); |
||
76 | } |
||
77 | |||
78 | /** |
||
79 | * Create a user. |
||
80 | * |
||
81 | * @param array $userInfo |
||
82 | * |
||
83 | * @return \EntWeChat\Support\Collection |
||
84 | */ |
||
85 | public function create(array $userInfo = []) |
||
86 | { |
||
87 | $params = $userInfo; |
||
88 | |||
89 | return $this->parseJSON('json', [self::API_CREATE, $params]); |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * Update a user. |
||
94 | * |
||
95 | * @param string $userId |
||
96 | * @param array $userInfo |
||
97 | * |
||
98 | * @return \EntWeChat\Support\Collection |
||
99 | */ |
||
100 | public function update($userId, array $userInfo = []) |
||
101 | { |
||
102 | $params = array_merge($userInfo, ['userid' => $userId]); |
||
103 | |||
104 | return $this->parseJSON('json', [self::API_UPDATE, $params]); |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * Delete a user. |
||
109 | * |
||
110 | * @param string $userId |
||
111 | * |
||
112 | * @return \EntWeChat\Support\Collection |
||
113 | */ |
||
114 | public function delete($userId) |
||
115 | { |
||
116 | $params = ['userid' => $userId]; |
||
117 | |||
118 | return $this->parseJSON('json', [self::API_DELETE, $params]); |
||
119 | } |
||
120 | |||
121 | /** |
||
122 | * Batch delete users. |
||
123 | * |
||
124 | * @param array $userIds |
||
125 | * |
||
126 | * @return \EntWeChat\Support\Collection |
||
127 | */ |
||
128 | public function batchDelete(array $userIds) |
||
129 | { |
||
130 | $params = ['useridlist' => $userIds]; |
||
131 | |||
132 | return $this->parseJSON('json', [self::API_BATCH_DELETE, $params]); |
||
133 | } |
||
134 | |||
135 | /** |
||
136 | * Convert userid to openid. |
||
137 | * |
||
138 | * @param string $userId |
||
139 | * @param int $agentId |
||
140 | * |
||
141 | * @return \EntWeChat\Support\Collection |
||
142 | */ |
||
143 | View Code Duplication | public function toOpenId($userId, $agentId) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
144 | { |
||
145 | $params = [ |
||
146 | 'userid' => $userId, |
||
147 | 'agentid' => $agentId, |
||
148 | ]; |
||
149 | |||
150 | return $this->parseJSON('json', [self::API_TO_OPENID, $params]); |
||
151 | } |
||
152 | |||
153 | /** |
||
154 | * Convert openid to userid. |
||
155 | * |
||
156 | * @param string $openId |
||
157 | * |
||
158 | * @return \EntWeChat\Support\Collection |
||
159 | */ |
||
160 | public function toUserId($openId) |
||
161 | { |
||
162 | $params = ['openid' => $openId]; |
||
163 | |||
164 | return $this->parseJSON('json', [self::API_TO_USERID, $params]); |
||
165 | } |
||
166 | } |
||
167 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.