Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
factory.php
1
<?php
2
3
namespace
Bitrix\Location\Entity\Source
;
4
5
use
Bitrix\Location\Entity\Source
;
6
use
Bitrix\Location\Exception\RuntimeException
;
7
use
Bitrix\Location\Source\Google\GoogleSource
;
8
use
Bitrix\Location\Source\Osm\OsmSource
;
9
15
final
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
}
Bitrix\Location\Entity\Source\Factory
Definition
factory.php:16
Bitrix\Location\Entity\Source\Factory\OSM_SOURCE_CODE
const OSM_SOURCE_CODE
Definition
factory.php:18
Bitrix\Location\Entity\Source\Factory\GOOGLE_SOURCE_CODE
const GOOGLE_SOURCE_CODE
Definition
factory.php:17
Bitrix\Location\Entity\Source
Definition
source.php:17
Bitrix\Location\Exception\RuntimeException
Definition
runtimeexception.php:6
Bitrix\Location\Source\Google\GoogleSource
Definition
googlesource.php:22
Bitrix\Location\Source\Osm\OsmSource
Definition
osmsource.php:17
Bitrix\Location\Entity\Source
Definition
config.php:3
modules
location
lib
entity
source
factory.php
Создано системой
1.10.0