Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
finder.php
1
<?php
2
3
namespace
Bitrix\Location\Source\Google
;
4
5
use
Bitrix\Location\Entity\Location
;
6
use
Bitrix\Location\Entity\Generic\Collection
;
7
use
Bitrix\Location\Exception\RuntimeException
;
8
use
Bitrix\Location\Source\Google\Converters\BaseConverter
;
9
use
Bitrix\Location\Source\Google\Requesters\BaseRequester
;
10
16
final
class
Finder
17
{
18
protected
$requester
;
19
protected
$converter
;
20
26
public
function
__construct
(
BaseRequester
$requester
,
BaseConverter
$converter
=
null
)
27
{
28
$this->requester =
$requester
;
29
$this->converter =
$converter
;
30
}
31
37
public
function
find
(array $fields)
38
{
39
$rawData = $this->requester->request($fields);
40
41
if
(
42
is_array($rawData)
43
&& isset($rawData[
'status'
]) && $rawData[
'status'
] !==
'OK'
44
&& isset($rawData[
'error_message'
]) && $rawData[
'error_message'
] <>
''
45
)
46
{
47
throw
new
RuntimeException
($rawData[
'error_message'
],
ErrorCodes::FINDER_ERROR
);
48
}
49
50
return
$this->converter !==
null
? $this->converter->convert($rawData) : $rawData;
51
}
52
}
Bitrix\Location\Entity\Generic\Collection
Definition
collection.php:12
Bitrix\Location\Exception\RuntimeException
Definition
runtimeexception.php:6
Bitrix\Location\Source\Google\Converters\BaseConverter
Definition
baseconverter.php:17
Bitrix\Location\Source\Google\ErrorCodes\FINDER_ERROR
const FINDER_ERROR
Definition
errorcodes.php:15
Bitrix\Location\Source\Google\Finder
Definition
finder.php:17
Bitrix\Location\Source\Google\Finder\__construct
__construct(BaseRequester $requester, BaseConverter $converter=null)
Definition
finder.php:26
Bitrix\Location\Source\Google\Finder\find
find(array $fields)
Definition
finder.php:37
Bitrix\Location\Source\Google\Finder\$requester
$requester
Definition
finder.php:18
Bitrix\Location\Source\Google\Finder\$converter
$converter
Definition
finder.php:19
Bitrix\Location\Source\Google\Requesters\BaseRequester
Definition
baserequester.php:19
Bitrix\Location\Entity\Location
Definition
collection.php:3
Bitrix\Location\Source\Google
Definition
configfactory.php:3
modules
location
lib
source
google
finder.php
Создано системой
1.10.0