File tree Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ class DingtalkRobot
38
38
*/
39
39
public function __construct ()
40
40
{
41
- $ this ->connection ();
41
+ $ this ->robot ();
42
42
}
43
43
44
44
/**
@@ -49,12 +49,12 @@ public function __construct()
49
49
* @return $this
50
50
* @throws \Exception
51
51
*/
52
- public function connection ($ name = 'default ' ): self
52
+ public function robot ($ name = 'default ' ): self
53
53
{
54
54
$ configs = config ('dingtalk_robot ' );
55
55
56
56
if (!isset ($ configs [$ name ])) {
57
- throw new InvalidConfigurationException ("Connection name: {$ name } not exist. Please check your setting in dingtalk_robot.php " );
57
+ throw new InvalidConfigurationException ("Robot name: {$ name } not exist. Please check your setting in dingtalk_robot.php " );
58
58
}
59
59
60
60
$ this ->config = $ configs [$ name ];
@@ -74,7 +74,7 @@ public function connection($name = 'default'): self
74
74
public function setMessage (Message $ message ): self
75
75
{
76
76
$ this ->message = $ message ;
77
- $ this ->connection ($ message ->getConnection ());
77
+ $ this ->robot ($ message ->getRobot ());
78
78
return $ this ;
79
79
}
80
80
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ abstract class Message
17
17
protected $ at = [];
18
18
19
19
// 设置机器人名称,默认为 default
20
- protected $ connection = 'default ' ;
20
+ protected $ robot = 'default ' ;
21
21
22
22
23
23
/**
@@ -33,13 +33,13 @@ public function getMessage(): array
33
33
/**
34
34
* 设置接受消息的机器人名称
35
35
*
36
- * @param $connection
36
+ * @param $robot
37
37
*
38
38
* @return Message
39
39
*/
40
- public function setConnection ( $ connection ): self
40
+ public function setRobot ( $ robot ): self
41
41
{
42
- $ this ->connection = $ connection ;
42
+ $ this ->robot = $ robot ;
43
43
return $ this ;
44
44
}
45
45
@@ -48,8 +48,8 @@ public function setConnection($connection): self
48
48
*
49
49
* @return string
50
50
*/
51
- public function getConnection (): string
51
+ public function getRobot (): string
52
52
{
53
- return $ this ->connection ;
53
+ return $ this ->robot ;
54
54
}
55
55
}
Original file line number Diff line number Diff line change 7
7
* 获取钉钉群机器人接口
8
8
*
9
9
* @return DingtalkRobot
10
+ * @throws Exception
10
11
*/
11
12
function dingtalk_robot ()
12
13
{
13
14
$ arguments = func_get_args ();
14
15
16
+ /** @var DingtalkRobot $dingTalk */
15
17
$ dingTalk = app (DingtalkRobot::class);
16
18
17
19
if (empty ($ arguments )) {
18
20
return $ dingTalk ;
19
21
}
20
22
21
- return $ dingTalk ->connection ($ arguments [0 ]);
23
+ return $ dingTalk ->robot ($ arguments [0 ]);
22
24
}
23
25
}
You can’t perform that action at this time.
0 commit comments