ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
MimeMailService.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Mail\Service;
22
26
28{
29 public function __construct(protected Container $dic)
30 {
31 if (!isset($this->dic['mail.mime.transport.factory'])) {
32 $this->dic['mail.mime.transport.factory'] = static function (Container $c): ilMailMimeTransportFactory {
33 return new ilMailMimeTransportFactory($c->settings(), $c->event());
34 };
35 }
36
37 if (!isset($this->dic['mail.mime.sender.factory'])) {
38 $this->dic['mail.mime.sender.factory'] = static function (Container $c): ilMailMimeSenderFactory {
39 return new ilMailMimeSenderFactory(
40 $c->settings(),
41 $c->mail()->mustacheFactory()
42 );
43 };
44 }
45
46 if (!isset($this->dic['mail.texttemplates.service'])) {
47 $this->dic['mail.texttemplates.service'] = static function (Container $c): \ilMailTemplateService {
48 return new \ilMailTemplateService(
49 new \ilMailTemplateRepository($c->database()),
50 $this->dic['mail.mustache.factory']
51 );
52 };
53 }
54
55 if (!isset($this->dic['mail.mustache.factory'])) {
56 $this->dic["mail.mustache.factory"] = static function (Container $c): \ilMustacheFactory {
57 return new \ilMustacheFactory();
58 };
59 }
60
61 if (!isset($this->dic['mail.template.placeholder.resolver'])) {
62 $this->dic["mail.template.placeholder.resolver"] = static function (Container $c): \ilMailTemplatePlaceholderResolver {
63 return new \ilMailTemplatePlaceholderResolver(
64 $c["mail.mustache.factory"]->getBasicEngine()
65 );
66 };
67 }
68 }
69
71 {
72 return $this->dic['mail.mime.transport.factory'];
73 }
74
76 {
77 return $this->dic['mail.mime.sender.factory'];
78 }
79}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
__construct(protected Container $dic)
$c
Definition: deliver.php:25
$dic
Definition: ltiresult.php:33