forked from fa/breadcrumb-the-shire
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace MintyPHP\Service\Mail;
|
|
|
|
use MintyPHP\Repository\Mail\MailLogRepository;
|
|
use MintyPHP\Service\Settings\SettingGateway;
|
|
use MintyPHP\Service\Settings\SettingServicesFactory;
|
|
|
|
class MailServicesFactory
|
|
{
|
|
private ?MailLogRepository $mailLogRepository = null;
|
|
private ?SettingServicesFactory $settingServicesFactory = null;
|
|
private ?SettingGateway $settingGateway = null;
|
|
private ?MailService $mailService = null;
|
|
private ?MailLogService $mailLogService = null;
|
|
|
|
public function createMailLogRepository(): MailLogRepository
|
|
{
|
|
return $this->mailLogRepository ??= new MailLogRepository();
|
|
}
|
|
|
|
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 ??= $this->settingServicesFactory()->createSettingGateway();
|
|
}
|
|
|
|
private function settingServicesFactory(): SettingServicesFactory
|
|
{
|
|
return $this->settingServicesFactory ??= new SettingServicesFactory();
|
|
}
|
|
}
|