1 | <?php |
||
10 | class Http extends Base |
||
11 | { |
||
12 | /** |
||
13 | * @return Result |
||
14 | */ |
||
15 | protected $secure = false; |
||
16 | |||
17 | /** |
||
18 | * @var |
||
19 | */ |
||
20 | protected $guzzle; |
||
21 | |||
22 | /** |
||
23 | * @var |
||
24 | */ |
||
25 | private $totalTime; |
||
26 | |||
27 | /** |
||
28 | * @var |
||
29 | */ |
||
30 | private $url; |
||
31 | |||
32 | /** |
||
33 | * HTTP Checker. |
||
34 | * |
||
35 | * @return Result |
||
36 | */ |
||
37 | 8 | public function check() |
|
63 | |||
64 | /** |
||
65 | * Get array of resource urls. |
||
66 | 8 | * |
|
67 | * @return array |
||
68 | 8 | */ |
|
69 | 8 | private function getResourceUrlArray() |
|
77 | |||
78 | /** |
||
79 | * Check web pages. |
||
80 | * |
||
81 | * @param $url |
||
82 | 8 | * @param bool $ssl |
|
83 | * @return mixed |
||
84 | 8 | */ |
|
85 | private function checkWebPage($url, $ssl = false, $parameters = []) |
||
101 | 8 | ||
102 | 8 | /** |
|
103 | 8 | * Send an http request and fetch the response. |
|
104 | 8 | * |
|
105 | * @param $url |
||
106 | * @param $ssl |
||
107 | * @return mixed|\Psr\Http\Message\ResponseInterface |
||
108 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
109 | */ |
||
110 | private function fetchResponse($url, $ssl, $parameters = []) |
||
120 | 8 | ||
121 | /** |
||
122 | * Get http connection options. |
||
123 | * |
||
124 | * @param $ssl |
||
125 | * @return array |
||
126 | */ |
||
127 | private function getConnectionOptions($ssl) |
||
136 | |||
137 | /** |
||
138 | * Get the error message. |
||
139 | * |
||
140 | * @return string |
||
141 | */ |
||
142 | private function getErrorMessage() |
||
153 | |||
154 | /** |
||
155 | * The the connection timeout. |
||
156 | 8 | * |
|
157 | * @return int |
||
158 | 8 | */ |
|
159 | private function getConnectionTimeout() |
||
163 | |||
164 | /** |
||
165 | * The the roundtrip timeout. |
||
166 | * |
||
167 | * @return int |
||
168 | 8 | */ |
|
169 | private function getRoundtripTimeout() |
||
173 | 8 | ||
174 | /** |
||
175 | * Make a url with a proper scheme. |
||
176 | * |
||
177 | * @param $url |
||
178 | * @param $secure |
||
179 | * @return mixed |
||
180 | */ |
||
181 | private function makeUrlWithScheme($url, $secure) |
||
189 | |||
190 | /** |
||
191 | * Guzzle OnStats callback. |
||
192 | * |
||
193 | * @return \Closure |
||
194 | */ |
||
195 | private function onStatsCallback() |
||
201 | 8 | ||
202 | /** |
||
203 | * Send a request and get the result. |
||
204 | * |
||
205 | * @param $url |
||
206 | * @param $ssl |
||
207 | * @return bool |
||
208 | * @internal param $response |
||
209 | 8 | */ |
|
210 | private function requestSuccessful($url, $ssl, $parameters) |
||
220 | |||
221 | /** |
||
222 | * Check if the request timed out. |
||
223 | * |
||
224 | * @return bool |
||
225 | */ |
||
226 | private function requestTimeout() |
||
230 | |||
231 | /** |
||
232 | * Parse URL from config. |
||
233 | * |
||
234 | * @return array |
||
235 | */ |
||
236 | protected function parseConfigUrl($data) |
||
250 | |||
251 | /** |
||
252 | * Get the request method. |
||
253 | * |
||
254 | * @return bool |
||
255 | */ |
||
256 | protected function getMethod($parameters) |
||
264 | } |
||
265 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.