public function getParsedBodyParam($name, $defaultValue = null)
    {
        $params = $this->getParsedBody();

        if (is_object($params)) {
            // unable to use `ArrayHelper::getValue()` due to different dots in key logic and lack of exception handling
            try {
                return $params->{$name};
            } catch (\Exception $e) {
                return $defaultValue;
            }
        }

        return $params[$name] ?? $defaultValue;
    }
public function getParsedBodyParam($name, $defaultValue = null)
    {
        $params = $this->getParsedBody();

        if (is_object($params)) {
            // unable to use `ArrayHelper::getValue()` due to different dots in key logic and lack of exception handling
            try {
                return $params->{$name};
            } catch (\Exception $e) {
                return $defaultValue;
            }
        }

        return $params[$name] ?? $defaultValue;
    }
public function getParsedBodyParam ( $ name , $ defaultValue = null ) { $ params = $ this -> getParsedBody ( ) ; if ( is_object ( $ params ) ) { // unable to use `ArrayHelper::getValue()` due to different dots in key logic and lack of exception handling try { return $ params -> { $ name } ; } catch ( \ Exception $ e ) { return $ defaultValue ; } } return $ params [ $ name ] ?? $ defaultValue ; }
Returns the named request body parameter value.
If the parameter does not exist, the second parameter passed to this method will be returned.
@param string $name the parameter name
@param mixed $defaultValue the default parameter value if the parameter does not exist.
@return mixed the parameter value
@see getParsedBody()
@see setParsedBody()
Returns the named request body parameter value . If the parameter does not exist the second parameter passed to this method will be returned .