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;
149 && isset($result[
'status'])
150 && $result[
'status'] ===
'OK'
153 $this->cachePool->addItem(
156 'httpRes' => $httpRes,
166 $message =
'Http status: '.$status
168 .
' Answer: '. $httpRes;