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 (#189)
by Rias
01:46
created

CsrfTokenReplacer::transformInitialResponse()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Spatie\ResponseCache\Replacers;
4
5
use Symfony\Component\HttpFoundation\Response;
6
7
class CsrfTokenReplacer implements Replacer
8
{
9
    public function replacedBy(): string
10
    {
11
        return '<csrf-token-here>';
12
    }
13
14
    public function transformInitialResponse(Response $response): void
15
    {
16
        if ($response->getContent()) {
17
            $response->setContent(str_replace(
18
                csrf_token(),
19
                $this->replacedBy(),
20
                $response->getContent()
21
            ));
22
        }
23
    }
24
25
    public function replaceCachedResponse(Response $response): void
26
    {
27
        if ($response->getContent()) {
28
            $response->setContent(str_replace(
29
                $this->replacedBy(),
30
                csrf_token(),
31
                $response->getContent()
32
            ));
33
        }
34
    }
35
}
36