Files
breadcrumb-the-shire/lib/Service/Mail/MailServicesFactory.php
2026-03-05 08:26:51 +01:00

41 lines
1.1 KiB
PHP

<?php
namespace MintyPHP\Service\Mail;
use MintyPHP\Repository\Mail\MailLogRepositoryInterface;
use MintyPHP\Service\Settings\SettingGateway;
class MailServicesFactory
{
private ?MailService $mailService = null;
private ?MailLogService $mailLogService = null;
public function __construct(
private readonly MailRepositoryFactory $mailRepositoryFactory,
private readonly SettingGateway $settingGateway
) {}
public function createMailLogRepository(): MailLogRepositoryInterface
{
return $this->mailRepositoryFactory->createMailLogRepository();
}
public function createMailService(): MailService
{
return $this->mailService ??= new MailService(
$this->createMailLogRepository(),
$this->createSettingGateway()
);
}
public function createMailLogService(): MailLogService
{
return $this->mailLogService ??= new MailLogService($this->createMailLogRepository());
}
private function createSettingGateway(): SettingGateway
{
return $this->settingGateway;
}
}