Files
breadcrumb-the-shire/lib/Service/Mail/MailServicesFactory.php

41 lines
1.1 KiB
PHP
Raw Normal View History

2026-02-23 12:58:19 +01:00
<?php
namespace MintyPHP\Service\Mail;
2026-03-05 08:26:51 +01:00
use MintyPHP\Repository\Mail\MailLogRepositoryInterface;
2026-02-23 12:58:19 +01:00
use MintyPHP\Service\Settings\SettingGateway;
class MailServicesFactory
{
private ?MailService $mailService = null;
private ?MailLogService $mailLogService = null;
2026-03-04 15:56:58 +01:00
public function __construct(
private readonly MailRepositoryFactory $mailRepositoryFactory,
private readonly SettingGateway $settingGateway
) {}
2026-03-05 08:26:51 +01:00
public function createMailLogRepository(): MailLogRepositoryInterface
2026-02-23 12:58:19 +01:00
{
2026-03-04 15:56:58 +01:00
return $this->mailRepositoryFactory->createMailLogRepository();
2026-02-23 12:58:19 +01:00
}
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
{
2026-03-04 15:56:58 +01:00
return $this->settingGateway;
2026-02-23 12:58:19 +01:00
}
}