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
Branch master (a445f1)
by Jérémy
03:02
created

Request::getHeaders()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace CapMousse\ReactRestify\Http;
4
5
use React\Http\Request as ReactHttpRequest;
6
use Evenement\EventEmitter;
7
8
class Request extends EventEmitter
9
{
10
    /** @var React\Http\Request */
11
    public $httpRequest;
12
13
    /** @var mixed */
14
    private $content;
15
16
    /** @var array */
17
    private $data = [];
18
19
    /**
20
     * @param ReactHttpRequest $httpRequest
21
     */
22
    public function __construct(ReactHttpRequest $httpRequest)
23
    {
24
        $this->httpRequest = $httpRequest;
0 ignored issues
show
Documentation Bug introduced by
It seems like $httpRequest of type object<React\Http\Request> is incompatible with the declared type object<CapMousse\ReactRe...ttp\React\Http\Request> of property $httpRequest.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
25
    }
26
27
    /**
28
     * Set the raw data of the request
29
     * @param mixed $content
30
     */
31
    public function setContent($content)
32
    {
33
        $this->content = $content;
34
    }
35
36
    /**
37
     * Set the raw data of the request
38
     * @param mixed $content
0 ignored issues
show
Bug introduced by
There is no parameter named $content. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
39
     */
40
    public function getContent()
41
    {
42
        return $this->content;
43
    }
44
45
    public function getHeaders()
46
    {
47
        $headers = array_change_key_case($this->httpRequest->getHeaders(), CASE_LOWER);
48
        $headers = array_map(function ($value) {
49
            return strtolower($value);
50
        }, $headers);
51
52
        return $headers;
53
    }
54
55
    /**
56
     * Set the data array
57
     * @param array $data array of data
58
     */
59
    public function setData($data)
60
    {
61
        $this->data = array_merge($data, $this->data);
62
    }
63
64
    /**
65
     * Get the data array
66
     * @return array
67
     */
68
    public function getData()
69
    {
70
        return $this->data;
71
    }
72
    public function __get($name)
73
    {
74
        return isset($this->data[$name]) ? $this->data[$name] : false;
75
    }
76
77
    public function __set($name, $value)
78
    {
79
        $this->data[$name] = $value;
80
    }
81
}
82