| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 2.3149 |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | 6 | public function add(Payload $payload) |
|
| 29 | { |
||
| 30 | 6 | $exp = Utils::timestamp($payload['exp']); |
|
| 31 | |||
| 32 | // there is no need to add the token to the blacklist |
||
| 33 | // if the token has already expired |
||
| 34 | 6 | if ($exp->isPast()) { |
|
| 35 | 6 | return false; |
|
| 36 | } |
||
| 37 | |||
| 38 | // add a minute to abate potential overlap |
||
| 39 | $minutes = $exp->diffInMinutes(Utils::now()->subMinute()); |
||
| 40 | |||
| 41 | $this->storage->add($payload['jti'], [], $minutes); |
||
| 42 | |||
| 43 | return true; |
||
| 44 | } |
||
| 45 | |||
| 80 |