1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
factory.php
См. документацию.
1<?php
2
3namespace Bitrix\Location\Entity\Source;
4
5use Bitrix\Location\Entity\Source;
6use Bitrix\Location\Exception\RuntimeException;
7use Bitrix\Location\Source\Google\GoogleSource;
8use Bitrix\Location\Source\Osm\OsmSource;
9
15final class Factory
16{
17 public const GOOGLE_SOURCE_CODE = 'GOOGLE';
18 public const OSM_SOURCE_CODE = 'OSM';
19
24 public static function makeSource(string $code): Source
25 {
26 $class = null;
27
28 switch ($code)
29 {
30 case static::GOOGLE_SOURCE_CODE:
31 $class = GoogleSource::class;
32 break;
33 case static::OSM_SOURCE_CODE:
34 $class = OsmSource::class;
35 break;
36 }
37
38 if (is_null($class))
39 {
40 throw new RuntimeException(sprintf('Unexpected source code - %s', $code));
41 }
42
44 return (new $class())->setCode($code);
45 }
46}
const GOOGLE_SOURCE_CODE
Определения factory.php:17
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195