Last active
August 26, 2022 18:33
-
-
Save mikemix/0c3d83844439c195376809684f0873e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace App\User\Notification; | |
use App\Notification\EmailAdddress; | |
use App\Notification\EmailNotificationInterface; | |
use App\Notification\Impl\EmailNotification; | |
use App\Template\TemplateEngine; | |
final class WelcomeGreetingEmailNotificationFactory | |
{ | |
private TemplateEngine $templates; | |
public function __construct(TemplateEngine $templates) | |
{ | |
$this->templates = $templates; | |
} | |
public function __invoke(UserInterface $user): EmailNotificationInterface | |
{ | |
return new EmailNotification( | |
new EmailAddress($user->getEmail()), | |
'Welcome to the site!', | |
$this->templates->render('Notification/Email/welcome.html', ['user' => $user]), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fix: