private static function preprocessJsonRequest($request) {

        // check for required parameters

        if (
            !is_object($request) ||
            !property_exists($request, 'jsonrpc') ||
            !property_exists($request, 'method') ||
            $request->jsonrpc != '2.0' ||
            empty($request->method)
        ) {

            return array(
                'ERROR_CODE' => -32600,
                'ERROR_MESSAGE' => 'Invalid Request',
                'ID' => !isset($request['id']) ? null : $request['id']
            );

        }

        // parse request's components

        return array(
            'METHOD' => $request->method,
            'PARAMETERS' => property_exists($request, 'params') ? $request->params : [],
            'ID' => property_exists($request, 'id') ? $request->id : null
        );

    }