Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
config.php
1<?php
2
4
6
10class Config
11{
12 private string $name;
13 private string $type;
14 private ?string $placeholder;
15 private ?bool $disabled;
16
22 public function __construct(string $name, ?string $type = null)
23 {
24 $this->name = $name;
25 $this->type = $type ?? Types::TEXT;
26 }
27
33 public function getType(): string
34 {
35 return $this->type;
36 }
37
45 public function setName(string $value): self
46 {
47 $this->name = $value;
48
49 return $this;
50 }
51
57 public function getName(): string
58 {
59 return $this->name;
60 }
61
69 public function setPlaceholder(string $value): self
70 {
71 $this->placeholder = $value;
72
73 return $this;
74 }
75
83 public function setDisabled(bool $value): self
84 {
85 $this->disabled = $value;
86
87 return $this;
88 }
89
96 public function toArray(): array
97 {
98 $result = [
99 'NAME' => $this->name,
100 'TYPE' => $this->type,
101 ];
102
103 if (isset($this->placeholder))
104 {
105 $result['PLACEHOLDER'] = $this->placeholder;
106 }
107
108 if (isset($this->disabled))
109 {
110 $result['DISABLED'] = $this->disabled;
111 }
112
113 return $result;
114 }
115}
__construct(string $name, ?string $type=null)
Definition config.php:22