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
|
|
|
/** |
13
|
|
|
* Session.php. |
14
|
|
|
* |
15
|
|
|
* @author overtrue <[email protected]> |
16
|
|
|
* @copyright 2015 overtrue <[email protected]> |
17
|
|
|
* |
18
|
|
|
* @link https://github.com/overtrue |
19
|
|
|
* @link http://overtrue.me |
20
|
|
|
*/ |
21
|
|
|
namespace EasyWeChat\Staff; |
22
|
|
|
|
23
|
|
|
use EasyWeChat\Core\AbstractAPI; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Class Session. |
27
|
|
|
*/ |
28
|
|
|
class Session extends AbstractAPI |
29
|
|
|
{ |
30
|
|
|
const API_CREATE = 'https://api.weixin.qq.com/customservice/kfsession/create'; |
31
|
|
|
const API_CLOSE = 'https://api.weixin.qq.com/customservice/kfsession/close'; |
32
|
|
|
const API_GET = 'https://api.weixin.qq.com/customservice/kfsession/getsession'; |
33
|
|
|
const API_LISTS = 'https://api.weixin.qq.com/customservice/kfsession/getsessionlist'; |
34
|
|
|
const API_WAITERS = 'https://api.weixin.qq.com/customservice/kfsession/getwaitcase'; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* List all sessions of $account. |
38
|
|
|
* |
39
|
|
|
* @param string $account |
40
|
|
|
* |
41
|
|
|
* @return array |
42
|
|
|
*/ |
43
|
1 |
|
public function lists($account) |
44
|
|
|
{ |
45
|
1 |
|
return $this->parseJSON('get', [self::API_LISTS, ['kf_account' => $account]]); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* List all waiters of $account. |
50
|
|
|
* |
51
|
|
|
* @return array |
52
|
|
|
*/ |
53
|
1 |
|
public function waiters() |
54
|
|
|
{ |
55
|
1 |
|
return $this->parseJSON('get', [self::API_WAITERS]); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Create a session. |
60
|
|
|
* |
61
|
|
|
* @param string $account |
62
|
|
|
* @param string $openid |
|
|
|
|
63
|
|
|
* |
64
|
|
|
* @return bool |
65
|
|
|
*/ |
66
|
1 |
View Code Duplication |
public function create($account, $openId) |
67
|
|
|
{ |
68
|
|
|
$params = [ |
69
|
1 |
|
'kf_account' => $account, |
70
|
1 |
|
'openid' => $openId, |
71
|
1 |
|
]; |
72
|
|
|
|
73
|
1 |
|
return $this->parseJSON('json', [self::API_CREATE, $params]); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Close a session. |
78
|
|
|
* |
79
|
|
|
* @param string $account |
80
|
|
|
* @param string $openId |
81
|
|
|
* |
82
|
|
|
* @return bool |
83
|
|
|
*/ |
84
|
1 |
View Code Duplication |
public function close($account, $openId) |
85
|
|
|
{ |
86
|
|
|
$params = [ |
87
|
1 |
|
'kf_account' => $account, |
88
|
1 |
|
'openid' => $openId, |
89
|
1 |
|
]; |
90
|
|
|
|
91
|
1 |
|
return $this->parseJSON('json', [self::API_CLOSE, $params]); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Get a session. |
96
|
|
|
* |
97
|
|
|
* @param string $openId |
98
|
|
|
* |
99
|
|
|
* @return bool |
100
|
|
|
*/ |
101
|
1 |
|
public function get($openId) |
102
|
|
|
{ |
103
|
1 |
|
return $this->parseJSON('get', [self::API_GET, ['openid' => $openId]]); |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.