| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 44 | private function getHtml(string $endpoint): string |
||
| 45 | { |
||
| 46 | $c = curl_init($endpoint); |
||
| 47 | curl_setopt($c, CURLOPT_RETURNTRANSFER, true); |
||
| 48 | $json = curl_exec($c); |
||
| 49 | curl_close($c); |
||
| 50 | |||
| 51 | if (!$json) { |
||
| 52 | //todo write to log curl_error() |
||
| 53 | return ''; |
||
| 54 | } |
||
| 55 | |||
| 56 | $response = json_decode($json, true); |
||
| 57 | |||
| 58 | return $response['data']['widgets']['widget_7']['html']; |
||
| 59 | } |
||
| 60 | } |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: