protected function determineRepresentationByHttpMethod(AbstractRepresentation $representation, array $detectContentOptions = [])
{
switch ($this->request->getHttpMethod()) {
// Match on content option
case Request::METHOD_GET:
// This representation matches the required media type requested by the client
if ($representation->isExpectedContent($detectContentOptions, $this->request)) {
return $representation;
}
break;
// Match on content-type
// Match on content-type
case Request::METHOD_POST:
case Request::METHOD_PUT:
case Request::METHOD_PATCH:
if ($representation->getContentType() === $this->request->getHeaders('Content-Type')) {
return $representation;
}
break;
}
return null;
}