src/Message.php
public function getParsedBody()
    {
        if (is_null($this->parsedBody)) {
            $contentType = $this->getHeader('Content-Type');

            if (!empty($contentType)) {
                $contentType = explode(';', reset($contentType));
                $contentType = $contentType[0];
                $contentType = explode('/', $contentType, 2);
                $contentType[1] = explode('+', $contentType[1]);
                $contentType = $contentType[0] . '/' . $contentType[1][count($contentType[1]) - 1];

                if (isset(self::$bodyParser[$contentType]) && is_callable(self::$bodyParser[$contentType])) {
                    $bodyParser = self::$bodyParser[$contentType];
                    $parsedBody = $bodyParser((string) $this->getBody());
                } else {
                    switch ($contentType) {
                        case 'application/x-www-form-urlencoded':
                            $parsedBody = [];
                            parse_str((string) $this->getBody(), $parsedBody);
                            break;
                        case 'multipart/form-data':
                            $parsedBody = $_POST;
                            break;
                        case 'application/json':
                            $parsedBody = json_decode((string) $this->getBody());
                            break;
                        default:
                            $parsedBody = null;
                    }
                }

                if (!is_null($parsedBody) && !is_array($parsedBody) && !is_object($parsedBody)) {
                    throw new \RuntimeException('Parsed body must be an array or an object or must be null.');
                } else {
                    $this->parsedBody = $parsedBody;
                }
            }
        }

        return $this->parsedBody;
    }
public function getParsedBody()
    {
        if (is_null($this->parsedBody)) {
            $contentType = $this->getHeader('Content-Type');

            if (!empty($contentType)) {
                $contentType = explode(';', reset($contentType));
                $contentType = $contentType[0];
                $contentType = explode('/', $contentType, 2);
                $contentType[1] = explode('+', $contentType[1]);
                $contentType = $contentType[0] . '/' . $contentType[1][count($contentType[1]) - 1];

                if (isset(self::$bodyParser[$contentType]) && is_callable(self::$bodyParser[$contentType])) {
                    $bodyParser = self::$bodyParser[$contentType];
                    $parsedBody = $bodyParser((string) $this->getBody());
                } else {
                    switch ($contentType) {
                        case 'application/x-www-form-urlencoded':
                            $parsedBody = [];
                            parse_str((string) $this->getBody(), $parsedBody);
                            break;
                        case 'multipart/form-data':
                            $parsedBody = $_POST;
                            break;
                        case 'application/json':
                            $parsedBody = json_decode((string) $this->getBody());
                            break;
                        default:
                            $parsedBody = null;
                    }
                }

                if (!is_null($parsedBody) && !is_array($parsedBody) && !is_object($parsedBody)) {
                    throw new \RuntimeException('Parsed body must be an array or an object or must be null.');
                } else {
                    $this->parsedBody = $parsedBody;
                }
            }
        }

        return $this->parsedBody;
    }
Retrieve any parameters provided in the request body.

If the request Content-Type is either application/x-www-form-urlencoded
or multipart/form-data, and the request method is POST, this method MUST
return the contents of $_POST.

Otherwise, this method may return any results of deserializing
the request body content; as parsing returns structured content, the
potential types MUST be arrays or objects only. A null value indicates
the absence of body content.

@return null|array|object The deserialized body parameters, if any.
These will typically be an array or object.