Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
proxyrequest.php
1<?
2
4
7
8class ProxyRequest extends Request
9{
11
19 public function query(array $params = array())
20 {
21 if ($this->useDirectQuery)
22 {
23 return $this->directQuery($params);
24 }
25
26 $methodName = static::REST_METHOD_PREFIX . '.' . $params['methodName'];
27 $parameters = $params['parameters'];
28 $engine = new Engine\Bitrix();
29 if (!$engine->isRegistered())
30 {
31 return false;
32 }
33 $parameters['proxy_client_id'] = $this->getAuthAdapter()->getClientId();
34 $parameters['lang'] = LANGUAGE_ID;
35
36 $transport = $engine->getInterface()->getTransport();
37 if ($params['timeout'])
38 {
39 $transport->setTimeout($params['timeout']);
40 }
41 $response = $transport->call($methodName, $parameters);
42 if ($response['result']['RESULT'])
43 {
44 return $response['result']['RESULT'];
45 }
46 if ($response['error'])
47 {
48 throw new InvalidOperationException($response['error_description'] ? $response['error_description'] : $response['error']);
49 }
50 return [];
51 }
52}