protected function getParsedBodyParam(ServerRequestInterface $request, $param_name, $default = null)
    {
        $parsed_body = $request->getParsedBody();

        if ($parsed_body) {
            if (is_array($parsed_body) && array_key_exists($param_name, $parsed_body)) {
                return $parsed_body[$param_name];
            } elseif (is_object($parsed_body) && property_exists($parsed_body, $param_name)) {
                return $parsed_body->$param_name;
            }
        }

        return $default;
    }
protected function getParsedBodyParam(ServerRequestInterface $request, $param_name, $default = null)
    {
        $parsed_body = $request->getParsedBody();

        if ($parsed_body) {
            if (is_array($parsed_body) && array_key_exists($param_name, $parsed_body)) {
                return $parsed_body[$param_name];
            } elseif (is_object($parsed_body) && property_exists($parsed_body, $param_name)) {
                return $parsed_body->$param_name;
            }
        }

        return $default;
    }
protected function getParsedBodyParam ( ServerRequestInterface $ request , $ param_name , $ default = null ) { $ parsed_body = $ request -> getParsedBody ( ) ; if ( $ parsed_body ) { if ( is_array ( $ parsed_body ) && array_key_exists ( $ param_name , $ parsed_body ) ) { return $ parsed_body [ $ param_name ] ; } elseif ( is_object ( $ parsed_body ) && property_exists ( $ parsed_body , $ param_name ) ) { return $ parsed_body -> $ param_name ; } } return $ default ; }
Return a param from a parsed body.

This method is NULL or object safe - it will check for body type, and do it's best to return a value without
breaking or throwing a warning.

@param  ServerRequestInterface $request
@param                         $param_name
@param  null                   $default
@return mixed|null
Return a param from a parsed body .