TokenStore   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 13
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A saveToken() 0 4 1
A getUidByToken() 0 5 1
1
<?php
2
3
namespace Imanghafoori\TokenizedLogin\TokenStore;
4
5
class TokenStore
6
{
7
    public function saveToken($token, $userId)
8
    {
9
        $ttl = config('tokenized_login.token_ttl');
10
        cache()->set($token.'_2factor_auth', $userId, now()->addSeconds($ttl));
11
    }
12
13
    public function getUidByToken($token)
14
    {
15
        $uid = cache()->pull($token.'_2factor_auth');
16
17
        return nullable($uid);
18
    }
19
}
20