private function getContentTypeHandler(ServerRequestInterface $request)
    {
        $acceptHeader = $request->getHeaderLine('Accept');
        $acceptedTypes = explode(',', $acceptHeader);

        foreach ($this->handlers as $contentType => $handler) {
            if ($this->doesTypeMatch($acceptedTypes, $contentType)) {
                return $handler;
            }
        }

        return reset($this->handlers);
    }
private function getContentTypeHandler(ServerRequestInterface $request)
    {
        $acceptHeader = $request->getHeaderLine('Accept');
        $acceptedTypes = explode(',', $acceptHeader);

        foreach ($this->handlers as $contentType => $handler) {
            if ($this->doesTypeMatch($acceptedTypes, $contentType)) {
                return $handler;
            }
        }

        return reset($this->handlers);
    }
private function getContentTypeHandler ( ServerRequestInterface $ request ) { $ acceptHeader = $ request -> getHeaderLine ( 'Accept' ) ; $ acceptedTypes = explode ( ',' , $ acceptHeader ) ; foreach ( $ this -> handlers as $ contentType => $ handler ) { if ( $ this -> doesTypeMatch ( $ acceptedTypes , $ contentType ) ) { return $ handler ; } } return reset ( $ this -> handlers ) ; }
Get a content handler based on Accept header in the request.

Falls back to default handler if no matches found.

@param ServerRequestInterface $request

@return ContentHandlerInterface
Get a content handler based on Accept header in the request .