PluginProbe
The Innovative Form Builder – IvyForms / 0.8
The Innovative Form Builder – IvyForms v0.8
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 1.2 1.3
ivyforms / backend / src / Entity / FieldOptions / FieldOptions.php

FieldOptions.php in The Innovative Form Builder – IvyForms 0.8, at backend/src/Entity/FieldOptions/FieldOptions.php

142 lines 2.8 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.
5 * @licence See LICENCE.md for license details.
6 */
7
8 namespace IvyForms\Entity\FieldOptions;
9
10 // phpcs:disable PSR1.Files.SideEffects
11 if (!defined('ABSPATH')) {
12 exit; // Exit if accessed directly
13 }
14
15 use IvyForms\ValueObjects\FieldOptions\FieldOptions as FieldOptionsValueObject;
16
17 class FieldOptions
18 {
19 private FieldOptionsValueObject $fieldOptions;
20 public function __construct(FieldOptionsValueObject $fieldOptions)
21 {
22 $this->fieldOptions = $fieldOptions;
23 }
24
25 /**
26 * @return int
27 */
28 public function getId(): int
29 {
30 return $this->fieldOptions->getId();
31 }
32
33 /**
34 * @param int $id
35 * @return void
36 */
37 public function setId(int $id): void
38 {
39 $this->fieldOptions->id = $id;
40 }
41
42 /**
43 * @return int
44 */
45 public function getFieldId(): int
46 {
47 return $this->fieldOptions->getFieldId();
48 }
49
50 /**
51 * @param int $fieldId
52 * @return void
53 */
54 public function setFieldId(int $fieldId): void
55 {
56 $this->fieldOptions->fieldId = $fieldId;
57 }
58
59 /**
60 * @return string
61 */
62 public function getLabel(): string
63 {
64 return $this->fieldOptions->getLabel();
65 }
66
67 /**
68 * @param string $label
69 * @return void
70 */
71 public function setLabel(string $label): void
72 {
73 $this->fieldOptions->label = $label;
74 }
75
76 /**
77 * @return string
78 */
79 public function getValue(): string
80 {
81 return $this->fieldOptions->getValue();
82 }
83
84 /**
85 * @param string $value
86 * @return void
87 */
88 public function setValue(string $value): void
89 {
90 $this->fieldOptions->value = $value;
91 }
92
93 /**
94 * @return bool
95 */
96 public function isDefault(): bool
97 {
98 return $this->fieldOptions->isDefault();
99 }
100
101 /**
102 * @param bool $isDefault
103 * @return void
104 */
105 public function setDefault(bool $isDefault): void
106 {
107 $this->fieldOptions->isDefault = $isDefault;
108 }
109
110 /**
111 * @return int
112 */
113 public function getPosition(): int
114 {
115 return $this->fieldOptions->getPosition();
116 }
117
118 /**
119 * @param int $position
120 * @return void
121 */
122 public function setPosition(int $position): void
123 {
124 $this->fieldOptions->position = $position;
125 }
126
127 /**
128 * @return array<string, int|string|bool>
129 */
130 public function toArray(): array
131 {
132 return [
133 'id' => $this->getId(),
134 'fieldId' => $this->getFieldId(),
135 'label' => $this->getLabel(),
136 'value' => $this->getValue(),
137 'isDefault' => $this->isDefault(),
138 'position' => $this->getPosition(),
139 ];
140 }
141 }
142