public function negotiate($content, MediaTypeList $mediaTypeList)
    {
        $contentType = $mediaTypeList->getBestMatch(array_keys($this->supportedMediaTypes));
        if (!$contentType) {
            throw new Exception('A suitable Content-Type could not be found.');
        }

        $result = new NegotiatedResult();
        $result->contentType = $contentType;
        $result->content = $this->encode($content, $contentType);

        return $result;
    }
public function negotiate($content, MediaTypeList $mediaTypeList)
    {
        $contentType = $mediaTypeList->getBestMatch(array_keys($this->supportedMediaTypes));
        if (!$contentType) {
            throw new Exception('A suitable Content-Type could not be found.');
        }

        $result = new NegotiatedResult();
        $result->contentType = $contentType;
        $result->content = $this->encode($content, $contentType);

        return $result;
    }
public function negotiate ( $ content , MediaTypeList $ mediaTypeList ) { $ contentType = $ mediaTypeList -> getBestMatch ( array_keys ( $ this -> supportedMediaTypes ) ) ; if ( ! $ contentType ) { throw new Exception ( 'A suitable Content-Type could not be found.' ) ; } $ result = new NegotiatedResult ( ) ; $ result -> contentType = $ contentType ; $ result -> content = $ this -> encode ( $ content , $ contentType ) ; return $ result ; }
Negotiates content based on a set of input criteria.

@param mixed                                      $content
@param \BedRest\Content\Negotiation\MediaTypeList $mediaTypeList

@throws \BedRest\Content\Negotiation\Exception
@return \BedRest\Content\Negotiation\NegotiatedResult
Negotiates content based on a set of input criteria .