refactor: get upper first protocol only one call in Email

This commit is contained in:
Denny Septian Panggabean 2025-02-12 18:36:53 +07:00 committed by GitHub
parent f4213aba00
commit d2bf2099e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1689,8 +1689,9 @@ class Email
protected function spoolEmail() protected function spoolEmail()
{ {
$this->unwrapSpecials(); $this->unwrapSpecials();
$protocol = $this->getProtocol(); $protocol = $this->getProtocol();
$method = 'sendWith' . ucfirst($protocol); $upperFirstProtocol = ucfirst($protocol);
$method = 'sendWith' . $upperFirstProtocol;
try { try {
$success = $this->{$method}(); $success = $this->{$method}();
@ -1700,7 +1701,7 @@ class Email
} }
if (! $success) { if (! $success) {
$message = lang('Email.sendFailure' . ($protocol === 'mail' ? 'PHPMail' : ucfirst($protocol))); $message = lang('Email.sendFailure' . ($protocol === 'mail' ? 'PHPMail' : $upperFirstProtocol));
log_message('error', 'Email: ' . $message); log_message('error', 'Email: ' . $message);
log_message('error', $this->printDebuggerRaw()); log_message('error', $this->printDebuggerRaw());