Sim
Well-known member
Not a feature request, so didn't think this thread belonged in Suggestions?
May I please request a slight code change in
Can these lines be split to a separate function like has been done in
Add this same function to
This will make the code in one of my addons a lot cleaner, thanks!
May I please request a slight code change in
XF\Service\User\Welcome::sendMail
(lines 84-85)
PHP:
$mail = $this->app->mailer()->newMail();
$mail->setToUser($this->user);
Can these lines be split to a separate function like has been done in
XF\Job\UserEmail::executeAction
and getMail
?
PHP:
/**
* @param User $user
*
* @return \XF\Mail\Mail
*/
protected function getMail(\XF\Entity\User $user)
{
return $this->app->mailer()->newMail()->setToUser($user);
}
Add this same function to
XF\Service\User\Welcome
and then we can change the above code in XF\Service\User\Welcome::sendMail
to be:
PHP:
$mail = $this->getMail($this->user);
This will make the code in one of my addons a lot cleaner, thanks!