PluginProbe
The Innovative Form Builder – IvyForms / 1.1
The Innovative Form Builder – IvyForms v1.1
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / ValueObjects / Field / DateFieldGeneralSettings.php

DateFieldGeneralSettings.php in The Innovative Form Builder – IvyForms 1.1, at backend/src/ValueObjects/Field/DateFieldGeneralSettings.php

149 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * @copyright © Melograno Venture Studio. All rights reserved.
5 * @licence See LICENCE.md for license details.
6 */
7
8 namespace IvyForms\ValueObjects\Field;
9
10 /**
11 * Class DateFieldGeneralSettings
12 *
13 * Encapsulates date-specific settings extracted from FieldGeneralSettings.
14 */
15 final class DateFieldGeneralSettings
16 {
17 /**
18 * @var string
19 */
20 private string $dateFieldType;
21
22 /**
23 * @var string
24 */
25 private string $dateFormat;
26
27 /**
28 * @var string|null
29 */
30 private ?string $minDateValue;
31
32 /**
33 * @var string|null
34 */
35 private ?string $maxDateValue;
36 /**
37 * @var bool
38 */
39 private bool $limitDateRange;
40
41 public function __construct(
42 bool $limitDateRange,
43 string $dateFieldType = '',
44 string $dateFormat = '',
45 ?string $minDateValue = null,
46 ?string $maxDateValue = null
47 ) {
48 $this->limitDateRange = $limitDateRange;
49 $this->dateFieldType = $dateFieldType;
50 $this->dateFormat = $dateFormat;
51 $this->minDateValue = $minDateValue;
52 $this->maxDateValue = $maxDateValue;
53 }
54
55 /**
56 * Get dateFieldType.
57 */
58 public function getDateFieldType(): string
59 {
60 return $this->dateFieldType;
61 }
62
63 /**
64 * Set dateFieldType.
65 */
66 public function setDateFieldType(string $dateFieldType): void
67 {
68 $this->dateFieldType = $dateFieldType;
69 }
70
71 /**
72 * Get dateFormat.
73 */
74 public function getDateFormat(): string
75 {
76 return $this->dateFormat;
77 }
78
79 /**
80 * Set dateFormat.
81 */
82 public function setDateFormat(string $dateFormat): void
83 {
84 $this->dateFormat = $dateFormat;
85 }
86
87 /**
88 * Get minDateValue.
89 */
90 public function getMinDateValue(): ?string
91 {
92 return $this->minDateValue;
93 }
94
95 /**
96 * Set minDateValue.
97 */
98 public function setMinDateValue(?string $minDateValue): void
99 {
100 $this->minDateValue = $minDateValue;
101 }
102
103 /**
104 * Get maxDateValue.
105 */
106 public function getMaxDateValue(): ?string
107 {
108 return $this->maxDateValue;
109 }
110
111 /**
112 * Set maxDateValue.
113 */
114 public function setMaxDateValue(?string $maxDateValue): void
115 {
116 $this->maxDateValue = $maxDateValue;
117 }
118
119 /**
120 * @return bool
121 */
122 public function isLimitDateRange(): bool
123 {
124 return $this->limitDateRange;
125 }
126
127 /**
128 * @param bool $limitDateRange
129 */
130 public function setLimitDateRange(bool $limitDateRange): void
131 {
132 $this->limitDateRange = $limitDateRange;
133 }
134
135 /**
136 * @return array<string, string|bool|null>
137 */
138 public function toArray(): array
139 {
140 return [
141 'dateFieldType' => $this->getDateFieldType(),
142 'dateFormat' => $this->getDateFormat(),
143 'minDateValue' => $this->getMinDateValue(),
144 'maxDateValue' => $this->getMaxDateValue(),
145 'limitDateRange' => $this->isLimitDateRange(),
146 ];
147 }
148 }
149