/**
  * @param Request $request
  * @param array   $operationDefinition
  *
  * @return mixed|null
  * @throws MalformedContentException
  * @throws UnsupportedContentTypeException
  */
 public function decodeContent(Request $request, array $operationDefinition)
 {
     if ($content = $request->getContent()) {
         $type = $this->typeResolver ? $this->typeResolver->resolve($operationDefinition) : null;
         try {
             return $this->serializer->deserialize($content, $type, $request->getContentType());
         } catch (\Exception $e) {
             throw new MalformedContentException("Unable to decode payload", 400, $e);
         }
     }
     return null;
 }
 /**
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  *
  * @param Request $request
  * @param mixed   $data
  *
  * @return Response
  */
 public function createResponse(Request $request, $data)
 {
     $data = $this->serializer->serialize($data, 'json');
     return new Response($data, 200, ['Content-Type' => 'application/json']);
 }