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 ( 02f07d...0e7d0b )
by Freek
01:47
created

CsrfTokenReplacer::prepareResponseToCache()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
rs 9.8666
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
    protected $replacementString = '<laravel-responsecache-csrf-token-here>';
10
11 View Code Duplication
    public function prepareResponseToCache(Response $response): void
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
    {
13
        if (! $response->getContent()) {
14
            return;
15
        }
16
17
        $response->setContent(str_replace(
18
            csrf_token(),
19
            $this->replacementString,
20
            $response->getContent()
21
        ));
22
    }
23
24 View Code Duplication
    public function replaceInCachedResponse(Response $response): void
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
    {
26
        if (! $response->getContent()) {
27
            return;
28
        }
29
30
        $response->setContent(str_replace(
31
            $this->replacementString,
32
            csrf_token(),
33
            $response->getContent()
34
        ));
35
    }
36
}
37