From 37840f0dd8617ca5f1b885566ed6f824ad261046 Mon Sep 17 00:00:00 2001 From: asundust Date: Sun, 4 Jul 2021 01:42:48 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Http/Actions/SendTestMessage.php | 6 ++--- src/Http/Traits/SendMessageTrait.php | 25 +++++++++--------- .../Traits/WechatWorkPushSendMessageTrait.php | 26 +++++++++---------- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/Http/Actions/SendTestMessage.php b/src/Http/Actions/SendTestMessage.php index 71e9ead..14886e3 100644 --- a/src/Http/Actions/SendTestMessage.php +++ b/src/Http/Actions/SendTestMessage.php @@ -41,12 +41,12 @@ public function handle(WechatWorkPushUserModel $user) $type = '默认'; } - $title = '当前使用的【' . $type . '配置】企业微信通道发送的测试消息'; + $title = '当前使用的【'.$type.'配置】企业微信通道发送的测试消息'; $result = $this->send($config, $user->name, $title); if (0 == $result['code']) { - return $this->response()->success('使用【' . $type . '配置】企业微信通道发送消息成功'); + return $this->response()->success('使用【'.$type.'配置】企业微信通道发送消息成功'); } - return $this->response()->success('使用【' . $type . '配置】企业微信通道发送消息失败:' . $result['message']); + return $this->response()->success('使用【'.$type.'配置】企业微信通道发送消息失败:'.$result['message']); } } diff --git a/src/Http/Traits/SendMessageTrait.php b/src/Http/Traits/SendMessageTrait.php index d7aede6..2a76c05 100644 --- a/src/Http/Traits/SendMessageTrait.php +++ b/src/Http/Traits/SendMessageTrait.php @@ -6,9 +6,8 @@ use EasyWeChat\Factory; /** - * Trait SendMessageTrait + * Trait SendMessageTrait. * - * @package Asundust\WechatWorkPush\Http\Traits * @deprecated 弃用 请使用WechatWorkPushSendMessageTrait 将在1.1.0版本移除 */ trait SendMessageTrait @@ -16,11 +15,11 @@ trait SendMessageTrait /** * 使用自定配置发送消息. * - * @param array $config 配置 ['corp_id' => 'xxx', 'agent_id' => 'xxx', 'secret' => 'xxx']; - * @param string $name 用户 - * @param string $title 标题 - * @param string|null $content 内容 - * @param string|null $url 链接 + * @param array $config 配置 ['corp_id' => 'xxx', 'agent_id' => 'xxx', 'secret' => 'xxx']; + * @param string $name 用户 + * @param string $title 标题 + * @param string|null $content 内容 + * @param string|null $url 链接 * @param string|null $urlTitle 链接标题 * * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException @@ -30,10 +29,10 @@ public function send(array $config, string $name, string $title, ?string $conten { $message = $title; if ($content) { - $message .= "\n\n" . $content; + $message .= "\n\n".$content; } if ($url) { - $message .= "\n\n" . '' . ($urlTitle ?: $url) . ''; + $message .= "\n\n".''.($urlTitle ?: $url).''; } $messenger = Factory::work($config)->messenger; $result = $messenger->ofAgent($config['agent_id'])->message($message)->toUser($name ?? '@all')->send(); @@ -47,10 +46,10 @@ public function send(array $config, string $name, string $title, ?string $conten /** * 使用默认配置发送消息. * - * @param string $name 用户 - * @param string $title 标题 - * @param string|null $content 内容 - * @param string|null $url 链接 + * @param string $name 用户 + * @param string $title 标题 + * @param string|null $content 内容 + * @param string|null $url 链接 * @param string|null $urlTitle 链接标题 * * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException diff --git a/src/Http/Traits/WechatWorkPushSendMessageTrait.php b/src/Http/Traits/WechatWorkPushSendMessageTrait.php index 382aa31..728bf3c 100644 --- a/src/Http/Traits/WechatWorkPushSendMessageTrait.php +++ b/src/Http/Traits/WechatWorkPushSendMessageTrait.php @@ -6,20 +6,18 @@ use EasyWeChat\Factory; /** - * Trait WechatWorkPushSendMessageTrait - * - * @package Asundust\WechatWorkPush\Http\Traits + * Trait WechatWorkPushSendMessageTrait. */ trait WechatWorkPushSendMessageTrait { /** * 使用自定配置发送消息. * - * @param array $config 配置 ['corp_id' => 'xxx', 'agent_id' => 'xxx', 'secret' => 'xxx']; - * @param string $name 用户 - * @param string $title 标题 - * @param string|null $content 内容 - * @param string|null $url 链接 + * @param array $config 配置 ['corp_id' => 'xxx', 'agent_id' => 'xxx', 'secret' => 'xxx']; + * @param string $name 用户 + * @param string $title 标题 + * @param string|null $content 内容 + * @param string|null $url 链接 * @param string|null $urlTitle 链接标题 * * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException @@ -29,10 +27,10 @@ public function send(array $config, string $name, string $title, ?string $conten { $message = $title; if ($content) { - $message .= "\n\n" . $content; + $message .= "\n\n".$content; } if ($url) { - $message .= "\n\n" . '' . ($urlTitle ?: $url) . ''; + $message .= "\n\n".''.($urlTitle ?: $url).''; } $messenger = Factory::work($config)->messenger; $result = $messenger->ofAgent($config['agent_id'])->message($message)->toUser($name ?? '@all')->send(); @@ -46,10 +44,10 @@ public function send(array $config, string $name, string $title, ?string $conten /** * 使用默认配置发送消息. * - * @param string $name 用户 - * @param string $title 标题 - * @param string|null $content 内容 - * @param string|null $url 链接 + * @param string $name 用户 + * @param string $title 标题 + * @param string|null $content 内容 + * @param string|null $url 链接 * @param string|null $urlTitle 链接标题 * * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException