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.

Cache   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 29
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 16 4
1
<?php
2
/**
3
 * This file is part of the O2System Reactor package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Reactor\Http\Middleware;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Psr\Http\Message\ServerRequestInterface;
19
use O2System\Psr\Http\Server\RequestHandlerInterface;
20
21
/**
22
 * Class Cache
23
 *
24
 * @package O2System\Reactor\Http\Middleware
25
 */
26
class Cache implements RequestHandlerInterface
27
{
28
    /**
29
     * Cache::handle
30
     *
31
     * Handles a request and produces a response
32
     *
33
     * May call other collaborating code to generate the response.
34
     *
35
     * @param \O2System\Psr\Http\Message\ServerRequestInterface $request
36
     *
37
     * @throws \Psr\Cache\InvalidArgumentException
38
     */
39
    public function handle(ServerRequestInterface $request)
40
    {
41
        // Try to get from cache
42
        $cacheKey = 'o2output_' . underscore(server_request()->getUri()->segments->__toString());
43
44
        $cacheHandle = cache()->getItemPool('default');
45
46
        if (cache()->hasItemPool('output')) {
47
            $cacheHandle = cache()->getItemPool('output');
48
        }
49
50
        if ($cacheHandle instanceof \Psr\Cache\CacheItemPoolInterface) {
51
            if ($cacheHandle->hasItem($cacheKey)) {
52
                output()
53
                    ->setContentType('text/html')
0 ignored issues
show
Bug introduced by
The method setContentType() does not exist on O2System\Kernel\Cli\Output. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

53
                    ->/** @scrutinizer ignore-call */ setContentType('text/html')

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
54
                    ->send($cacheHandle->getItem($cacheKey)->get());
0 ignored issues
show
Bug introduced by
The method send() does not exist on O2System\Kernel\Cli\Output. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

54
                    ->/** @scrutinizer ignore-call */ send($cacheHandle->getItem($cacheKey)->get());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
55
            }
56
        }
57
    }
58
}