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 ( 6122da...bfe9a2 )
by Freek
10:18 queued 11s
created

ResponseCacheRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Spatie\ResponseCache;
4
5
use Illuminate\Cache\Repository;
6
use Spatie\ResponseCache\Serializers\Serializer;
7
use Symfony\Component\HttpFoundation\Response;
8
9
class ResponseCacheRepository
10
{
11
    protected Repository $cache;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
12
13
    protected Serializer $responseSerializer;
14
15
    public function __construct(Serializer $responseSerializer, Repository $cache)
16
    {
17
        $this->cache = $cache;
18
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)
28
    {
29
        $this->cache->put($key, $this->responseSerializer->serialize($response), is_numeric($seconds) ? now()->addSeconds($seconds) : $seconds);
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
    public function clear()
43
    {
44
        $this->cache->clear();
45
    }
46
47
    public function forget(string $key): bool
48
    {
49
        return $this->cache->forget($key);
50
    }
51
52
    public function tags(array $tags): self
53
    {
54
        return new self($this->responseSerializer, $this->cache->tags($tags));
55
    }
56
}
57