Passed
Push — master ( 99bfc0...d990ad )
by ma
19:38
created
src/Helper/Encryptor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 use tinymeng\OAuth2\Exception\OAuthException;
8 8
 
9
-class Encryptor{
9
+class Encryptor {
10 10
 
11 11
     /**
12 12
      * 解密数据(微信小程序手机号)
Please login to merge, or discard this patch.
src/OAuth.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     protected static function init($gateway, $config)
37 37
     {
38
-        if(empty($config)){
38
+        if (empty($config)) {
39 39
             throw new OAuthException("第三方登录 [$gateway] config配置不能为空");
40 40
         }
41 41
         $baseConfig = [
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
             'scope'     => '',
46 46
             'type'      => '',
47 47
         ];
48
-        if($gateway == 'weixin'){
48
+        if ($gateway == 'weixin') {
49 49
             /** 兼容 tinymeng/oauth v1.0.0完美升级 */
50 50
             $gateway = 'wechat';
51 51
         }
52 52
         $gateway = Str::uFirst($gateway);
53
-        $class = __NAMESPACE__ . '\\Gateways\\' . $gateway;
53
+        $class = __NAMESPACE__.'\\Gateways\\'.$gateway;
54 54
         if (class_exists($class)) {
55
-            $app = new $class(array_replace_recursive($baseConfig,$config));
55
+            $app = new $class(array_replace_recursive($baseConfig, $config));
56 56
             if ($app instanceof GatewayInterface) {
57 57
                 return $app;
58 58
             }
Please login to merge, or discard this patch.
src/Gateways/Xiaomi.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             'state'         => $this->config['state'],
31 31
             'skip_confirm'  => 1,
32 32
         ];
33
-        return $this->AuthorizeURL . '?' . http_build_query($params);
33
+        return $this->AuthorizeURL.'?'.http_build_query($params);
34 34
     }
35 35
 
36 36
     /**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $data = json_decode($data, true);
79 79
         
80 80
         if (!isset($data['result']) || $data['result'] !== 'ok') {
81
-            throw new OAuthException('获取小米用户信息失败:' . json_encode($data));
81
+            throw new OAuthException('获取小米用户信息失败:'.json_encode($data));
82 82
         }
83 83
         return $data['data'];
84 84
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         if (isset($data['access_token'])) {
112 112
             return $data;
113 113
         }
114
-        throw new OAuthException('获取小米 access_token 出错:' . json_encode($data));
114
+        throw new OAuthException('获取小米 access_token 出错:'.json_encode($data));
115 115
     }
116 116
 
117 117
     /**
Please login to merge, or discard this patch.
src/Gateways/Apple.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
         ];
110 110
 
111 111
         $payload = $this->base64UrlEncode(json_encode($headers)) . '.' . 
112
-                  $this->base64UrlEncode(json_encode($claims));
112
+                    $this->base64UrlEncode(json_encode($claims));
113 113
 
114 114
         openssl_sign($payload, $signature, $key, OPENSSL_ALGO_SHA256);
115 115
         
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
             'response_mode' => 'form_post',
29 29
             'state'         => $this->config['state'],
30 30
         ];
31
-        return $this->AuthorizeURL . '?' . http_build_query($params);
31
+        return $this->AuthorizeURL.'?'.http_build_query($params);
32 32
     }
33 33
 
34 34
     /**
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
             'sub' => $this->config['app_id'],
109 109
         ];
110 110
 
111
-        $payload = $this->base64UrlEncode(json_encode($headers)) . '.' . 
111
+        $payload = $this->base64UrlEncode(json_encode($headers)).'.'. 
112 112
                   $this->base64UrlEncode(json_encode($claims));
113 113
 
114 114
         openssl_sign($payload, $signature, $key, OPENSSL_ALGO_SHA256);
115 115
         
116
-        return $payload . '.' . $this->base64UrlEncode($signature);
116
+        return $payload.'.'.$this->base64UrlEncode($signature);
117 117
     }
118 118
 
119 119
     /**
@@ -151,6 +151,6 @@  discard block
 block discarded – undo
151 151
         if (isset($data['access_token'])) {
152 152
             return $data;
153 153
         }
154
-        throw new OAuthException('获取Apple access_token 出错:' . json_encode($data));
154
+        throw new OAuthException('获取Apple access_token 出错:'.json_encode($data));
155 155
     }
156 156
 }
157 157
\ No newline at end of file
Please login to merge, or discard this patch.
src/Gateways/Microsoft.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             'state'         => $this->config['state'],
31 31
             'response_mode' => 'query',
32 32
         ];
33
-        return $this->AuthorizeURL . '?' . http_build_query($params);
33
+        return $this->AuthorizeURL.'?'.http_build_query($params);
34 34
     }
35 35
 
36 36
     /**
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
         $this->getToken();
71 71
         
72 72
         $headers = [
73
-            'Authorization: Bearer ' . $this->token['access_token'],
73
+            'Authorization: Bearer '.$this->token['access_token'],
74 74
         ];
75 75
         
76 76
         $data = $this->get($this->UserInfoURL, [], $headers);
77 77
         $data = json_decode($data, true);
78 78
         
79 79
         if (!isset($data['id'])) {
80
-            throw new OAuthException('获取Microsoft用户信息失败:' . json_encode($data));
80
+            throw new OAuthException('获取Microsoft用户信息失败:'.json_encode($data));
81 81
         }
82 82
         return $data;
83 83
     }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         if (isset($data['access_token'])) {
113 113
             return $data;
114 114
         }
115
-        throw new OAuthException('获取Microsoft access_token 出错:' . json_encode($data));
115
+        throw new OAuthException('获取Microsoft access_token 出错:'.json_encode($data));
116 116
     }
117 117
 
118 118
     /**
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         try {
124 124
             $accessToken = $accessToken ?? $this->token['access_token'];
125 125
             $headers = [
126
-                'Authorization: Bearer ' . $accessToken,
126
+                'Authorization: Bearer '.$accessToken,
127 127
             ];
128 128
             $data = $this->get($this->UserInfoURL, [], $headers);
129 129
             $data = json_decode($data, true);
Please login to merge, or discard this patch.
src/Gateways/Dingtalk.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             'state'         => $this->config['state'] ?: '',
31 31
             'prompt'        => 'consent'
32 32
         ];
33
-        return $this->AuthorizeURL . '?' . http_build_query($params);
33
+        return $this->AuthorizeURL.'?'.http_build_query($params);
34 34
     }
35 35
 
36 36
     /**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $response = json_decode($response, true);
95 95
         
96 96
         if (!isset($response['accessToken'])) {
97
-            throw new OAuthException('获取钉钉 access_token 出错:' . json_encode($response));
97
+            throw new OAuthException('获取钉钉 access_token 出错:'.json_encode($response));
98 98
         }
99 99
         return $response;
100 100
     }
Please login to merge, or discard this patch.
src/Gateways/Huawei.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             'state'         => $this->config['state'],
31 31
             'access_type'   => 'offline',
32 32
         ];
33
-        return $this->AuthorizeURL . '?' . http_build_query($params);
33
+        return $this->AuthorizeURL.'?'.http_build_query($params);
34 34
     }
35 35
 
36 36
     /**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         $data = json_decode($data, true);
80 80
         
81 81
         if (!isset($data['displayName'])) {
82
-            throw new OAuthException('获取华为用户信息失败:' . json_encode($data));
82
+            throw new OAuthException('获取华为用户信息失败:'.json_encode($data));
83 83
         }
84 84
         return $data;
85 85
     }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         if (isset($data['access_token'])) {
113 113
             return $data;
114 114
         }
115
-        throw new OAuthException('获取华为 access_token 出错:' . json_encode($data));
115
+        throw new OAuthException('获取华为 access_token 出错:'.json_encode($data));
116 116
     }
117 117
 
118 118
     /**
Please login to merge, or discard this patch.
src/Gateways/Kuaishou.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             'scope'         => $this->config['scope'] ?: 'user_info',
30 30
             'state'         => $this->config['state'] ?: '',
31 31
         ];
32
-        return $this->AuthorizeURL . '?' . http_build_query($params);
32
+        return $this->AuthorizeURL.'?'.http_build_query($params);
33 33
     }
34 34
 
35 35
     /**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $data = json_decode($data, true);
79 79
         
80 80
         if (!isset($data['result'])) {
81
-            throw new OAuthException('获取快手用户信息失败:' . json_encode($data));
81
+            throw new OAuthException('获取快手用户信息失败:'.json_encode($data));
82 82
         }
83 83
         return $data['result'];
84 84
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $response = json_decode($response, true);
100 100
         
101 101
         if (!isset($response['access_token'])) {
102
-            throw new OAuthException('获取快手 access_token 出错:' . json_encode($response));
102
+            throw new OAuthException('获取快手 access_token 出错:'.json_encode($response));
103 103
         }
104 104
         return $response;
105 105
     }
Please login to merge, or discard this patch.
src/Gateways/Wecom.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
             'redirect_uri'  => $this->config['callback'],
28 28
             'state'         => $this->config['state'] ?: '',
29 29
         ];
30
-        return $this->AuthorizeURL . '?' . http_build_query($params);
30
+        return $this->AuthorizeURL.'?'.http_build_query($params);
31 31
     }
32 32
 
33 33
     /**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $data = json_decode($data, true);
77 77
         
78 78
         if (!isset($data['userid'])) {
79
-            throw new OAuthException('获取企业微信用户信息失败:' . json_encode($data));
79
+            throw new OAuthException('获取企业微信用户信息失败:'.json_encode($data));
80 80
         }
81 81
         return $data;
82 82
     }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $response = json_decode($response, true);
96 96
         
97 97
         if (!isset($response['access_token'])) {
98
-            throw new OAuthException('获取企业微信 access_token 出错:' . json_encode($response));
98
+            throw new OAuthException('获取企业微信 access_token 出错:'.json_encode($response));
99 99
         }
100 100
         return $response;
101 101
     }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             ];
114 114
             $data = $this->get($this->UserInfoURL, $params);
115 115
             $data = json_decode($data, true);
116
-            return $data['errcode'] === 40029;  // 无效的code但token有效
116
+            return $data['errcode'] === 40029; // 无效的code但token有效
117 117
         } catch (\Exception $e) {
118 118
             return false;
119 119
         }
Please login to merge, or discard this patch.