- Модуль: location
- Путь к файлу: ~/bitrix/modules/location/lib/source/osm/converters/baseconverter.php
- Класс: BitrixLocationSourceOsmConvertersBaseConverter
- Вызов: BaseConverter::makeAddressFieldCollection
private function makeAddressFieldCollection(string $languageId): AddressFieldCollection
{
$result = new AddressFieldCollection();
$postalCode = $this->getPostalCode();
if ($postalCode)
{
$result->addItem(
(new Field(FieldType::POSTAL_CODE))->setValue($postalCode)
);
}
$country = $this->getCountry();
if ($country && isset($country['localname']))
{
$result->addItem(
(new Field(FieldType::COUNTRY))->setValue($country['localname'])
);
}
$adminLevel1 = $this->getAdminLevel1();
if ($adminLevel1 && isset($adminLevel1['localname']))
{
$result->addItem(
(new Field(FieldType::ADM_LEVEL_1))->setValue($adminLevel1['localname'])
);
}
$adminLevel2 = $this->getAdminLevel2();
if ($adminLevel2 && isset($adminLevel2['localname']))
{
$result->addItem(
(new Field(FieldType::ADM_LEVEL_2))->setValue($adminLevel2['localname'])
);
}
$adminLevel3 = $this->getAdminLevel3();
if ($adminLevel3 && isset($adminLevel3['localname']))
{
$result->addItem(
(new Field(FieldType::ADM_LEVEL_3))->setValue($adminLevel3['localname'])
);
}
$adminLevel4 = $this->getAdminLevel4();
if ($adminLevel4 && isset($adminLevel4['localname']))
{
$result->addItem(
(new Field(FieldType::ADM_LEVEL_4))->setValue($adminLevel4['localname'])
);
}
$locality = $this->getLocality();
if ($locality && isset($locality['localname']))
{
$result->addItem(
(new Field(FieldType::LOCALITY))->setValue($locality['localname'])
);
}
$subLocality = $this->getSubLocality();
if ($subLocality && isset($subLocality['localname']))
{
$result->addItem(
(new Field(FieldType::SUB_LOCALITY))->setValue($subLocality['localname'])
);
}
$subLocalityLevel1 = $this->getSubLocalityLevel1();
if ($subLocalityLevel1 && isset($subLocalityLevel1['localname']))
{
$result->addItem(
(new Field(FieldType::SUB_LOCALITY_LEVEL_1))->setValue($subLocalityLevel1['localname'])
);
}
$subLocalityLevel2 = $this->getSubLocalityLevel2();
if ($subLocalityLevel2 && isset($subLocalityLevel2['localname']))
{
$result->addItem(
(new Field(FieldType::SUB_LOCALITY_LEVEL_2))->setValue($subLocalityLevel2['localname'])
);
}
$street = $this->getStreet();
if ($street && isset($street['localname']))
{
$result->addItem(
(new Field(FieldType::STREET))->setValue($street['localname'])
);
}
$house = $this->getHouse();
if ($house && isset($house['localname']))
{
$result->addItem(
(new Field(FieldType::BUILDING))->setValue($house['localname'])
);
}
$addressLine2 = $this->getAddressLine2();
if ($addressLine2 && isset($addressLine2['localname']))
{
$result->addItem(
(new Field(FieldType::ADDRESS_LINE_2))->setValue($addressLine2['localname'])
);
}
return $result;
}