| Conditions | 6 |
| Paths | 12 |
| Total Lines | 23 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function collect(): array |
||
| 31 | { |
||
| 32 | $domains = WebsiteUtil::extractDomains($this->inventory); |
||
| 33 | |||
| 34 | $headers = []; |
||
| 35 | |||
| 36 | foreach ($domains as $domain) { |
||
| 37 | try { |
||
| 38 | $url = $domain; |
||
| 39 | if (!str_starts_with($url, 'http')) $url = 'https://' . $url; |
||
| 40 | $response = $this->client->get($url); |
||
| 41 | } catch (ClientException $e) { |
||
| 42 | $response = $e->getResponse(); |
||
| 43 | } catch (ServerException $e) { |
||
| 44 | $response = $e->getResponse(); |
||
| 45 | } catch (\Exception) { |
||
| 46 | continue; |
||
| 47 | } |
||
| 48 | |||
| 49 | $headers[$domain] = $response->getHeaders(); |
||
| 50 | } |
||
| 51 | |||
| 52 | return $headers; |
||
| 53 | } |
||
| 55 |