Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
BaseSettings.php
1<?php
2
4
8
9abstract class BaseSettings implements RestConvertible
10{
11 protected array $settings = [];
12
13 protected ?int $groupId;
14
15 protected bool $isLoad = false;
16
20 public function __construct(?int $groupId)
21 {
22 $this->groupId = $groupId;
23 }
24
25 abstract public function updateSetting(array $settingConfiguration);
26 abstract public function fillDataBase(): BaseSettings;
27
28 // TODO return int|array
29 abstract public function load($source): BaseSettings;
30
34 public function getSettings(): Result
35 {
36 $result = new Result();
37 if ($this->groupId === null)
38 {
39 return $result->addError(new SettingsError(SettingsError::UNDEFINED_GROUP_ID));
40 }
41
42 if (!$this->isLoad())
43 {
44 $this->load($this->groupId);
45 }
46
47 return $result->setResult($this->settings);
48 }
49
50 public function isLoad(): bool
51 {
52 return $this->isLoad;
53 }
54}
updateSetting(array $settingConfiguration)