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.

BaseCacheProfile   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 30
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A enabled() 0 4 1
A cacheRequestUntil() 0 6 1
A useCacheNameSuffix() 0 6 2
A isRunningInConsole() 0 8 2
1
<?php
2
3
namespace Spatie\ResponseCache\CacheProfiles;
4
5
use Carbon\Carbon;
6
use DateTime;
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
    public function cacheRequestUntil(Request $request): DateTime
18
    {
19
        return Carbon::now()->addSeconds(
20
            config('responsecache.cache_lifetime_in_seconds')
21
        );
22
    }
23
24
    public function useCacheNameSuffix(Request $request): string
25
    {
26
        return Auth::check()
27
            ? (string) Auth::id()
28
            : '';
29
    }
30
31
    public function isRunningInConsole(): bool
32
    {
33
        if (app()->environment('testing')) {
34
            return false;
35
        }
36
37
        return app()->runningInConsole();
38
    }
39
}
40