private function sortedFilter(array $filtered, ServerRequestInterface $request): DisplayerContract
    {
        $accepts = self::getHeaderValuesFromString($request->getHeaderLine('Accept'));

        foreach ($accepts as $accept) {
            foreach ($filtered as $filter) {
                if ($filter->getContentType() === $accept) {
                    return $filter;
                }
            }
        }

        return $filtered[0];
    }
private function sortedFilter(array $filtered, ServerRequestInterface $request): DisplayerContract
    {
        $accepts = self::getHeaderValuesFromString($request->getHeaderLine('Accept'));

        foreach ($accepts as $accept) {
            foreach ($filtered as $filter) {
                if ($filter->getContentType() === $accept) {
                    return $filter;
                }
            }
        }

        return $filtered[0];
    }
private function sortedFilter ( array $ filtered , ServerRequestInterface $ request ) : DisplayerContract { $ accepts = self :: getHeaderValuesFromString ( $ request -> getHeaderLine ( 'Accept' ) ) ; foreach ( $ accepts as $ accept ) { foreach ( $ filtered as $ filter ) { if ( $ filter -> getContentType ( ) === $ accept ) { return $ filter ; } } } return $ filtered [ 0 ] ; }
Sort displayer after the first found accept header.

@param array                                    $filtered
@param \Psr\Http\Message\ServerRequestInterface $request

@return \Viserio\Component\Contract\Exception\Displayer
Sort displayer after the first found accept header .