1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
byqueryconverter.php
См. документацию.
1<?php
2
3namespace Bitrix\Location\Source\Google\Converters;
4
5use Bitrix\Location\Entity\Address;
6use Bitrix\Location\Entity\Location;
7use Bitrix\Location\Entity\Generic\Collection;
8use Bitrix\Location\Exception\RuntimeException;
9use Bitrix\Location\Source\Google;
10
17{
22 public function convert(array $data)
23 {
24 if(isset($data['status']) && $data['status'] != 'OK')
25 {
26 $errorMessage = $data['error_message'].' ('.$data['status'].')' ?? $data['status'];
28 }
29
30 if(!isset($data['results']) || !is_array($data['results']))
31 {
32 return null;
33 }
34
35 $result = new Collection;
36
37 foreach($data['results'] as $item)
38 {
39 if(isset($item['types']))
40 {
41 $type = $this->convertTypes($item['types'], Location\Type::class);
42 }
43 else
44 {
46 }
47
48 $location = (new Location())
49 ->setSourceCode(Google\Repository::getSourceCode())
50 ->setExternalId($item['place_id'])
51 ->setName($item['name'])
52 ->setLongitude($item['geometry']['location']['lng'])
53 ->setLatitude($item['geometry']['location']['lat'])
54 ->setType($type)
55 ->setLanguageId($this->languageId);
56
57 $result->addItem($location);
58 }
59
60 return $result;
61 }
62}
63
$type
Определения options.php:106
convertTypes(array $types, string $typesClass)
Определения baseconverter.php:44
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
while($arParentIBlockProperty=$dbParentIBlockProperty->Fetch()) $errorMessage
$location
Определения options.php:2729