1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
controller.php
См. документацию.
1<?php
2
4
8
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 }
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}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
$message
Определения payment.php:8
$error
Определения subscription_card_product.php:20