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

        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 isset($params[$name]) ? $params[$name] : $defaultValue;
    }
public function getBodyParam($name, $defaultValue = null)
    {
        $params = $this->getBodyParams();

        if (is_object($params)) {
            
            try {
                return $params->{$name};
            } catch (\Exception $e) {
                return $defaultValue;
            }
        }

        return isset($params[$name]) ? $params[$name] : $defaultValue;
    }
public function getBodyParam ( $ name , $ defaultValue = null ) { $ params = $ this -> getBodyParams ( ) ; 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 isset ( $ params [ $ name ] ) ? $ 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 getBodyParams()
@see setBodyParams()
Returns the named request body parameter value . If the parameter does not exist the second parameter passed to this method will be returned .