Skip to content

Commit e5d19b8

Browse files
committed
Save status for each broken image
1 parent 5ac93ba commit e5d19b8

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/Checks/Content/BrokenImageCheck.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,25 @@ public function validateContent(Crawler $crawler): bool
4646
return true;
4747
}
4848

49+
$links = [];
50+
4951
$content = collect($content)->filter(fn ($value) => $value !== null)
5052
->map(fn ($link) => addBaseIfRelativeUrl($link, $this->url))
51-
->filter(fn ($link) => isBrokenLink($link))->toArray();
53+
->filter(fn ($link) => isBrokenLink($link))
54+
->map(function ($link) use (&$links) {
55+
56+
$remoteStatus = getRemoteStatus($link);
57+
58+
$links[] = $link . ' (status: ' . $remoteStatus . ')';
59+
60+
return $link;
61+
});
5262

53-
$this->actualValue = $content;
63+
$this->actualValue = $links;
5464

5565
if (count($content) > 0) {
5666
$this->failureReason = __('failed.content.broken_images', [
57-
'actualValue' => implode(', ', $content),
67+
'actualValue' => implode(', ', $links),
5868
]);
5969

6070
return false;

0 commit comments

Comments
 (0)