1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
controller.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Rest\Configuration\DataProvider
;
4
5
use
Bitrix\Main\SystemException
;
6
use
Bitrix\Rest\Configuration\DataProvider\Disk
;
7
use
Bitrix\Rest\Configuration\DataProvider\IO
;
8
13
class
Controller
14
{
15
public
const
CODE_DISK
=
'disk'
;
16
public
const
CODE_IO
=
'io'
;
17
private
const
ITEM_LIST = [
18
self::CODE_DISK => Disk\Base::class,
19
self::CODE_IO => IO\Base::class,
20
];
21
22
private
$errorList = [];
23
25
private
static
$instance;
26
30
public
static
function
getInstance
():
Controller
31
{
32
if
(self::$instance ===
null
)
33
{
34
self::$instance =
new
Controller
();
35
}
36
37
return
self::$instance;
38
}
39
48
public
function
get
(
string
$code
,
array
$setting = []): ?
ProviderBase
49
{
50
$result
=
null
;
51
52
$class = self::ITEM_LIST[
$code
];
53
if
($class)
54
{
55
$result
= $this->getProvider($class, $setting);
56
}
57
58
return
$result
;
59
}
60
61
private
function
getProvider(
string
$class,
array
$setting = []): ?
ProviderBase
62
{
63
$result
=
null
;
64
if
($class && class_exists($class))
65
{
66
$this->resetErrors();
67
try
68
{
69
$object =
new
$class($setting);
70
if
($object instanceof
ProviderBase
)
71
{
72
$result
= $object;
73
}
74
}
75
catch
(
SystemException
$error
)
76
{
77
$this->setError(
$error
->getCode(),
$error
->getMessage());
78
}
79
}
80
81
return
$result
;
82
}
83
84
private
function
__construct()
85
{
86
}
87
88
private
function
__clone()
89
{
90
}
91
92
private
function
setError(
$code
,
$message
): void
93
{
94
$this->errorList[
$code
] =
$message
;
95
}
96
97
private
function
resetErrors(): bool
98
{
99
$this->errorList = [];
100
101
return
true
;
102
}
103
104
public
function
listError
():
array
105
{
106
return
$this->errorList;
107
}
108
}
Bitrix\Main\SystemException
Определения
SystemException.php:9
Bitrix\Rest\Configuration\DataProvider\Controller
Определения
controller.php:14
Bitrix\Rest\Configuration\DataProvider\Controller\listError
listError()
Определения
controller.php:104
Bitrix\Rest\Configuration\DataProvider\Controller\CODE_IO
const CODE_IO
Определения
controller.php:16
Bitrix\Rest\Configuration\DataProvider\Controller\getInstance
static getInstance()
Определения
controller.php:30
Bitrix\Rest\Configuration\DataProvider\Controller\CODE_DISK
const CODE_DISK
Определения
controller.php:15
Bitrix\Rest\Configuration\DataProvider\ProviderBase
Определения
providerbase.php:15
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$code
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения
options.php:195
Bitrix\Rest\Configuration\DataProvider\Disk
Определения
base.php:3
Bitrix\Rest\Configuration\DataProvider\IO
Определения
base.php:3
Bitrix\Rest\Configuration\DataProvider
Определения
controller.php:3
$message
$message
Определения
payment.php:8
$error
$error
Определения
subscription_card_product.php:20
bitrix
modules
rest
lib
configuration
dataprovider
controller.php
Создано системой
1.14.0