| 1 |
<?php |
| 2 |
|
| 3 |
namespace IvyForms\ValueObjects\Form; |
| 4 |
|
| 5 |
/** |
| 6 |
* Class FormSettings |
| 7 |
* Groups display and behavior settings for a form |
| 8 |
* |
| 9 |
* @package IvyForms\ValueObjects\Form |
| 10 |
*/ |
| 11 |
final class FormSettings |
| 12 |
{ |
| 13 |
/** |
| 14 |
* @var bool |
| 15 |
*/ |
| 16 |
public bool $showTitle; |
| 17 |
|
| 18 |
/** |
| 19 |
* @var bool |
| 20 |
*/ |
| 21 |
public bool $showDescription; |
| 22 |
|
| 23 |
/** |
| 24 |
* @var bool |
| 25 |
*/ |
| 26 |
public bool $storeEntries; |
| 27 |
|
| 28 |
/** |
| 29 |
* FormSettings constructor. |
| 30 |
* |
| 31 |
* @param bool $showTitle |
| 32 |
* @param bool $showDescription |
| 33 |
* @param bool $storeEntries |
| 34 |
*/ |
| 35 |
public function __construct( |
| 36 |
bool $showTitle, |
| 37 |
bool $showDescription, |
| 38 |
bool $storeEntries |
| 39 |
) { |
| 40 |
$this->showTitle = $showTitle; |
| 41 |
$this->showDescription = $showDescription; |
| 42 |
$this->storeEntries = $storeEntries; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* @return bool |
| 47 |
*/ |
| 48 |
public function isShowTitle(): bool |
| 49 |
{ |
| 50 |
return $this->showTitle; |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* @return bool |
| 55 |
*/ |
| 56 |
public function isShowDescription(): bool |
| 57 |
{ |
| 58 |
return $this->showDescription; |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* @return bool |
| 63 |
*/ |
| 64 |
public function isStoreEntries(): bool |
| 65 |
{ |
| 66 |
return $this->storeEntries; |
| 67 |
} |
| 68 |
|
| 69 |
/** |
| 70 |
* Convert to array |
| 71 |
* |
| 72 |
* @return array<string, bool> |
| 73 |
*/ |
| 74 |
public function toArray(): array |
| 75 |
{ |
| 76 |
return [ |
| 77 |
'showTitle' => $this->showTitle, |
| 78 |
'showDescription' => $this->showDescription, |
| 79 |
'storeEntries' => $this->storeEntries, |
| 80 |
]; |
| 81 |
} |
| 82 |
} |
| 83 |
|