Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
manager.php
1<?php
2
4
7
8class Manager
9{
10 public const FORMAT_GEOJSON = 'geojson';
11 public const FORMAT_ARRAY = 'array';
12
18 public static function read($input, string $format): ?BaseGeometry
19 {
20 return self::makeConverter($format)->read($input);
21 }
22
28 public static function write(BaseGeometry $geometry, string $format)
29 {
30 return self::makeConverter($format)->write($geometry);
31 }
32
38 public static function makeConverter(string $format): Converter
39 {
40 $map = [
41 self::FORMAT_GEOJSON => GeoJsonConverter::class,
42 self::FORMAT_ARRAY => ArrayConverter::class,
43 ];
44
45 if (!isset($map[$format]))
46 {
47 throw new SystemException('Converter has not been found');
48 }
49
50 return new $map[$format];
51 }
52}
static write(BaseGeometry $geometry, string $format)
Definition manager.php:28
static read($input, string $format)
Definition manager.php:18
static makeConverter(string $format)
Definition manager.php:38