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 ( 13165d...cdc029 )
by Cees-Jan
04:28 queued 59s
created

SessionCacheConfiguration   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 51
ccs 0
cts 37
cp 0
rs 10
c 0
b 0
f 0
wmc 12

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A cacheEncode() 0 3 1
A requestIsCacheable() 0 11 4
A cacheKey() 0 3 1
A cacheDecode() 0 3 1
A responseIsCacheable() 0 11 4
1
<?php declare(strict_types=1);
2
3
namespace WyriHaximus\React\Http\Middleware;
4
5
use Psr\Http\Message\ResponseInterface;
6
use Psr\Http\Message\ServerRequestInterface;
7
8
final class SessionCacheConfiguration implements CacheConfigurationInterface
9
{
10
    /**
11
     * @var CacheConfigurationInterface
12
     */
13
    private $cacheConfiguration;
14
15
    public function __construct(CacheConfigurationInterface $cacheConfiguration)
16
    {
17
        $this->cacheConfiguration = $cacheConfiguration;
18
    }
19
20
    public function requestIsCacheable(ServerRequestInterface $request): bool
21
    {
22
        if (
23
            class_exists(SessionMiddleware::class) &&
24
            $request->getAttribute(SessionMiddleware::ATTRIBUTE_NAME) !== null &&
25
            $request->getAttribute(SessionMiddleware::ATTRIBUTE_NAME)->isActive() === true
26
        ) {
27
            return false;
28
        }
29
30
        return $this->cacheConfiguration->requestIsCacheable($request);
31
    }
32
33
    public function responseIsCacheable(ServerRequestInterface $request, ResponseInterface $response): bool
34
    {
35
        if (
36
            class_exists(SessionMiddleware::class) &&
37
            $request->getAttribute(SessionMiddleware::ATTRIBUTE_NAME) !== null &&
38
            $request->getAttribute(SessionMiddleware::ATTRIBUTE_NAME)->isActive() === true
39
        ) {
40
            return false;
41
        }
42
43
        return $this->cacheConfiguration->responseIsCacheable($request, $response);
44
    }
45
46
    public function cacheKey(ServerRequestInterface $request): string
47
    {
48
        return $this->cacheConfiguration->cacheKey($request);
49
    }
50
51
    public function cacheEncode(ResponseInterface $response): string
52
    {
53
        return $this->cacheConfiguration->cacheEncode($response);
54
    }
55
56
    public function cacheDecode(string $response): ResponseInterface
57
    {
58
        return $this->cacheConfiguration->cacheDecode($response);
59
    }
60
}
61