GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#180)
by Rias
01:22
created

ResponseCacheRepository::putKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Spatie\ResponseCache;
4
5
use Illuminate\Cache\Repository;
6
use Symfony\Component\HttpFoundation\Response;
7
8
class ResponseCacheRepository
9
{
10
    /** @var \Illuminate\Cache\Repository */
11
    protected $cache;
12
13
    /** @var \Spatie\ResponseCache\ResponseSerializer */
14
    protected $responseSerializer;
15
16
    public function __construct(ResponseSerializer $responseSerializer, Repository $cache)
17
    {
18
        $this->cache = $cache;
19
        $this->responseSerializer = $responseSerializer;
20
    }
21
22
    /**
23
     * @param string $key
24
     * @param \Symfony\Component\HttpFoundation\Response $response
25
     * @param \DateTime|int $seconds
26
     */
27
    public function put(string $key, $response, $seconds): void
28
    {
29
        $this->cache->put($key, $this->responseSerializer->serialize($response), $seconds);
30
    }
31
32
    public function putKey(string $key, $value, $seconds): void
33
    {
34
        $this->cache->put($key, $value, $seconds);
35
    }
36
37
    public function has(string $key): bool
38
    {
39
        return $this->cache->has($key);
40
    }
41
42
    public function get(string $key): Response
43
    {
44
        return $this->responseSerializer->unserialize($this->cache->get($key));
45
    }
46
47
    public function getKey(string $key): string
48
    {
49
        return $this->cache->get($key, '');
50
    }
51
52
    /**
53
     * @deprecated Use the new clear method, this is just an alias.
54
     */
55
    public function flush()
56
    {
57
        $this->clear();
58
    }
59
60
    public function clear()
61
    {
62
        $this->cache->flush();
63
    }
64
65
    public function forget(string $key): bool
66
    {
67
        return $this->cache->forget($key);
68
    }
69
}
70