- Модуль: rest
- Путь к файлу: ~/bitrix/modules/rest/classes/general/rest.php
- Класс: CRestServer
- Вызов: CRestServer::processCall
protected function processCall()
{
if (
LoadLimiter::is(
$this->getAuthType(),
!empty($this->getClientId()) ? $this->getClientId() : $this->getPasswordId(),
$this->method
)
)
{
throw new RestException('Method is blocked due to operation time limit.', RestException::ERROR_OPERATION_TIME_LIMIT, self::STATUS_TO_MANY_REQUESTS);
}
$start = 0;
if(isset($this->query['start']))
{
$start = intval($this->query['start']);
unset($this->query['start']);
}
$callback = $this->getMethodCallback();
if(!$callback)
{
throw new RestException('Method not found!', RestException::ERROR_METHOD_NOT_FOUND, self::STATUS_NOT_FOUND);
}
$this->timeProcessStart = microtime(true);
if(BitrixMainModuleManager::isModuleInstalled('bitrix24') && function_exists('getrusage'))
{
$this->usage = getrusage();
}
$entity = !empty($this->getClientId()) ? $this->getClientId() : $this->getPasswordId();
LoadLimiter::registerStarting(
$this->getAuthType(),
$entity,
$this->method
);
$result = call_user_func_array($callback, array($this->query, $start, $this));
LoadLimiter::registerEnding(
$this->getAuthType(),
$entity,
$this->method
);
$this->timeProcessFinish = microtime(true);
if (!empty($result['error']) && !empty($result['error_description']))
{
return $result;
}
$result = array("result" => $result);
if(is_array($result['result']))
{
if(isset($result['result']['next']))
{
$result["next"] = intval($result['result']['next']);
unset($result['result']['next']);
}
//Using array_key_exists instead isset for process NULL values
if(array_key_exists('total', $result['result']))
{
$result['total'] = intval($result['result']['total']);
unset($result['result']['total']);
}
}
if($this->securityClientState != null && $this->securityMethodState != null)
{
$result['signature'] = $this->getApplicationSignature();
}
$result = $this->appendDebugInfo($result);
return $result;
}