'clicked' => MailerEngagementEvent::CLICK,
'unsubscribed' => MailerEngagementEvent::UNSUBSCRIBE,
'opened' => MailerEngagementEvent::OPEN,
'complained' => MailerEngagementEvent::SPAM,
default =>
throw new ParseException(sprintf('Unsupported event "%s".',
$payload['event'
])),
};
$event =
new MailerEngagementEvent($name,
$payload['id'
],
$payload);
} if (!
$date = \DateTimeImmutable::
createFromFormat('U.u',
$payload['timestamp'
])) { throw new ParseException(sprintf('Invalid date "%s".',
$payload['timestamp'
]));
} $event->
setDate($date);
$event->
setRecipientEmail($payload['recipient'
]);
$event->
setMetadata($payload['user-variables'
]);
$event->
setTags($payload['tags'
]);
return $event;
} private function matchFailedEvent(array
$payload): string
{ if ('temporary' ===
$payload['severity'
]) { return MailerDeliveryEvent::DEFERRED;
}