Exemple #1
0
 /**
  * Parse request body
  *
  * @param Request $request
  * @param EnvironmentInterface $environment
  * @return mixed|null
  */
 private function parseBody(Request $request, EnvironmentInterface $environment)
 {
     if (null === $environment->getBodyType()) {
         return null;
     }
     $decoder = $environment->getDecoder();
     if ($decoder instanceof DecoderInterface) {
         $decoder->setContentType($environment->getBodyType());
     }
     return $decoder->decode($request->getContent());
 }
Exemple #2
0
 /**
  * @inheritdoc
  */
 protected function getMediaType()
 {
     return $this->environment->getEncoderMediaType();
 }