RestService :: getTask: Bitrix method

      
<?php 
//  Bitrix\Bizproc\RestService :: getTask()
//  /dist/bitrix/modules/bizproc/lib/restservice.php:1079

    
private static function getTask($id$userId)
    {
        
$dbTask = \CBPTaskService::getList(
            array(),
            array(
"ID" => (int)$id"USER_ID" => $userId),
            
false,
            
false,
            array(
"ID""WORKFLOW_ID""ACTIVITY""ACTIVITY_NAME""MODIFIED""OVERDUE_DATE""NAME""DESCRIPTION""PARAMETERS""USER_STATUS")
        );
        
$task $dbTask->fetch();

        if (!
$task)
        {
            throw new 
RestException('Task not found'self::ERROR_TASK_NOT_FOUND);
        }
        elseif ((int)
$task['USER_STATUS'] !== \CBPTaskUserStatus::Waiting)
        {
            throw new 
RestException('Task already completed'self::ERROR_TASK_COMPLETED);
        }

        if (
$task)
        {
            
$task["PARAMETERS"]["DOCUMENT_ID"] = \CBPStateService::getStateDocumentId($task['WORKFLOW_ID']);
            
$task["MODULE_ID"] = $task["PARAMETERS"]["DOCUMENT_ID"][0];
            
$task["ENTITY"] = $task["PARAMETERS"]["DOCUMENT_ID"][1];
            
$task["DOCUMENT_ID"] = $task["PARAMETERS"]["DOCUMENT_ID"][2];
        }

        return 
$task;
    }