protected function sendEarlyHints(iterable
$links =
[], Response
$response = null
): Response
{ if (!
$this->container->
has('web_link.http_header_serializer'
)) { throw new \
LogicException('You cannot use the "sendEarlyHints" method if the WebLink component is not available. Try running "composer require symfony/web-link".'
);
} $response ??=
new Response();
$populatedLinks =
[];
foreach ($links as $link) { if ($link instanceof EvolvableLinkInterface && !
$link->
getRels()) { $link =
$link->
withRel('preload'
);
} $populatedLinks[] =
$link;
} $response->headers->
set('Link',
$this->container->
get('web_link.http_header_serializer'
)->
serialize($populatedLinks), false
);
$response->
sendHeaders(103
);
return $response;
}