| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 2 |
| CRAP Score | 3.1852 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 17 | private function get_http_response_code(string $url) |
||
| 18 | 1 | { |
|
| 19 | 1 | if ($url =='') { |
|
| 20 | return false; |
||
| 21 | } |
||
| 22 | |||
| 23 | // Avoid ssl errors: SSL operation failed with code 1 |
||
| 24 | stream_context_set_default([ |
||
| 25 | 'ssl' => [ |
||
| 26 | 'verify_peer' => false, |
||
| 27 | 'verify_peer_name' => false, |
||
| 28 | ], |
||
| 29 | ]); |
||
| 30 | |||
| 31 | $headers = get_headers($url); |
||
| 32 | return substr($headers[0], 9, 3); |
||
| 33 | } |
||
| 47 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: