Skip to content

Instantly share code, notes, and snippets.

@mikemix
Last active August 26, 2022 18:33
Show Gist options
  • Save mikemix/0c3d83844439c195376809684f0873e0 to your computer and use it in GitHub Desktop.
Save mikemix/0c3d83844439c195376809684f0873e0 to your computer and use it in GitHub Desktop.
<?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]),
);
}
}
@Myks92
Copy link

Myks92 commented Aug 25, 2022

Fix:

final class WelcomeGreetingEmailNotificationFactory

@mikemix
Copy link
Author

mikemix commented Aug 26, 2022

Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment