else { $name =
match ($payload['event'
]) { 'click' => MailerEngagementEvent::CLICK,
'open' => MailerEngagementEvent::OPEN,
'spam' => MailerEngagementEvent::SPAM,
'unsub' => MailerEngagementEvent::UNSUBSCRIBE,
default =>
throw new ParseException(sprintf('Unsupported event "%s".',
$payload['event'
])),
};
$event =
new MailerEngagementEvent($name,
$payload['MessageID'
],
$payload);
} if (!
$date = \DateTimeImmutable::
createFromFormat('U',
$payload['time'
])) { throw new ParseException(sprintf('Invalid date "%s".',
$payload['time'
]));
} $event->
setDate($date);
$event->
setRecipientEmail($payload['email'
]);
if (isset($payload['CustomID'
])) { $event->
setTags([$payload['CustomID'
]]);
} if (isset($payload['Payload'
])) {