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
Push — master ( 4ab2fc...713bcd )
by Freek
03:29
created

ResponseCacheRepository::put()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
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 $minutes
26
     */
27
    public function put(string $key, $response, $minutes)
28
    {
29
        $this->cache->put($key, $this->responseSerializer->serialize($response), $minutes);
30
    }
31
32
    public function has(string $key): bool
33
    {
34
        return $this->cache->has($key);
35
    }
36
37
    public function get(string $key): Response
38
    {
39
        return $this->responseSerializer->unserialize($this->cache->get($key));
40
    }
41
42
    /**
43
     * @deprecated Use the new clear method, this is just an alias.
44
     */
45
    public function flush()
46
    {
47
        $this->clear();
48
    }
49
50
    public function clear()
51
    {
52
        $this->cache->clear();
53
    }
54
55
    public function forget(string $key): bool
56
    {
57
        return $this->cache->forget($key);
58
    }
59
}
60