3namespace Bitrix\Location\Source\Google\Requesters;
5use Bitrix\Location\Common\CachedPool;
6use Bitrix\Location\Exception\RuntimeException;
7use Bitrix\Location\Infrastructure\Service\LoggerService;
8use Bitrix\Location\Infrastructure\Service\LoggerService\LogLevel;
9use Bitrix\Location\Infrastructure\Service\LoggerService\EventType;
10use Bitrix\Location\Source\Google\ErrorCodes;
11use Bitrix\Main\Web\HttpClient;
12use Bitrix\Main\Web\Json;
53 return $this->urlMaker->make(
56 $this->requiredFields,
66 return LoggerService::getInstance();
76 preg_replace(
'/&location=[0-9.,]*&/',
'&',
$url)
92 $takenFromCache =
false;
94 if($this->cachePool && $cachedAnswer = $this->cachePool->getItem($cacheItemKey))
96 $httpRes = $cachedAnswer[
'httpRes'];
97 $errors = $cachedAnswer[
'errors'];
98 $status = $cachedAnswer[
'status'];
100 $takenFromCache =
true;
104 if (@$this->httpClient->get(
$url))
106 $httpRes = $this->httpClient->getResult();
109 $errors = $this->httpClient->getError();
110 $status = $this->httpClient->getStatus();
115 '{"httpRes":"'.$httpRes.
'","errors":"'. $this->convertErrorsToString(
$errors).
'","status":"'.
$status.
'"}',
119 if(!$httpRes && !empty(
$errors))
134 $result = Json::decode($httpRes);
138 $message =
'Can\'t decode Google server\'s answer.'
140 .
' Answer: '. $httpRes;
153 $this->cachePool->addItem(
156 'httpRes' => $httpRes,
168 .
' Answer: '. $httpRes;
const SOURCE_GOOGLE_REQUESTER_RESULT
const SOURCE_GOOGLE_REQUESTER_URL
const REQUESTER_BASE_HTTP_ERROR
const REQUESTER_BASE_JSON_ERROR
const REQUESTER_BASE_STATUS_ERROR
__construct(HttpClient $httpClient, CachedPool $cachePool=null)
createCacheItemKey(string $url)
convertErrorsToString(array $errors)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']