public function getBodyParams()
    {
        if ($this->_bodyParams === null) {
            $reactMethod = strtoupper($this->reactRequest->getMethod());
            $reactBody = $this->reactRequest->getParsedBody();
            if ($reactMethod === 'POST' && isset($reactBody[$this->methodParam])) {
                $this->_bodyParams = $reactBody;
                unset($this->_bodyParams[$this->methodParam]);
                return $this->_bodyParams;
            }

            $rawContentType = $this->getContentType();
            if (($pos = strpos($rawContentType, ';')) !== false) {
                // e.g. text/html; charset=UTF-8
                $contentType = substr($rawContentType, 0, $pos);
            } else {
                $contentType = $rawContentType;
            }

            if (isset($this->parsers[$contentType])) {
                $parser = Reaction::create($this->parsers[$contentType]);
                if (!($parser instanceof RequestParserInterface)) {
                    throw new InvalidConfigException("The '$contentType' request parser is invalid. It must implement the Reaction\\Web\\RequestParserInterface.");
                }
                $this->_bodyParams = $parser->parse($this->getRawBody(), $rawContentType);
            } elseif (isset($this->parsers['*'])) {
                $parser = Reaction::create($this->parsers['*']);
                if (!($parser instanceof RequestParserInterface)) {
                    throw new InvalidConfigException('The fallback request parser is invalid. It must implement the Reaction\\Web\\RequestParserInterface.');
                }
                $this->_bodyParams = $parser->parse($this->getRawBody(), $rawContentType);
            } elseif ($this->getMethod() === 'POST') {
                // PHP has already parsed the body so we have all params in $_POST
                $this->_bodyParams = $reactBody;
            } else {
                $this->_bodyParams = [];
                mb_parse_str($this->getRawBody(), $this->_bodyParams);
            }
        }

        return $this->_bodyParams;
    }
public function getBodyParams()
    {
        if ($this->_bodyParams === null) {
            $reactMethod = strtoupper($this->reactRequest->getMethod());
            $reactBody = $this->reactRequest->getParsedBody();
            if ($reactMethod === 'POST' && isset($reactBody[$this->methodParam])) {
                $this->_bodyParams = $reactBody;
                unset($this->_bodyParams[$this->methodParam]);
                return $this->_bodyParams;
            }

            $rawContentType = $this->getContentType();
            if (($pos = strpos($rawContentType, ';')) !== false) {
                // e.g. text/html; charset=UTF-8
                $contentType = substr($rawContentType, 0, $pos);
            } else {
                $contentType = $rawContentType;
            }

            if (isset($this->parsers[$contentType])) {
                $parser = Reaction::create($this->parsers[$contentType]);
                if (!($parser instanceof RequestParserInterface)) {
                    throw new InvalidConfigException("The '$contentType' request parser is invalid. It must implement the Reaction\\Web\\RequestParserInterface.");
                }
                $this->_bodyParams = $parser->parse($this->getRawBody(), $rawContentType);
            } elseif (isset($this->parsers['*'])) {
                $parser = Reaction::create($this->parsers['*']);
                if (!($parser instanceof RequestParserInterface)) {
                    throw new InvalidConfigException('The fallback request parser is invalid. It must implement the Reaction\\Web\\RequestParserInterface.');
                }
                $this->_bodyParams = $parser->parse($this->getRawBody(), $rawContentType);
            } elseif ($this->getMethod() === 'POST') {
                // PHP has already parsed the body so we have all params in $_POST
                $this->_bodyParams = $reactBody;
            } else {
                $this->_bodyParams = [];
                mb_parse_str($this->getRawBody(), $this->_bodyParams);
            }
        }

        return $this->_bodyParams;
    }
public function getBodyParams ( ) { if ( $ this -> _bodyParams === null ) { $ reactMethod = strtoupper ( $ this -> reactRequest -> getMethod ( ) ) ; $ reactBody = $ this -> reactRequest -> getParsedBody ( ) ; if ( $ reactMethod === 'POST' && isset ( $ reactBody [ $ this -> methodParam ] ) ) { $ this -> _bodyParams = $ reactBody ; unset ( $ this -> _bodyParams [ $ this -> methodParam ] ) ; return $ this -> _bodyParams ; } $ rawContentType = $ this -> getContentType ( ) ; if ( ( $ pos = strpos ( $ rawContentType , ';' ) ) !== false ) { // e.g. text/html; charset=UTF-8 $ contentType = substr ( $ rawContentType , 0 , $ pos ) ; } else { $ contentType = $ rawContentType ; } if ( isset ( $ this -> parsers [ $ contentType ] ) ) { $ parser = Reaction :: create ( $ this -> parsers [ $ contentType ] ) ; if ( ! ( $ parser instanceof RequestParserInterface ) ) { throw new InvalidConfigException ( "The '$contentType' request parser is invalid. It must implement the Reaction\\Web\\RequestParserInterface." ) ; } $ this -> _bodyParams = $ parser -> parse ( $ this -> getRawBody ( ) , $ rawContentType ) ; } elseif ( isset ( $ this -> parsers [ '*' ] ) ) { $ parser = Reaction :: create ( $ this -> parsers [ '*' ] ) ; if ( ! ( $ parser instanceof RequestParserInterface ) ) { throw new InvalidConfigException ( 'The fallback request parser is invalid. It must implement the Reaction\\Web\\RequestParserInterface.' ) ; } $ this -> _bodyParams = $ parser -> parse ( $ this -> getRawBody ( ) , $ rawContentType ) ; } elseif ( $ this -> getMethod ( ) === 'POST' ) { // PHP has already parsed the body so we have all params in $_POST $ this -> _bodyParams = $ reactBody ; } else { $ this -> _bodyParams = [ ] ; mb_parse_str ( $ this -> getRawBody ( ) , $ this -> _bodyParams ) ; } } return $ this -> _bodyParams ; }
Returns the request parameters given in the request body.

Request parameters are determined using the parsers configured in [[parsers]] property.
If no parsers are configured for the current [[contentType]] it uses the PHP function `mb_parse_str()`
to parse the [[rawBody|request body]].
@return array the request parameters given in the request body.
@throws \Reaction\Exceptions\InvalidConfigException if a registered parser does not implement the [[RequestParserInterface]].
@see _getMethod()
@see getBodyParam()
@see setBodyParams()
Returns the request parameters given in the request body .