$event =
new MailerDeliveryEvent($name,
$payload['message-id'
],
$payload);
} else { $name =
match ($payload['event'
]) { 'click' => MailerEngagementEvent::CLICK,
'unsubscribed' => MailerEngagementEvent::UNSUBSCRIBE,
'unique_opened' => MailerEngagementEvent::OPEN,
'opened' => MailerEngagementEvent::OPEN,
'proxy_open' => MailerEngagementEvent::OPEN,
'complaint' => MailerEngagementEvent::SPAM,
default =>
throw new ParseException(sprintf('Unsupported event "%s".',
$payload['event'
])),
};
$event =
new MailerEngagementEvent($name,
$payload['message-id'
],
$payload);
} if (!
$date = \DateTimeImmutable::
createFromFormat('U',
$payload['ts_event'
])) { throw new ParseException(sprintf('Invalid date "%s".',
$payload['ts_event'
]));
} if ( \
in_array($payload['event'
],
['deferred', 'soft_bounce', 'hard_bounce', 'invalid_email', 'blocked', 'error'
], true
) &&
isset($payload['reason'
]) )