protected function getWriterFromContentNegotiation(MediaType $contentType, array $supportedWriter = null)
    {
        if (empty($this->contentNegotiation)) {
            return null;
        }

        foreach ($this->contentNegotiation as $acceptedContentType => $writerClass) {
            if ($supportedWriter !== null && !in_array($writerClass, $supportedWriter)) {
                continue;
            }

            $acceptedContentType = new MediaType($acceptedContentType);

            if ($acceptedContentType->match($contentType)) {
                $writer = $this->getWriterByInstance($writerClass);

                if ($writer !== null) {
                    return $writer;
                }
            }
        }

        return null;
    }
protected function getWriterFromContentNegotiation(MediaType $contentType, array $supportedWriter = null)
    {
        if (empty($this->contentNegotiation)) {
            return null;
        }

        foreach ($this->contentNegotiation as $acceptedContentType => $writerClass) {
            if ($supportedWriter !== null && !in_array($writerClass, $supportedWriter)) {
                continue;
            }

            $acceptedContentType = new MediaType($acceptedContentType);

            if ($acceptedContentType->match($contentType)) {
                $writer = $this->getWriterByInstance($writerClass);

                if ($writer !== null) {
                    return $writer;
                }
            }
        }

        return null;
    }
protected function getWriterFromContentNegotiation ( MediaType $ contentType , array $ supportedWriter = null ) { if ( empty ( $ this -> contentNegotiation ) ) { return null ; } foreach ( $ this -> contentNegotiation as $ acceptedContentType => $ writerClass ) { if ( $ supportedWriter !== null && ! in_array ( $ writerClass , $ supportedWriter ) ) { continue ; } $ acceptedContentType = new MediaType ( $ acceptedContentType ) ; if ( $ acceptedContentType -> match ( $ contentType ) ) { $ writer = $ this -> getWriterByInstance ( $ writerClass ) ; if ( $ writer !== null ) { return $ writer ; } } } return null ; }
Returns the fitting writer according to the content negotiation. If no
fitting writer could be found null gets returned

@param \PSX\Http\MediaType $contentType
@param array $supportedWriter
@return \PSX\Data\WriterInterface
Returns the fitting writer according to the content negotiation . If no fitting writer could be found null gets returned