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(); } }