1 | <?php |
||
15 | class HttpDriverResponse |
||
16 | { |
||
17 | const HTTP_CODE_OK = 200; |
||
18 | const HTTP_CODE_MOVE_PERMANENTLY = 301; |
||
19 | const HTTP_CODE_FOUND = 302; |
||
20 | const HTTP_CODE_NOT_MODIFIED = 304; |
||
21 | const HTTP_CODE_FORBIDDEN = 403; |
||
22 | const HTTP_CODE_NOT_FOUND = 404; |
||
23 | const HTTP_CODE_SERVER_ERROR = 500; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $body; |
||
29 | |||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | protected $headers; |
||
34 | |||
35 | /** |
||
36 | * @var int |
||
37 | */ |
||
38 | protected $httpCode; |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $httpVersion; |
||
44 | |||
45 | /** |
||
46 | * @var string |
||
47 | */ |
||
48 | protected $httpMessage; |
||
49 | |||
50 | /** |
||
51 | * @return bool |
||
52 | */ |
||
53 | 2 | public function getHttpCodeIsOk() |
|
54 | { |
||
55 | 2 | return $this->getHttpCode() === self::HTTP_CODE_OK; |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * @return bool |
||
60 | */ |
||
61 | public function getHttpCodeIsRedirection() |
||
62 | { |
||
63 | return in_array( |
||
64 | $this->getHttpCode(), |
||
65 | array( |
||
66 | self::HTTP_CODE_MOVE_PERMANENTLY, |
||
67 | self::HTTP_CODE_FOUND, |
||
68 | ) |
||
69 | ); |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @return bool |
||
74 | */ |
||
75 | public function getHttpCodeIsCached() |
||
76 | { |
||
77 | return in_array( |
||
78 | $this->getHttpCode(), |
||
79 | array( |
||
80 | self::HTTP_CODE_NOT_MODIFIED, |
||
81 | ) |
||
82 | ); |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * @return int |
||
87 | */ |
||
88 | 2 | public function getHttpCode() |
|
89 | { |
||
90 | 2 | return $this->httpCode; |
|
91 | } |
||
92 | |||
93 | /** |
||
94 | * @param int $httpCode |
||
95 | * |
||
96 | * @return HttpDriverResponse |
||
97 | */ |
||
98 | 3 | public function setHttpCode($httpCode) |
|
104 | |||
105 | /** |
||
106 | * @return string |
||
107 | */ |
||
108 | 1 | public function getHttpVersion() |
|
112 | |||
113 | /** |
||
114 | * @param string $httpVersion |
||
115 | * |
||
116 | * @return HttpDriverResponse |
||
117 | */ |
||
118 | 2 | public function setHttpVersion($httpVersion) |
|
124 | |||
125 | /** |
||
126 | * @return string |
||
127 | */ |
||
128 | 1 | public function getHttpMessage() |
|
132 | |||
133 | /** |
||
134 | * @param string $httpMessage |
||
135 | * |
||
136 | * @return HttpDriverResponse |
||
137 | */ |
||
138 | 2 | public function setHttpMessage($httpMessage) |
|
144 | |||
145 | /** |
||
146 | * @return string |
||
147 | */ |
||
148 | 1 | public function getHeaders() |
|
152 | |||
153 | /** |
||
154 | * @param string $headers |
||
155 | * |
||
156 | * @return HttpDriverResponse |
||
157 | */ |
||
158 | 2 | public function setHeaders($headers) |
|
164 | |||
165 | /** |
||
166 | * @return string |
||
167 | */ |
||
168 | 2 | public function getBody() |
|
172 | |||
173 | /** |
||
174 | * @param string $body |
||
175 | * |
||
176 | * @return HttpDriverResponse |
||
177 | */ |
||
178 | 3 | public function setBody($body) |
|
184 | } |
||
185 |
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..