PluginProbe
The Innovative Form Builder – IvyForms / 1.5.1
The Innovative Form Builder – IvyForms v1.5.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
← All changes | backend/src/ValueObjects/Notification/Notification.php +47 -8 1.0 → 1.5.1 View file →
@@ -41,11 +41,11 @@
41 41 * @var bool
42 42 */
43 43 public bool $showEmptyFields;
44 44 /**
45 - * @var bool
45 + * @var array<string, mixed>
46 46 */
47 - public bool $smartLogic;
47 + public array $smartLogic;
48 48 /**
49 49 * @var int
50 50 */
51 51 public int $formId;
@@ -59,9 +59,9 @@
59 59 * @param bool $enabled
60 60 * @param string $subject
61 61 * @param string $message
62 62 * @param bool $showEmptyFields
63 - * @param bool $smartLogic
63 + * @param array<string, mixed> $smartLogic
64 64 * @param int $formId
65 65 * @throws InvalidArgumentException|ValidationException
66 66 */
67 67 public function __construct(
@@ -71,9 +71,9 @@
71 71 bool $enabled,
72 72 string $subject,
73 73 string $message,
74 74 bool $showEmptyFields,
75 - bool $smartLogic,
75 + array $smartLogic,
76 76 int $formId
77 77 ) {
78 78 $this->id = $this->validateId($id);
79 79 $this->name = $this->validateString($name, 255, 'name');
@@ -81,9 +81,9 @@
81 81 $this->enabled = $this->validateBool($enabled);
82 82 $this->subject = $this->validateString($subject, 255, 'subject');
83 83 $this->message = $this->validateString($message, 4294967295, 'message');
84 84 $this->showEmptyFields = $this->validateBool($showEmptyFields);
85 - $this->smartLogic = $this->validateBool($smartLogic);
85 + $this->smartLogic = $this->validateSmartLogic($smartLogic);
86 86 $this->formId = $this->validateId($formId);
87 87 }
88 88
89 89 /**
@@ -190,8 +190,28 @@
190 190 return $this->contact->getReceiver();
191 191 }
192 192
193 193 /**
194 + * Get the notification CC addresses.
195 + *
196 + * @return string
197 + */
198 + public function getCc(): string
199 + {
200 + return $this->contact->getCc();
201 + }
202 +
203 + /**
204 + * Get the notification BCC addresses.
205 + *
206 + * @return string
207 + */
208 + public function getBcc(): string
209 + {
210 + return $this->contact->getBcc();
211 + }
212 +
213 + /**
194 214 * Get the notification status.
195 215 *
196 216 * @return bool
197 217 */
@@ -232,16 +252,33 @@
232 252
233 253 /**
234 254 * Get the smart logic status.
235 255 *
236 - * @return bool
256 + * @return array<string, mixed>
237 257 */
238 - public function isSmartLogic(): bool
258 + public function getSmartLogic(): array
239 259 {
240 260 return $this->smartLogic;
241 261 }
242 262
243 263 /**
264 + * Normalize smart logic payload structure.
265 + *
266 + * @param array<string, mixed> $smartLogic
267 + * @return array<string, mixed>
268 + */
269 + private function validateSmartLogic(array $smartLogic): array
270 + {
271 + $match = $smartLogic['match'] ?? 'any';
272 +
273 + return [
274 + 'enabled' => (bool)($smartLogic['enabled'] ?? false),
275 + 'match' => in_array($match, ['any', 'all'], true) ? $match : 'any',
276 + 'rules' => is_array($smartLogic['rules'] ?? null) ? $smartLogic['rules'] : [],
277 + ];
278 + }
279 +
280 + /**
244 281 * Get the form ID associated with the notification.
245 282 *
246 283 * @return int
247 284 */
@@ -262,13 +299,15 @@
262 299 'name' => $this->getName(),
263 300 'sender' => $this->getSender(),
264 301 'replyTo' => $this->getReplyTo(),
265 302 'receiver' => $this->getReceiver(),
303 + 'cc' => $this->getCc(),
304 + 'bcc' => $this->getBcc(),
266 305 'enabled' => $this->isEnabled(),
267 306 'subject' => $this->getSubject(),
268 307 'message' => $this->getMessage(),
269 308 'showEmptyFields' => $this->isShowEmptyFields(),
270 - 'smartLogic' => $this->isSmartLogic(),
309 + 'smartLogic' => $this->getSmartLogic(),
271 310 'formId' => $this->getFormId(),
272 311 ];
273 312 }
274 313 }