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
|
|
|
use EasyWeChat\Support\Collection; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Class Session. |
28
|
|
|
*/ |
29
|
|
|
class Session extends AbstractAPI |
30
|
|
|
{ |
31
|
|
|
|
32
|
|
|
const API_CREATE = 'https://api.weixin.qq.com/customservice/kfsession/create'; |
33
|
|
|
const API_CLOSE = 'https://api.weixin.qq.com/customservice/kfsession/close'; |
34
|
|
|
const API_GET = 'https://api.weixin.qq.com/customservice/kfsession/getsession'; |
35
|
|
|
const API_LISTS = 'https://api.weixin.qq.com/customservice/kfsession/getsessionlist'; |
36
|
|
|
const API_WAITERS = 'https://api.weixin.qq.com/customservice/kfsession/getwaitcase'; |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* List all sessions of $account. |
41
|
|
|
* |
42
|
|
|
* @param string $account |
43
|
|
|
* |
44
|
|
|
* @return array |
45
|
|
|
*/ |
46
|
1 |
|
public function lists($account) |
47
|
|
|
{ |
48
|
1 |
|
return $this->parseJSON('get', [self::API_LISTS, ['kf_account' => $account]]); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* List all waiters of $account. |
53
|
|
|
* |
54
|
|
|
* @return array |
55
|
|
|
*/ |
56
|
1 |
|
public function waiters() |
57
|
|
|
{ |
58
|
1 |
|
return $this->parseJSON('get', [self::API_WAITERS]); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Create a session. |
63
|
|
|
* |
64
|
|
|
* @param string $account |
65
|
|
|
* @param string $openid |
|
|
|
|
66
|
|
|
* |
67
|
|
|
* @return bool |
68
|
|
|
*/ |
69
|
1 |
View Code Duplication |
public function create($account, $openId) |
70
|
|
|
{ |
71
|
|
|
$params = [ |
72
|
1 |
|
'kf_account' => $account, |
73
|
1 |
|
'openid' => $openId, |
74
|
1 |
|
]; |
75
|
|
|
|
76
|
1 |
|
return $this->parseJSON('json', [self::API_CREATE, $params]); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Close a session. |
81
|
|
|
* |
82
|
|
|
* @param string $account |
83
|
|
|
* @param string $openId |
84
|
|
|
* |
85
|
|
|
* @return bool |
86
|
|
|
*/ |
87
|
1 |
View Code Duplication |
public function close($account, $openId) |
88
|
|
|
{ |
89
|
|
|
$params = [ |
90
|
1 |
|
'kf_account' => $account, |
91
|
1 |
|
'openid' => $openId, |
92
|
1 |
|
]; |
93
|
|
|
|
94
|
1 |
|
return $this->parseJSON('json', [self::API_CLOSE, $params]); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Get a session. |
99
|
|
|
* |
100
|
|
|
* @param string $openId |
101
|
|
|
* |
102
|
|
|
* @return bool |
103
|
|
|
*/ |
104
|
1 |
|
public function get($openId) |
105
|
|
|
{ |
106
|
1 |
|
return $this->parseJSON('get', [self::API_GET, ['openid' => $openId]]); |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|
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.