TokenStore::getUidByToken()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 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