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
02:25
created

BaseCacheProfile::replacers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Spatie\ResponseCache\CacheProfiles;
4
5
use DateTime;
6
use Carbon\Carbon;
7
use Illuminate\Http\Request;
8
use Illuminate\Support\Facades\Auth;
9
10
abstract class BaseCacheProfile implements CacheProfile
11
{
12
    public function enabled(Request $request): bool
13
    {
14
        return config('responsecache.enabled');
15
    }
16
17
    /*
18
     * Return the time when the cache must be invalided.
19
     */
20
    public function cacheRequestUntil(Request $request): DateTime
21
    {
22
        return Carbon::now()->addSeconds(
23
            config('responsecache.cache_lifetime_in_seconds')
24
        );
25
    }
26
27
    /*
28
     * Set a string to add to differentiate this request from others.
29
     */
30
    public function cacheNameSuffix(Request $request): string
31
    {
32
        if (Auth::check()) {
33
            return Auth::user()->id;
34
        }
35
36
        return '';
37
    }
38
39
    public function isRunningInConsole(): bool
40
    {
41
        if (app()->environment('testing')) {
42
            return false;
43
        }
44
45
        return app()->runningInConsole();
46
    }
47
48
    public function replacers(Request $request): array
49
    {
50
        return [
51
            'csrf_token' => function () {
52
                return csrf_token() ?? '';
53
            },
54
        ];
55
    }
56
}
57