Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
geojsonconverter.php
1
<?php
2
3
namespace
Bitrix\Location\Geometry\Converter
;
4
5
use
Bitrix\Location\Geometry\Type\BaseGeometry
;
6
use
Bitrix\Main\Web\Json
;
7
use
Bitrix\Main\ArgumentException
;
8
9
class
GeoJsonConverter
extends
ArrayConverter
10
{
15
public
function
read
($input): ?
BaseGeometry
16
{
17
try
18
{
19
$input = Json::decode($input);
20
}
21
catch
(
ArgumentException
$ex)
22
{
23
return
null
;
24
}
25
26
if
(!is_array($input))
27
{
28
return
null
;
29
}
30
31
return
parent::read($input);
32
}
33
37
public
function
write
(
BaseGeometry
$geometry)
38
{
39
return
Json::encode(
40
parent::write($geometry)
41
);
42
}
43
}
Bitrix\Location\Geometry\Converter\ArrayConverter
Definition
arrayconverter.php:14
Bitrix\Location\Geometry\Converter\GeoJsonConverter
Definition
geojsonconverter.php:10
Bitrix\Location\Geometry\Converter\GeoJsonConverter\write
write(BaseGeometry $geometry)
Definition
geojsonconverter.php:37
Bitrix\Location\Geometry\Converter\GeoJsonConverter\read
read($input)
Definition
geojsonconverter.php:15
Bitrix\Location\Geometry\Type\BaseGeometry
Definition
basegeometry.php:6
Bitrix\Main\ArgumentException
Definition
exception.php:34
Bitrix\Main\Web\Json
Definition
json.php:11
Bitrix\Location\Geometry\Converter
Definition
arrayconverter.php:3
modules
location
lib
geometry
converter
geojsonconverter.php
Создано системой
1.10.0