PluginProbe
The Innovative Form Builder – IvyForms / 1.1.1
The Innovative Form Builder – IvyForms v1.1.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 / Entity / Notification / Notification.php

Notification.php in The Innovative Form Builder – IvyForms 1.1.1, at backend/src/Entity/Notification/Notification.php

233 lines 4.9 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\Entity\Notification;
9
10 use IvyForms\ValueObjects\Notification\Notification as NotificationValueObject;
11 use IvyForms\Entity\Notification\NotificationContact;
12
13 /**
14 * Class Notification
15 *
16 * @package IvyForms\Entity\Notification
17 */
18 class Notification
19 {
20 /**
21 * @var NotificationValueObject
22 */
23 private NotificationValueObject $notification;
24
25 /**
26 * @var NotificationContact
27 */
28 private NotificationContact $contact;
29
30 /**
31 * Notification constructor.
32 *
33 * @param NotificationValueObject $notification The notification object.
34 */
35 public function __construct(NotificationValueObject $notification)
36 {
37 $this->notification = $notification;
38 $this->contact = new NotificationContact($notification->contact);
39 }
40
41 /**
42 * Get the notification ID.
43 *
44 * @return int
45 */
46 public function getId(): int
47 {
48 return $this->notification->getId();
49 }
50
51 /**
52 * Set the notification ID.
53 *
54 * @param int $id
55 */
56 public function setId(int $id): void
57 {
58 $this->notification->id = $id;
59 }
60
61 /**
62 * Get the notification name.
63 *
64 * @return string
65 */
66 public function getName(): string
67 {
68 return $this->notification->getName();
69 }
70
71 /**
72 * Set the notification name.
73 *
74 * @param string $name
75 */
76 public function setName(string $name): void
77 {
78 $this->notification->name = $name;
79 }
80
81 /**
82 * Get the NotificationContact entity.
83 *
84 * @return NotificationContact
85 */
86 public function getNotificationContact(): NotificationContact
87 {
88 return $this->contact;
89 }
90
91 /**
92 * Get the notification status.
93 *
94 * @return bool
95 */
96 public function isEnabled(): bool
97 {
98 return $this->notification->isEnabled();
99 }
100
101 /**
102 * Set the notification status.
103 *
104 * @param bool $enabled
105 */
106 public function setEnabled(bool $enabled): void
107 {
108 $this->notification->enabled = $enabled;
109 }
110
111 /**
112 * Get the notification subject.
113 *
114 * @return string
115 */
116 public function getSubject(): string
117 {
118 return $this->notification->getSubject();
119 }
120
121 /**
122 * Set the notification subject.
123 *
124 * @param string $subject
125 */
126 public function setSubject(string $subject): void
127 {
128 $this->notification->subject = $subject;
129 }
130
131 /**
132 * Get the notification message.
133 *
134 * @return string
135 */
136 public function getMessage(): string
137 {
138 return $this->notification->getMessage();
139 }
140
141 /**
142 * Set the notification message.
143 *
144 * @param string $message
145 */
146 public function setMessage(string $message): void
147 {
148 $this->notification->message = $message;
149 }
150
151 /**
152 * Get the show empty fields status.
153 *
154 * @return bool
155 */
156 public function isShowEmptyFields(): bool
157 {
158 return $this->notification->isShowEmptyFields();
159 }
160
161 /**
162 * Set the show empty fields status.
163 *
164 * @param bool $showEmptyFields
165 */
166 public function setShowEmptyFields(bool $showEmptyFields): void
167 {
168 $this->notification->showEmptyFields = $showEmptyFields;
169 }
170
171 /**
172 * Get the smart logic status.
173 *
174 * @return array<string, mixed>
175 */
176 public function getSmartLogic(): array
177 {
178 return $this->notification->getSmartLogic();
179 }
180
181 /**
182 * Set the smart logic status.
183 *
184 * @param array<string, mixed> $smartLogic
185 */
186 public function setSmartLogic(array $smartLogic): void
187 {
188 $this->notification->smartLogic = $smartLogic;
189 }
190
191 /**
192 * Get the form ID.
193 *
194 * @return int
195 */
196 public function getFormId(): int
197 {
198 return $this->notification->getFormId();
199 }
200
201 /**
202 * Set the form ID.
203 *
204 * @param int $formId
205 */
206 public function setFormId(int $formId): void
207 {
208 $this->notification->formId = $formId;
209 }
210
211 /**
212 * Convert the notification entity to an array.
213 *
214 * @return array<string, mixed> The notification entity as an array.
215 */
216 public function toArray(): array
217 {
218 return array_merge(
219 [
220 'id' => $this->getId(),
221 'name' => $this->getName(),
222 'enabled' => $this->isEnabled(),
223 'subject' => $this->getSubject(),
224 'message' => $this->getMessage(),
225 'showEmptyFields' => $this->isShowEmptyFields(),
226 'smartLogic' => $this->getSmartLogic(),
227 'formId' => $this->getFormId(),
228 ],
229 $this->getNotificationContact()->toArray()
230 );
231 }
232 }
233