RestService::completeTask: Bitrix method

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

    
public static function completeTask($params$n$server)
    {
        
$params array_change_key_case($paramsCASE_UPPER);
        
self::validateTaskParameters($params);

        
$userId self::getCurrentUserId();
        
$task = static::getTask($params['TASK_ID'], $userId);

        if (
$task['ACTIVITY'] !== 'ReviewActivity' && $task['ACTIVITY'] !== 'ApproveActivity')
        {
            throw new 
RestException('Incorrect task type'self::ERROR_TASK_TYPE);
        }

        
$errors = array();
        
$request = array(
            
'INLINE_USER_STATUS' => \CBPTaskUserStatus::resolveStatus($params['STATUS']),
            
'task_comment' => !empty($params['COMMENT']) && is_string($params['COMMENT']) ? $params['COMMENT'] : null
        
);

        if (!\
CBPDocument::postTaskForm($task$userId$request$errors))
        {
            throw new 
RestException($errors[0]["message"], self::ERROR_TASK_EXECUTION);
        }

        return 
true;
    }