protected function processRequest($requestData)
    {
        $responseData = ['jsonrpc' => '2.0'];

        try {
            $method = ArrayHelper::getValue($requestData, 'method', '-');
            \Yii::trace('Running JSON-RPC 2.0 method: ' . $method, 'jsonrpc\Action::processRequest');

            \Yii::beginProfile('jsonrpc.controller.rpc.' . $method);

            $requestModel = $this->getRequestModel($requestData);
            $responseData['id'] = $requestModel->id;

            $reflectionMethod = $this->getControllerMethod($requestModel->method);
            $methodParams = $this->getMethodParams($reflectionMethod, $requestModel->params);

            $responseData['result'] = $this->runControllerAction($reflectionMethod->getName(), $methodParams);

            \Yii::endProfile('jsonrpc.controller.rpc.' . ArrayHelper::getValue($requestData, 'method', '-'));
        } catch (\Exception $ex) {
            unset($responseData['result']);

            $responseData['error'] = [
                'code' => $ex->getCode(),
                'message' => $ex->getMessage(),
                'data' => ($ex instanceof ValidationException) 
                    ? $ex->getData()
                    : null,
            ];
        }

        return $responseData;
    }
protected function processRequest($requestData)
    {
        $responseData = ['jsonrpc' => '2.0'];

        try {
            $method = ArrayHelper::getValue($requestData, 'method', '-');
            \Yii::trace('Running JSON-RPC 2.0 method: ' . $method, 'jsonrpc\Action::processRequest');

            \Yii::beginProfile('jsonrpc.controller.rpc.' . $method);

            $requestModel = $this->getRequestModel($requestData);
            $responseData['id'] = $requestModel->id;

            $reflectionMethod = $this->getControllerMethod($requestModel->method);
            $methodParams = $this->getMethodParams($reflectionMethod, $requestModel->params);

            $responseData['result'] = $this->runControllerAction($reflectionMethod->getName(), $methodParams);

            \Yii::endProfile('jsonrpc.controller.rpc.' . ArrayHelper::getValue($requestData, 'method', '-'));
        } catch (\Exception $ex) {
            unset($responseData['result']);

            $responseData['error'] = [
                'code' => $ex->getCode(),
                'message' => $ex->getMessage(),
                'data' => ($ex instanceof ValidationException) 
                    ? $ex->getData()
                    : null,
            ];
        }

        return $responseData;
    }
protected function processRequest ( $ requestData ) { $ responseData = [ 'jsonrpc' => '2.0' ] ; try { $ method = ArrayHelper :: getValue ( $ requestData , 'method' , '-' ) ; \ Yii :: trace ( 'Running JSON-RPC 2.0 method: ' . $ method , 'jsonrpc\Action::processRequest' ) ; \ Yii :: beginProfile ( 'jsonrpc.controller.rpc.' . $ method ) ; $ requestModel = $ this -> getRequestModel ( $ requestData ) ; $ responseData [ 'id' ] = $ requestModel -> id ; $ reflectionMethod = $ this -> getControllerMethod ( $ requestModel -> method ) ; $ methodParams = $ this -> getMethodParams ( $ reflectionMethod , $ requestModel -> params ) ; $ responseData [ 'result' ] = $ this -> runControllerAction ( $ reflectionMethod -> getName ( ) , $ methodParams ) ; \ Yii :: endProfile ( 'jsonrpc.controller.rpc.' . ArrayHelper :: getValue ( $ requestData , 'method' , '-' ) ) ; } catch ( \ Exception $ ex ) { unset ( $ responseData [ 'result' ] ) ; $ responseData [ 'error' ] = [ 'code' => $ ex -> getCode ( ) , 'message' => $ ex -> getMessage ( ) , 'data' => ( $ ex instanceof ValidationException ) ? $ ex -> getData ( ) : null , ] ; } return $ responseData ; }
Validates JSON-RPC request, initializes controller action parameters and runs the action
@param array $requestData
@return array Controller action response
Validates JSON - RPC request initializes controller action parameters and runs the action