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 ( f32406...e01f6d )
by Benjamin
02:49
created

Request::createFromGlobals()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 12
ccs 10
cts 10
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Lib\Http;
4
5
use GuzzleHttp\Psr7\Request as BaseRequest;
6
7
class Request extends BaseRequest
8
{
9
    const METHOD_HEAD = 'HEAD';
10
    const METHOD_GET  = 'GET';
11
    const METHOD_POST = 'POST';
12
13
    protected $query;
14
    protected $request;
15
    protected $cookie;
16
    protected $server;
17
    protected $files;
18
19
    /**
20
     * undocumented function
21
     *
22
     * @return void
23
     */
24 4
    public function __construct($query = array(), $request = array(), $cookie = array(), $server = array(), $files = array())
25
    {
26 4
        $this->query   = new ParamCollection($query);
27 4
        $this->request = new ParamCollection($request);
28 4
        $this->cookie  = new ParamCollection($cookie);
29 4
        $this->server  = new ServerCollection($server);
30 4
        $this->files   = new ParamCollection($files);
31
32 4
        $method = $this->server->has('REQUEST_METHOD') ? $this->server->get('REQUEST_METHOD') : 'GET';
33
34 4
        $requestUri = '/';
35 4
        if ($this->server->has('REQUEST_URI')) {
36 1
            $requestUri = $this->server->get('REQUEST_URI');
37 3
        } elseif ($this->server->has('ORIG_PATH_INFO')) {
38
            $requestUri = $this->server->get('ORIG_PATH_INFO');
39
            $this->server->set('REQUEST_URI', $requestUri);
40
        }
41
42 4
        $version = $this->server->has('SERVER_PROTOCOL') ?? substr($this->server->get('SERVER_PROTOCOL'), -3) ?? '1.1';
43
44 4
        parent::__construct($method, $requestUri, $this->server->getHeaders(), http_build_query($this->request->all()), $version);
45 4
    }
46
47 1
    public static function createFromGlobals()
48
    {
49 1
        array_walk($_GET, 'htmlspecialchars');
50 1
        array_walk($_POST, 'htmlspecialchars');
51 1
        array_walk($_COOKIE, 'htmlspecialchars');
52
53 1
        return new self(
54 1
            $_GET,
55 1
            $_POST,
56 1
            $_COOKIE,
57 1
            $_SERVER,
58 1
            $_FILES
59
        );
60
    }
61
}
62