original_string: private function preferred(ServerRequestInterface $request): RequestHandlerInterface
      {
          $negotiator = new Negotiator;
          $accept = $request->getHeaderLine('Accept', '*/*');
          $priorities = array_keys($this->handlers);
  
          $best = $negotiator->getBest($accept, $priorities);
  
          $mediatype = $best ? $best->getValue() : current($priorities);
  
          return $this->handlers[$mediatype];
      }
code: private function preferred(ServerRequestInterface $request): RequestHandlerInterface
      {
          $negotiator = new Negotiator;
          $accept = $request->getHeaderLine('Accept', '*/*');
          $priorities = array_keys($this->handlers);
  
          $best = $negotiator->getBest($accept, $priorities);
  
          $mediatype = $best ? $best->getValue() : current($priorities);
  
          return $this->handlers[$mediatype];
      }
code_tokens: private function preferred ( ServerRequestInterface $ request ) : RequestHandlerInterface { $ negotiator = new Negotiator ; $ accept = $ request -> getHeaderLine ( 'Accept' , '*/*' ) ; $ priorities = array_keys ( $ this -> handlers ) ; $ best = $ negotiator -> getBest ( $ accept , $ priorities ) ; $ mediatype = $ best ? $ best -> getValue ( ) : current ( $ priorities ) ; return $ this -> handlers [ $ mediatype ] ; }
docstring: Return the preferred request handler. Fallback to the first one when no
  request handler matches the request accept header.
  
  @param \Psr\Http\Message\ServerRequestInterface $request
  @return \Psr\Http\Server\RequestHandlerInterface
docstring_tokens: Return the preferred request handler . Fallback to the first one when no request handler matches the request accept header .