src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php
/**
     * Adds a Link HTTP header to the current response.
     *
     * @see https://tools.ietf.org/html/rfc5988
     *
     * @final
     */
Adds a Link HTTP header to the current response.

@final
Adds a Link HTTP header to the current response . @final
protected function addLink(Request $request, Link $link)
    {
        if (!class_exists(AddLinkHeaderListener::class)) {
            throw new \LogicException('You can not use the "addLink" method if the WebLink component is not available. Try running "composer require symfony/web-link".');
        }
        if (null === $linkProvider = $request->attributes->get('_links')) {
            $request->attributes->set('_links', new GenericLinkProvider([$link]));
            return;
        }
        $request->attributes->set('_links', $linkProvider->withLink($link));
    }
protected function addLink ( Request $ request , Link $ link ) { if ( ! class_exists ( AddLinkHeaderListener :: class ) ) { throw new \ LogicException ( 'You can not use the "addLink" method if the WebLink component is not available. Try running "composer require symfony/web-link".' ) ; } if ( null === $ linkProvider = $ request -> attributes -> get ( '_links' ) ) { $ request -> attributes -> set ( '_links' , new GenericLinkProvider ( [ $ link ] ) ) ; return ; } $ request -> attributes -> set ( '_links' , $ linkProvider -> withLink ( $ link ) ) ; }
Adds a Link HTTP header to the current response.
Adds a Link HTTP header to the current response .