Skip to content

Commit 3416763

Browse files
committed
139行代码多了一个分号
1 parent cc89f6f commit 3416763

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

src/Jwt.php

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -127,23 +127,25 @@ public function parse(string $token)
127127
}
128128

129129
/**
130-
* 根据$type获取请求token
130+
* 根据$type获取请求token.
131+
*
131132
* @return false|mixed|string
132133
*/
133-
public function getRequestToken(){
134-
switch ($this->type){
135-
case 'Bearer': {
134+
public function getRequestToken()
135+
{
136+
switch ($this->type) {
137+
case 'Bearer':
136138
$authorization = request()->header('authorization');
137-
$token = strpos($authorization, 'Bearer ') !== 0?false:substr($authorization, 7);
138-
};break;
139+
$token = strpos($authorization, 'Bearer ') !== 0 ? false : substr($authorization, 7); break;
139140
case 'Cookie':$token = Cookie::get('token'); break;
140-
case 'Url': $token = request()->param('token');break;
141-
default:$token = request()->param('token');break;
141+
case 'Url': $token = request()->param('token'); break;
142+
default:$token = request()->param('token'); break;
142143
}
143144

144-
if (! $token) {
145-
throw new JwtException('获取Token失败.',500);
145+
if (!$token) {
146+
throw new JwtException('获取Token失败.', 500);
146147
}
148+
147149
return $token;
148150
}
149151

@@ -154,10 +156,10 @@ public function getRequestToken(){
154156
*
155157
* @return bool
156158
*/
157-
public function verify(string $token='')
159+
public function verify(string $token = '')
158160
{
159161
// 自动获取请求token
160-
if ($token==''){
162+
if ($token == '') {
161163
$token = $this->getRequestToken();
162164
}
163165

@@ -375,11 +377,14 @@ public function user()
375377
}
376378

377379
/**
378-
* 获取用户uid
380+
* 获取用户uid.
381+
*
379382
* @return mixed
380383
*/
381-
public function userId(){
384+
public function userId()
385+
{
382386
$uid = $this->token->getClaim($this->ssoKey());
387+
383388
return $uid;
384389
}
385390

0 commit comments

Comments
 (0)