| 1 |
<?php |
| 2 |
|
| 3 |
namespace IvyForms\Entity\Field; |
| 4 |
|
| 5 |
use IvyForms\ValueObjects\Field\FieldGeneralSettings as FieldGeneralSettingsVO; |
| 6 |
|
| 7 |
// phpcs:disable PSR1.Files.SideEffects |
| 8 |
if (!defined('ABSPATH')) { |
| 9 |
exit; // Exit if accessed directly |
| 10 |
} |
| 11 |
|
| 12 |
/** |
| 13 |
* Class FieldGeneralSettings |
| 14 |
* |
| 15 |
* Entity wrapper for FieldGeneralSettings ValueObject. |
| 16 |
*/ |
| 17 |
class FieldGeneralSettings |
| 18 |
{ |
| 19 |
private FieldGeneralSettingsVO $fieldGeneralSettings; |
| 20 |
|
| 21 |
/** |
| 22 |
* @param FieldGeneralSettingsVO $fieldGeneralSettings |
| 23 |
*/ |
| 24 |
public function __construct(FieldGeneralSettingsVO $fieldGeneralSettings) |
| 25 |
{ |
| 26 |
$this->fieldGeneralSettings = $fieldGeneralSettings; |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* @return string |
| 31 |
*/ |
| 32 |
public function getLabel(): string |
| 33 |
{ |
| 34 |
return $this->fieldGeneralSettings->getLabel(); |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* @return bool |
| 39 |
*/ |
| 40 |
public function isRequired(): bool |
| 41 |
{ |
| 42 |
return $this->fieldGeneralSettings->isRequired(); |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* @return string |
| 47 |
*/ |
| 48 |
public function getPlaceholder(): string |
| 49 |
{ |
| 50 |
return $this->fieldGeneralSettings->getPlaceholder(); |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* @return bool |
| 55 |
*/ |
| 56 |
public function isHideLabel(): bool |
| 57 |
{ |
| 58 |
return $this->fieldGeneralSettings->isHideLabel(); |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* @return bool |
| 63 |
*/ |
| 64 |
public function isReadOnly(): bool |
| 65 |
{ |
| 66 |
return $this->fieldGeneralSettings->isReadOnly(); |
| 67 |
} |
| 68 |
|
| 69 |
/** |
| 70 |
* @return string |
| 71 |
*/ |
| 72 |
public function getDescription(): string |
| 73 |
{ |
| 74 |
return $this->fieldGeneralSettings->getDescription(); |
| 75 |
} |
| 76 |
|
| 77 |
/** |
| 78 |
* @return string |
| 79 |
*/ |
| 80 |
public function getRequiredMessage(): string |
| 81 |
{ |
| 82 |
return $this->fieldGeneralSettings->getRequiredMessage(); |
| 83 |
} |
| 84 |
|
| 85 |
/** |
| 86 |
* @return string |
| 87 |
*/ |
| 88 |
public function getCssClasses(): string |
| 89 |
{ |
| 90 |
return $this->fieldGeneralSettings->getCssClasses(); |
| 91 |
} |
| 92 |
|
| 93 |
/** |
| 94 |
* @return bool |
| 95 |
*/ |
| 96 |
public function isShuffleOptions(): bool |
| 97 |
{ |
| 98 |
return $this->fieldGeneralSettings->isShuffleOptions(); |
| 99 |
} |
| 100 |
|
| 101 |
/** |
| 102 |
* @return bool |
| 103 |
*/ |
| 104 |
public function isShowValues(): bool |
| 105 |
{ |
| 106 |
return $this->fieldGeneralSettings->isShowValues(); |
| 107 |
} |
| 108 |
|
| 109 |
/** |
| 110 |
* @return bool |
| 111 |
*/ |
| 112 |
public function isEnableSearch(): bool |
| 113 |
{ |
| 114 |
return $this->fieldGeneralSettings->isEnableSearch(); |
| 115 |
} |
| 116 |
|
| 117 |
/** |
| 118 |
* @return bool |
| 119 |
*/ |
| 120 |
public function isVisible(): bool |
| 121 |
{ |
| 122 |
return $this->fieldGeneralSettings->isVisible(); |
| 123 |
} |
| 124 |
|
| 125 |
/** |
| 126 |
* Get the phone format of the form field. |
| 127 |
* |
| 128 |
* @return string The phone format of the form field. |
| 129 |
*/ |
| 130 |
public function getPhoneFormat(): string |
| 131 |
{ |
| 132 |
return $this->fieldGeneralSettings->getPhoneFormat(); |
| 133 |
} |
| 134 |
|
| 135 |
/** |
| 136 |
* Set the phone format of the form field. |
| 137 |
* |
| 138 |
* @param string $format The phone format to set. |
| 139 |
*/ |
| 140 |
public function setPhoneFormat(string $format): void |
| 141 |
{ |
| 142 |
$this->fieldGeneralSettings->setPhoneFormat($format); |
| 143 |
} |
| 144 |
/** |
| 145 |
* Get minimum value constraint. |
| 146 |
* |
| 147 |
* @return float|null |
| 148 |
*/ |
| 149 |
public function getMinValue(): ?float |
| 150 |
{ |
| 151 |
return $this->fieldGeneralSettings->getMinValue(); |
| 152 |
} |
| 153 |
|
| 154 |
/** |
| 155 |
* Set minimum value constraint. |
| 156 |
* |
| 157 |
* @param float|null $minValue |
| 158 |
*/ |
| 159 |
public function setMinValue(?float $minValue): void |
| 160 |
{ |
| 161 |
$this->fieldGeneralSettings->setMinValue($minValue); |
| 162 |
} |
| 163 |
|
| 164 |
/** |
| 165 |
* Get maximum value constraint. |
| 166 |
* |
| 167 |
* @return float|null |
| 168 |
*/ |
| 169 |
public function getMaxValue(): ?float |
| 170 |
{ |
| 171 |
return $this->fieldGeneralSettings->getMaxValue(); |
| 172 |
} |
| 173 |
|
| 174 |
/** |
| 175 |
* Set maximum value constraint. |
| 176 |
* |
| 177 |
* @param float|null $maxValue |
| 178 |
*/ |
| 179 |
public function setMaxValue(?float $maxValue): void |
| 180 |
{ |
| 181 |
$this->fieldGeneralSettings->setMaxValue($maxValue); |
| 182 |
} |
| 183 |
|
| 184 |
/** |
| 185 |
* Get step increment. |
| 186 |
* @return float |
| 187 |
*/ |
| 188 |
public function getStep(): float |
| 189 |
{ |
| 190 |
return $this->fieldGeneralSettings->getStep(); |
| 191 |
} |
| 192 |
|
| 193 |
/** |
| 194 |
* Set step increment. |
| 195 |
* @param float $step |
| 196 |
*/ |
| 197 |
public function setStep(float $step): void |
| 198 |
{ |
| 199 |
$this->fieldGeneralSettings->setStep($step); |
| 200 |
} |
| 201 |
|
| 202 |
/** |
| 203 |
* Get number format key. |
| 204 |
* @return string |
| 205 |
*/ |
| 206 |
public function getNumberFormat(): string |
| 207 |
{ |
| 208 |
return $this->fieldGeneralSettings->getNumberFormat(); |
| 209 |
} |
| 210 |
|
| 211 |
/** |
| 212 |
* Set number format key. |
| 213 |
* @param string $numberFormat |
| 214 |
*/ |
| 215 |
public function setNumberFormat(string $numberFormat): void |
| 216 |
{ |
| 217 |
$this->fieldGeneralSettings->setNumberFormat($numberFormat); |
| 218 |
} |
| 219 |
|
| 220 |
/** |
| 221 |
* Get the phone auto-detect status of the form field. |
| 222 |
* |
| 223 |
* @return bool The phone auto-detect status of the form field. |
| 224 |
*/ |
| 225 |
public function isPhoneAutoDetect(): bool |
| 226 |
{ |
| 227 |
return $this->fieldGeneralSettings->isPhoneAutoDetect(); |
| 228 |
} |
| 229 |
|
| 230 |
/** |
| 231 |
* Set the phone auto-detect status of the form field. |
| 232 |
* |
| 233 |
* @param bool $val The phone auto-detect status to set. |
| 234 |
*/ |
| 235 |
public function setPhoneAutoDetect(bool $val): void |
| 236 |
{ |
| 237 |
$this->fieldGeneralSettings->setPhoneAutoDetect($val); |
| 238 |
} |
| 239 |
/** |
| 240 |
* @return array<string, bool|string> |
| 241 |
*/ |
| 242 |
public function toArray(): array |
| 243 |
{ |
| 244 |
return $this->fieldGeneralSettings->toArray(); |
| 245 |
} |
| 246 |
} |
| 247 |
|