Passed
Push — master ( 38df65...71589f )
by ma
01:47
created
src/Gateways/Alipay.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             $this->AuthorizeURL = str_replace("alipay", "alipaydev", $this->AuthorizeURL);
82 82
         }
83 83
 
84
-        return $this->AuthorizeURL . '?' . http_build_query($params);
84
+        return $this->AuthorizeURL.'?'.http_build_query($params);
85 85
     }
86 86
 
87 87
     /**
@@ -114,16 +114,16 @@  discard block
 block discarded – undo
114 114
 
115 115
         $userInfo = [
116 116
             'open_id'  => $this->openid(),
117
-            'union_id'  => $this->token['union_id']??'',
117
+            'union_id'  => $this->token['union_id'] ?? '',
118 118
             'channel' => ConstCode::TYPE_ALIPAY,
119 119
             'nickname'    => $result['nick_name'],
120 120
             'gender'  => isset($result['gender']) ? $this->getGender($result['gender']) : ConstCode::GENDER,
121 121
             'avatar'  => $result['avatar'],
122 122
             // 拓展字段
123
-            'access_token'  => $this->token['access_token']??'',
123
+            'access_token'  => $this->token['access_token'] ?? '',
124 124
             'user_id'  => $this->token['user_id'],
125 125
         ];
126
-        $userInfo['type'] = ConstCode::getTypeConst($userInfo['channel'],$this->type);
126
+        $userInfo['type'] = ConstCode::getTypeConst($userInfo['channel'], $this->type);
127 127
         return $userInfo;
128 128
     }
129 129
 
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function getUserInfo()
138 138
     {
139
-        if($this->type == 'app'){//App登录
140
-            if(!isset($_REQUEST['access_token']) ){
139
+        if ($this->type == 'app') {//App登录
140
+            if (!isset($_REQUEST['access_token'])) {
141 141
                 throw new \Exception("AliPay APP登录 需要传输access_token参数! ");
142 142
             }
143 143
             $this->token['access_token'] = $_REQUEST['access_token'];
144
-        }else {
144
+        } else {
145 145
             /** 获取token信息 */
146 146
             $this->getToken();
147 147
         }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
         $data = $this->post(self::API_BASE, $params);
161 161
         $data = mb_convert_encoding($data, 'utf-8', 'gbk');
162
-        $result =  json_decode($data, true);
162
+        $result = json_decode($data, true);
163 163
         return $result['alipay_user_info_share_response'];
164 164
     }
165 165
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             throw new \Exception('支付宝RSA密钥未配置');
237 237
         }
238 238
         $rsa    = str_replace([PHP_EOL, $header, $footer], '', $rsa);
239
-        $rsaVal = $header . PHP_EOL . chunk_split($rsa, 64, PHP_EOL) . $footer;
239
+        $rsaVal = $header.PHP_EOL.chunk_split($rsa, 64, PHP_EOL).$footer;
240 240
         return $rsaVal;
241 241
     }
242 242
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
         if (isset($data['alipay_system_oauth_token_response'])) {
257 257
             $data           = $data['alipay_system_oauth_token_response'];
258
-            $data['openid'] = $data['open_id']??$data['user_id'];
258
+            $data['openid'] = $data['open_id'] ?? $data['user_id'];
259 259
             return $data;
260 260
         } else {
261 261
             throw new \Exception("获取支付宝 ACCESS_TOKEN 出错:{$token}");
Please login to merge, or discard this patch.
src/Helper/Encryptor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
  */
5 5
 namespace tinymeng\OAuth2\Helper;
6 6
 
7
-class Encryptor{
7
+class Encryptor {
8 8
 
9 9
     /**
10 10
      * 解密数据(微信小程序手机号)
Please login to merge, or discard this patch.