Total Complexity | 8 |
Total Lines | 74 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
13 | class Blacklist |
||
14 | { |
||
15 | private $app; |
||
16 | |||
17 | private $store; |
||
18 | |||
19 | protected $cacheName = 'blacklist'; |
||
20 | |||
21 | public function __construct(App $app) |
||
31 | } |
||
32 | } |
||
33 | |||
34 | public function getConfig() |
||
35 | { |
||
36 | return $this->app->config->get('jwt.blacklist', []); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * 获取 缓存驱动. |
||
41 | * |
||
42 | * @return void |
||
43 | */ |
||
44 | public function getStore() |
||
45 | { |
||
46 | return $this->app->cache; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * 加入黑名单. |
||
51 | * |
||
52 | * @param Token $token |
||
53 | * |
||
54 | * @return void |
||
55 | */ |
||
56 | public function add(Token $token) |
||
57 | { |
||
58 | if (false === $this->has($token)) { |
||
59 | $claims = $token->getClaims(); |
||
60 | $exp = $claims['exp']->getValue() - time(); |
||
61 | $this->store->push($this->cacheName, (string) $token, $exp); |
||
62 | } |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * 是否存在黑名单. |
||
67 | * |
||
68 | * @param Token $token |
||
69 | * |
||
70 | * @return bool |
||
71 | */ |
||
72 | public function has(Token $token): bool |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * 获取所有黑名单. |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | public function getAll(): array |
||
87 | } |
||
88 | } |
||
89 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()
can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.