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

BaseCacheProfile   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 32
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 8 2
A isRunningInConsole() 0 8 2
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
    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
        if (Auth::check()) {
27
            return Auth::user()->id;
28
        }
29
30
        return '';
31
    }
32
33
    public function isRunningInConsole(): bool
34
    {
35
        if (app()->environment('testing')) {
36
            return false;
37
        }
38
39
        return app()->runningInConsole();
40
    }
41
}
42