1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
ancestordataconverter.php
См. документацию.
1<?php
2
4
7
9{
10 public function convert(array $locationRawData, int $descendantType)
11 {
12 $result = [];
13
14 if(isset($locationRawData['result']['address_components'])
15 && is_array($locationRawData['result']['address_components'])
16 && count($locationRawData['result']['address_components']) > 0
17 )
18 {
19 $items = array_reverse($locationRawData['result']['address_components']);
20 $accumulator = '';
21
22 foreach ($items as $item)
23 {
24 $types =$this->convertTypes($item['types'], $descendantType);
25
26 if(empty($types))
27 {
28 continue;
29 }
30
31 if($accumulator <> '')
32 {
33 $accumulator .= ',';
34 }
35
36 $accumulator .= $item['long_name'];
37
38 $result[] = [
39 'NAME' => $accumulator,
40 'TYPES' => $types
41 ];
42 }
43 }
44
45 return array_reverse($result);
46 }
47
48 protected function convertTypes(array $types, int $descendantType)
49 {
50 $result = [];
51
52 foreach($types as $gType)
53 {
55
56 if($type === Type::UNKNOWN)
57 {
58 continue;
59 }
60
61 //Only location type
62 if(!Type::isValueExist($type))
63 {
64 continue;
65 }
66
67 //Type::COUNTRY == 100 Type::LOCALITY == 300
68 if($descendantType !== Type::UNKNOWN && $descendantType <= $type)
69 {
70 continue;
71 }
72
73 $result[] = $type;
74 }
75
76 return $result;
77 }
78}
$type
Определения options.php:106
convert(array $locationRawData, int $descendantType)
Определения ancestordataconverter.php:10
convertTypes(array $types, int $descendantType)
Определения ancestordataconverter.php:48
</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
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$items
Определения template.php:224