| Conditions | 3 |
| Paths | 3 |
| Total Lines | 26 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function checkLink($href) |
||
| 31 | { |
||
| 32 | // Skip non-external links |
||
| 33 | if (!preg_match('/^https?[^:]*:\/\//', $href)) { |
||
| 34 | return null; |
||
| 35 | } |
||
| 36 | |||
| 37 | // Check if we have a cached result |
||
| 38 | $cacheKey = md5($href); |
||
| 39 | $result = $this->getCache()->get($cacheKey); |
||
| 40 | if ($result !== false) { |
||
| 41 | return $result; |
||
| 42 | } |
||
| 43 | |||
| 44 | // No cached result so just request |
||
| 45 | $handle = curl_init($href); |
||
| 46 | curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); |
||
| 47 | curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5); |
||
| 48 | curl_setopt($handle, CURLOPT_TIMEOUT, 10); |
||
| 49 | curl_exec($handle); |
||
| 50 | $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); |
||
| 51 | curl_close($handle); |
||
| 52 | |||
| 53 | // Cache result |
||
| 54 | $this->getCache()->set($httpCode, $cacheKey); |
||
| 55 | return $httpCode; |
||
| 56 | } |
||
| 58 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths