PluginProbe
The Innovative Form Builder – IvyForms / 1.0
The Innovative Form Builder – IvyForms v1.0
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 / Entity / Confirmation / Confirmation.php

Confirmation.php in The Innovative Form Builder – IvyForms 1.0, at backend/src/Entity/Confirmation/Confirmation.php

221 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IvyForms\Entity\Confirmation;
4
5 use IvyForms\ValueObjects\Confirmation\Confirmation as ConfirmationValueObject;
6 use IvyForms\Common\Helpers\Helper;
7
8 /**
9 * Class Confirmation
10 *
11 * @package IvyForms\Entity\Confirmation
12 */
13 class Confirmation
14 {
15 /**
16 * @var ConfirmationValueObject
17 */
18 private ConfirmationValueObject $confirmation;
19
20 /**
21 * Confirmation constructor.
22 *
23 * @param ConfirmationValueObject $confirmation The confirmation object.
24 */
25 public function __construct(ConfirmationValueObject $confirmation)
26 {
27 $this->confirmation = $confirmation;
28 }
29
30 /**
31 * Get the confirmation ID.
32 *
33 * @return int
34 */
35 public function getId(): int
36 {
37 return $this->confirmation->getId();
38 }
39
40 /**
41 * Set the confirmation ID.
42 *
43 * @param int $id
44 */
45 public function setId(int $id): void
46 {
47 $this->confirmation->id = $id;
48 }
49
50 /**
51 * Get the form ID.
52 *
53 * @return int
54 */
55 public function getFormId(): int
56 {
57 return $this->confirmation->getFormId();
58 }
59
60 /**
61 * Set the form ID.
62 *
63 * @param int $formId
64 */
65 public function setFormId(int $formId): void
66 {
67 $this->confirmation->formId = $formId;
68 }
69
70 /**
71 * Get the confirmation type.
72 *
73 * @return string
74 */
75 public function getType(): string
76 {
77 return $this->confirmation->getType();
78 }
79
80 /**
81 * Set the confirmation type.
82 *
83 * @param string $type
84 */
85 public function setType(string $type): void
86 {
87 $this->confirmation->type = $type;
88 }
89
90 /**
91 * Get the confirmation status.
92 *
93 * @return bool
94 */
95 public function isEnabled(): bool
96 {
97 return $this->confirmation->isEnabled();
98 }
99
100 /**
101 * Set the confirmation status.
102 *
103 * @param bool $enabled
104 */
105 public function setEnabled(bool $enabled): void
106 {
107 $this->confirmation->enabled = $enabled;
108 }
109
110 /**
111 * Get the show form flag.
112 *
113 * @return bool
114 */
115 public function isShowForm(): bool
116 {
117 return $this->confirmation->isShowForm();
118 }
119
120 /**
121 * Set the show form flag.
122 *
123 * @param bool $showForm
124 */
125 public function setShowForm(bool $showForm): void
126 {
127 $this->confirmation->showForm = $showForm;
128 }
129
130 /**
131 * Get the confirmation message.
132 *
133 * @return string
134 */
135 public function getMessage(): string
136 {
137 return $this->confirmation->getMessage();
138 }
139
140 /**
141 * Set the confirmation message.
142 *
143 * @param string $message
144 */
145 public function setMessage(string $message): void
146 {
147 $this->confirmation->message = $message;
148 }
149
150 /**
151 * Get the confirmation URL.
152 *
153 * @return string
154 */
155 public function getUrl(): string
156 {
157 return $this->confirmation->getUrl();
158 }
159
160 /**
161 * Set the confirmation URL.
162 *
163 * @param string $url
164 */
165 public function setUrl(string $url): void
166 {
167 $this->confirmation->url = $url;
168 }
169
170 /**
171 * Get the confirmation page.
172 *
173 * @return string
174 */
175 public function getPage(): string
176 {
177 return $this->confirmation->getPage();
178 }
179
180 /**
181 * Set the confirmation page.
182 *
183 * @param string $page
184 */
185 public function setPage(string $page): void
186 {
187 $this->confirmation->page = $page;
188 }
189
190 /**
191 * Get the page URL converted from page ID.
192 *
193 * @return string The page URL, empty string if page is not set or not found.
194 */
195 public function getPageUrl(): string
196 {
197 return Helper::getPageUrlFromId($this->getPage());
198 }
199
200 /**
201 * Convert the confirmation entity to an array.
202 *
203 * @return array<string, mixed> The confirmation entity as an array.
204 */
205 public function toArray(): array
206 {
207 return [
208 'id' => $this->getId(),
209 'formId' => $this->getFormId(),
210 'type' => $this->getType(),
211 'enabled' => $this->isEnabled(),
212 'showForm' => $this->isShowForm(),
213 'message' => $this->getMessage(),
214 'url' => $this->getUrl(),
215 //TODO : Check if page is needed as we have pageUrl
216 'page' => $this->getPage(),
217 'pageUrl' => $this->getPageUrl(),
218 ];
219 }
220 }
221