Passed
Push — master ( 1fc1f2...3d1dd5 )
by Dong
03:48 queued 01:48
created
src/QuickSend.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @param  array  $bcc
91 91
      * @return bool|string
92 92
      */
93
-    public static function mail($config,$subject,$body,$to,$attachments = [],$cc = [],$bcc=[])
93
+    public static function mail($config, $subject, $body, $to, $attachments = [], $cc = [], $bcc = [])
94 94
     {
95 95
         $msg = [
96 96
             'type'=>'email',
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
                 'to'=>$to,
102 102
             ],
103 103
         ];
104
-        if (!empty($attachments)){
104
+        if (!empty($attachments)) {
105 105
             $msg['data']['attachments'] = $attachments;
106 106
         }
107
-        if (!empty($cc)){
107
+        if (!empty($cc)) {
108 108
             $msg['data']['cc'] = $cc;
109 109
         }
110
-        if (!empty($bcc)){
110
+        if (!empty($bcc)) {
111 111
             $msg['data']['bcc'] = $bcc;
112 112
         }
113 113
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      * @param  array  $template_param
126 126
      * @return array|string
127 127
      */
128
-    public function alisms($config,$phone,$template_param = [])
128
+    public function alisms($config, $phone, $template_param = [])
129 129
     {
130 130
         $msg = [
131 131
             'type'=>'alisms',
Please login to merge, or discard this patch.
src/sender/AliSms.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
         if (!isset($this->config['accessKeySecret']) || !$this->config['accessKeySecret']) {
53 53
             throw new \Exception("缺失accessKeySecret");
54 54
         }
55
-        if (!isset($this->config['SignName'])){
55
+        if (!isset($this->config['SignName'])) {
56 56
             throw new \Exception("缺失短信签名");
57 57
         }
58 58
         if (empty($this->config['template_code'])) {
Please login to merge, or discard this patch.
src/sender/WechatOffical.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@
 block discarded – undo
31 31
             throw new \Exception('未设置消息内容');
32 32
         }
33 33
         foreach ($msg['data'] as $item) {
34
-            if (!isset($item['value'])){
34
+            if (!isset($item['value'])) {
35 35
                 throw new \Exception("模版消息内容未设置value");
36 36
             }
37 37
         }
38
-        if (isset($msg['miniprogram'])){
39
-            if (!isset($msg['miniprogram']['appid'])){
38
+        if (isset($msg['miniprogram'])) {
39
+            if (!isset($msg['miniprogram']['appid'])) {
40 40
                 throw new \Exception("缺失小程序appId");
41 41
             }
42 42
         }
Please login to merge, or discard this patch.
src/sender/MiniProgram.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
             throw new \Exception('未设置消息内容');
30 30
         }
31 31
         foreach ($msg['data'] as $item) {
32
-            if (!isset($item['value'])){
32
+            if (!isset($item['value'])) {
33 33
                 throw new \Exception("模版消息内容未设置value");
34 34
             }
35 35
         }
Please login to merge, or discard this patch.
src/sender/Email.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
 
72 72
         if (!isset($msg['to'])) {
73 73
             throw new \Exception('收件人未设置');
74
-        }else{
74
+        } else {
75 75
             $msg['to'] = $this->checkEmailAddress($msg['to']);
76 76
         }
77
-        if (isset($msg['cc'])){
77
+        if (isset($msg['cc'])) {
78 78
             $msg['cc'] = $this->checkEmailAddress($msg['cc']);
79 79
         }
80
-        if (isset($msg['bcc'])){
80
+        if (isset($msg['bcc'])) {
81 81
             $msg['bcc'] = $this->checkEmailAddress($msg['bcc']);
82 82
         }
83 83
         if (isset($msg['attachments'])) {
@@ -88,25 +88,25 @@  discard block
 block discarded – undo
88 88
 
89 89
     public function checkEmailAddress($emailAddresses)
90 90
     {
91
-        if (is_string($emailAddresses)){
92
-            if (filter_var($emailAddresses,FILTER_VALIDATE_EMAIL)){
91
+        if (is_string($emailAddresses)) {
92
+            if (filter_var($emailAddresses, FILTER_VALIDATE_EMAIL)) {
93 93
                 return [
94
-                    ['email'=>$emailAddresses,'name'=>$emailAddresses]
94
+                    ['email'=>$emailAddresses, 'name'=>$emailAddresses]
95 95
                 ];
96
-            }else{
96
+            } else {
97 97
                 throw new \Exception("邮箱格式不正确:".$emailAddresses);
98 98
             }
99
-        }elseif (is_array($emailAddresses)){
99
+        }elseif (is_array($emailAddresses)) {
100 100
             foreach ($emailAddresses as &$emailAddress) {
101
-                if (is_string($emailAddress)){
102
-                    $emailAddress = ['email'=>$emailAddress,'name'=>$emailAddress];
101
+                if (is_string($emailAddress)) {
102
+                    $emailAddress = ['email'=>$emailAddress, 'name'=>$emailAddress];
103 103
 
104
-                }else{
105
-                    if (!isset($emailAddress['email'])){
104
+                } else {
105
+                    if (!isset($emailAddress['email'])) {
106 106
                         throw new Exception("缺失邮箱地址[email]");
107 107
                     }
108 108
                 }
109
-                if (!filter_var($emailAddress['email'],FILTER_VALIDATE_EMAIL)){
109
+                if (!filter_var($emailAddress['email'], FILTER_VALIDATE_EMAIL)) {
110 110
                     throw new \Exception("邮箱格式不正确:".$emailAddress);
111 111
                 }
112 112
             }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             ];
131 131
         } elseif (is_array($attachments)) {
132 132
             foreach ($attachments as &$attachment) {
133
-                if (is_string($attachment)){
133
+                if (is_string($attachment)) {
134 134
                     $attachment = [
135 135
                         'filename'=>basename($attachment),
136 136
                         'filepath'=>realpath($attachment),
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                     throw new \Exception('附件不存在:'.$attachment);
141 141
                 }
142 142
             }
143
-        }else{
143
+        } else {
144 144
             throw new \Exception("attachments参数格式错误");
145 145
         }
146 146
         return $attachments;
@@ -159,22 +159,22 @@  discard block
 block discarded – undo
159 159
 
160 160
         try {
161 161
             //Server settings
162
-            $mail->SMTPDebug = $this->config['debug'];  // Enable verbose debug output
163
-            $mail->isSMTP();  // Set mailer to use SMTP
164
-            $mail->Host = $this->config['host'];  // Specify main and backup SMTP servers
165
-            $mail->SMTPAuth = true;  // Enable SMTP authentication
166
-            $mail->Username = $this->config['username'];  // SMTP username
167
-            $mail->Password = $this->config['password'];  // SMTP password
168
-            $mail->SMTPSecure = $this->config['SMTPSecure'];  // Enable TLS encryption, `ssl` also accepted
169
-            $mail->Port = $this->config['port'];  // TCP port to connect to
162
+            $mail->SMTPDebug = $this->config['debug']; // Enable verbose debug output
163
+            $mail->isSMTP(); // Set mailer to use SMTP
164
+            $mail->Host = $this->config['host']; // Specify main and backup SMTP servers
165
+            $mail->SMTPAuth = true; // Enable SMTP authentication
166
+            $mail->Username = $this->config['username']; // SMTP username
167
+            $mail->Password = $this->config['password']; // SMTP password
168
+            $mail->SMTPSecure = $this->config['SMTPSecure']; // Enable TLS encryption, `ssl` also accepted
169
+            $mail->Port = $this->config['port']; // TCP port to connect to
170 170
             $mail->CharSet = 'UTF-8';
171 171
             $mail->SMTPOptions = $this->config['SMTPOptions'];
172 172
             //Recipients
173 173
             $mail->setFrom($this->config['fromEmail'], $this->config['fromName']);
174
-            if (isset($this->config['replyMail'])){
174
+            if (isset($this->config['replyMail'])) {
175 175
                 $mail->setReplyTo($this->config['replyMail']);
176 176
             }
177
-            if (isset($this->config['SMTPOptions'])){
177
+            if (isset($this->config['SMTPOptions'])) {
178 178
                 $mail->SMTPOptions = $this->config['SMTPOptions'];
179 179
             }
180 180
             // touser
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             }
193 193
 
194 194
             // bcc
195
-            if (isset($msg['bcc'])){
195
+            if (isset($msg['bcc'])) {
196 196
                 foreach ($msg['bcc'] as $bc) {
197 197
                     $mail->addBCC($bc['email'], $bc['name']);
198 198
                 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
         if (!isset($msg['to'])) {
73 73
             throw new \Exception('收件人未设置');
74
-        }else{
74
+        } else{
75 75
             $msg['to'] = $this->checkEmailAddress($msg['to']);
76 76
         }
77 77
         if (isset($msg['cc'])){
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
                 return [
94 94
                     ['email'=>$emailAddresses,'name'=>$emailAddresses]
95 95
                 ];
96
-            }else{
96
+            } else{
97 97
                 throw new \Exception("邮箱格式不正确:".$emailAddresses);
98 98
             }
99
-        }elseif (is_array($emailAddresses)){
99
+        } elseif (is_array($emailAddresses)){
100 100
             foreach ($emailAddresses as &$emailAddress) {
101 101
                 if (is_string($emailAddress)){
102 102
                     $emailAddress = ['email'=>$emailAddress,'name'=>$emailAddress];
103 103
 
104
-                }else{
104
+                } else{
105 105
                     if (!isset($emailAddress['email'])){
106 106
                         throw new Exception("缺失邮箱地址[email]");
107 107
                     }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                     throw new \Exception('附件不存在:'.$attachment);
141 141
                 }
142 142
             }
143
-        }else{
143
+        } else{
144 144
             throw new \Exception("attachments参数格式错误");
145 145
         }
146 146
         return $attachments;
Please login to merge, or discard this patch.
src/helper.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@  discard block
 block discarded – undo
6 6
 
7 7
 // 如果没有cache方法就自定义一个方法用redis做缓存
8 8
 if (!function_exists('getAccessToken')) {
9
-    function getAccessToken($type,$appId,$appSecret,$agentid = 0)
9
+    function getAccessToken($type, $appId, $appSecret, $agentid = 0)
10 10
     {
11
-        switch ($type){
11
+        switch ($type) {
12 12
             case 'wechatoffical':
13 13
                 $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appId}&secret={$appSecret}";
14 14
                 break;
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
         }
21 21
         echo $url;
22 22
         $res = Http::get($url);
23
-        if (isset($res['access_token'])){
23
+        if (isset($res['access_token'])) {
24 24
             return $res;
25
-        }else{
25
+        } else {
26 26
             return $res;
27 27
         }
28 28
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
         $res = Http::get($url);
23 23
         if (isset($res['access_token'])){
24 24
             return $res;
25
-        }else{
25
+        } else{
26 26
             return $res;
27 27
         }
28 28
 
Please login to merge, or discard this patch.
src/Notify.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     private static function buildConnector($type)
24 24
     {
25 25
         $type = strtolower($type);
26
-        if ( ! isset(self::$types[$type])) {
26
+        if (!isset(self::$types[$type])) {
27 27
             throw new \Exception('错误的通知类型:'.$type);
28 28
         }
29 29
 
Please login to merge, or discard this patch.