Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
configitem.php
1<?php
2
4
6
12final class ConfigItem
13{
14 public const STRING_TYPE = 'string';
15 public const BOOL_TYPE = 'bool';
16
18 private $code;
19
21 private $type;
22
24 private $isVisible = true;
25
27 private $sort = 1000;
28
30 private $value;
31
37 public function __construct(string $code, string $type)
38 {
39 $this->code = $code;
40
41 if (!in_array($type, [static::STRING_TYPE, static::BOOL_TYPE]))
42 {
43 throw new RuntimeException(sprintf('Unexpected config item type - %s', $type));
44 }
45 $this->type = $type;
46 }
47
51 public function getCode(): string
52 {
53 return $this->code;
54 }
55
59 public function getType(): string
60 {
61 return $this->type;
62 }
63
67 public function getSort(): int
68 {
69 return $this->sort;
70 }
71
76 public function setSort(int $sort): ConfigItem
77 {
78 $this->sort = $sort;
79
80 return $this;
81 }
82
86 public function isVisible(): bool
87 {
88 return $this->isVisible;
89 }
90
95 public function setIsVisible(bool $isVisible): ConfigItem
96 {
97 $this->isVisible = $isVisible;
98
99 return $this;
100 }
101
105 public function getValue()
106 {
107 return $this->value;
108 }
109
114 public function setValue($value): ConfigItem
115 {
116 $this->value = $value;
117
118 return $this;
119 }
120}
__construct(string $code, string $type)