Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
usconverter.php
1
<?php
2
3
namespace
Bitrix\Location\Source\Osm\Converters
;
4
13
final
class
UsConverter
extends
BaseConverter
14
{
16
private
const
STATE_ADMIN_LEVEL = 4;
17
19
private
const
COUNTY_ADMIN_LEVEL = 6;
20
26
private
const
NY_STATE_RELATION_ID = 61320;
27
29
private
const
NY_CITY_ADMIN_LEVEL = 5;
30
34
protected
function
getAdminLevel1
(): ?array
35
{
36
foreach
($this->addressComponents as $addressComponent)
37
{
38
if
($this->
isAdministrativeBoundary
($addressComponent)
39
&& $addressComponent[
'admin_level'
] === static::STATE_ADMIN_LEVEL
40
)
41
{
42
return
$addressComponent;
43
}
44
}
45
46
return
null
;
47
}
48
52
protected
function
getAdminLevel2
(): ?array
53
{
54
foreach
($this->addressComponents as $addressComponent)
55
{
56
if
($this->
isAdministrativeBoundary
($addressComponent)
57
&& $addressComponent[
'admin_level'
] === static::COUNTY_ADMIN_LEVEL
58
)
59
{
60
return
$addressComponent;
61
}
62
}
63
64
return
null
;
65
}
66
70
protected
function
getLocalityConcrete
(): ?array
71
{
72
if
($this->
isCityState
())
73
{
74
foreach
($this->addressComponents as $addressComponent)
75
{
76
if
($addressComponent[
'class'
] ===
'boundary'
77
&& $addressComponent[
'type'
] ===
'administrative'
78
&& $addressComponent[
'admin_level'
] === static::NY_CITY_ADMIN_LEVEL
79
)
80
{
81
return
$addressComponent;
82
}
83
}
84
}
85
86
return
parent::getLocalityConcrete();
87
}
88
92
protected
function
getCityStateRelationIds
(): array
93
{
94
return
[
95
static::NY_STATE_RELATION_ID,
96
];
97
}
98
}
Bitrix\Location\Source\Osm\Converters\BaseConverter
Definition
baseconverter.php:27
Bitrix\Location\Source\Osm\Converters\BaseConverter\isAdministrativeBoundary
isAdministrativeBoundary($addressComponent)
Definition
baseconverter.php:593
Bitrix\Location\Source\Osm\Converters\BaseConverter\isCityState
isCityState()
Definition
baseconverter.php:404
Bitrix\Location\Source\Osm\Converters\UsConverter
Definition
usconverter.php:14
Bitrix\Location\Source\Osm\Converters\UsConverter\getAdminLevel2
getAdminLevel2()
Definition
usconverter.php:52
Bitrix\Location\Source\Osm\Converters\UsConverter\getAdminLevel1
getAdminLevel1()
Definition
usconverter.php:34
Bitrix\Location\Source\Osm\Converters\UsConverter\getLocalityConcrete
getLocalityConcrete()
Definition
usconverter.php:70
Bitrix\Location\Source\Osm\Converters\UsConverter\getCityStateRelationIds
getCityStateRelationIds()
Definition
usconverter.php:92
Bitrix\Location\Source\Osm\Converters
Definition
baseconverter.php:3
modules
location
lib
source
osm
converters
usconverter.php
Создано системой
1.10.0