Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
rangeconfig.php
1<?php
2
4
6
7class RangeConfig extends Config
8{
9 private ?float $min;
10 private ?float $max;
11 private ?float $step;
12
19 public function __construct(string $name, ?float $min = null, ?float $max = null, ?float $step = null)
20 {
21 parent::__construct($name, Types::RANGE);
22
23 $this->min = $min;
24 $this->max = $max;
25 $this->step = $step;
26 }
27
35 public function setMin(float $value): self
36 {
37 $this->min = $value;
38
39 return $this;
40 }
41
49 public function setMax(float $value): self
50 {
51 $this->max = $value;
52
53 return $this;
54 }
55
63 public function setStep(float $value): self
64 {
65 $this->step = $value;
66
67 return $this;
68 }
69
73 public function toArray(): array
74 {
75 $result = parent::toArray();
76
77 if (isset($this->min))
78 {
79 $result['DATA']['MIN'] = $this->min;
80 }
81
82 if (isset($this->max))
83 {
84 $result['DATA']['MAX'] = $this->max;
85 }
86
87 if (isset($this->step))
88 {
89 $result['DATA']['STEP'] = $this->step;
90 }
91
92 return $result;
93 }
94}
__construct(string $name, ?float $min=null, ?float $max=null, ?float $step=null)