Total Complexity | 4 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | class LaravelCacheAccessTokenCacher implements AccessTokenCacher |
||
10 | { |
||
11 | /** @var string */ |
||
12 | protected $key; |
||
13 | |||
14 | /** @var Cache */ |
||
15 | protected $cache; |
||
16 | |||
17 | /** |
||
18 | * LaravelCacheAccessTokenCacher constructor. |
||
19 | * @param Cache $cache |
||
20 | * @param string $key |
||
21 | */ |
||
22 | 2 | public function __construct(Cache $cache, string $key = 'iprosoftware-api-access-token') |
|
23 | { |
||
24 | 2 | $this->key = $key; |
|
25 | 2 | $this->cache = $cache; |
|
26 | } |
||
27 | |||
28 | /** |
||
29 | * Store an item in the cache. |
||
30 | * |
||
31 | * @param mixed $accessToken |
||
32 | * @param int $ttl - time in seconds |
||
33 | * |
||
34 | * @return bool |
||
35 | * @static |
||
36 | */ |
||
37 | 1 | public function put(AccessToken $accessToken, int $ttl = null) |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * Retrieve an item from the cache by key. |
||
44 | * |
||
45 | * @return \IproSoftwareApi\Contracts\AccessToken|null |
||
46 | * @static |
||
47 | */ |
||
48 | 1 | public function get(): ?AccessToken |
|
55 |