private function buildLinkHeaderString($url)
{
$linkTypeMap = ['.CSS' => 'style', '.JS' => 'script', '.BMP' => 'image', '.GIF' => 'image', '.JPG' => 'image', '.JPEG' => 'image', '.PNG' => 'image', '.TIFF' => 'image'];
$type = collect($linkTypeMap)->first(function ($extension) use($url) {
return str_contains(strtoupper($url), $extension);
});
return is_null($type) ? null : "<{$url}>; rel=preload; as={$type}";
}