protected function splitExceptionMessage($exceptionMessage)
{
$body = '';
$pattern = '/
(?<= # Begin positive lookbehind.
[.!?]\\s # Either an end of sentence punct,
| \\n # or line break
)
(?<! # Begin negative lookbehind.
i\\.E\\.\\s # Skip "i.E."
) # End negative lookbehind.
/ix';
$sentences = preg_split($pattern, $exceptionMessage, 2, PREG_SPLIT_NO_EMPTY);
if (!isset($sentences[1])) {
$subject = $exceptionMessage;
} else {
$subject = trim($sentences[0]);
$body = trim($sentences[1]);
}
return ['subject' => $subject, 'body' => $body];
}