original_string: 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));
      }
code: 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));
      }
code_tokens: 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 ) ) ; }
docstring: Adds a Link HTTP header to the current response.
  
  @see https://tools.ietf.org/html/rfc5988
  
  @final
docstring_tokens: Adds a Link HTTP header to the current response .