1 | <?php |
||
8 | class SwiftMailerCallable implements LoggerAwareInterface |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * @var \Swift_Mailer |
||
13 | */ |
||
14 | public $mailer; |
||
15 | |||
16 | /** |
||
17 | * @var Callable |
||
18 | */ |
||
19 | public $message_factory; |
||
20 | |||
21 | /** |
||
22 | * @var LoggerInterface |
||
23 | */ |
||
24 | public $logger; |
||
25 | |||
26 | |||
27 | |||
28 | /** |
||
29 | * @param Swift_Mailer $mailer |
||
30 | * @param Callable $message_factory Factory returning new Swift_Message instance |
||
31 | */ |
||
32 | 36 | public function __construct( \Swift_Mailer $mailer, Callable $message_factory, LoggerInterface $logger = null ) |
|
38 | |||
39 | /** |
||
40 | * @param string $subject Mail Subject |
||
41 | * @param string $text Mail Body |
||
42 | * @param string|array $to Recipients |
||
43 | * |
||
44 | * @return int |
||
45 | * |
||
46 | * @throws RuntimeException if factory did not return instance of Swift_Message |
||
47 | */ |
||
48 | 35 | public function __invoke($subject, $text, $to = null) |
|
83 | |||
84 | /** |
||
85 | * Sets a logger instance on the object. |
||
86 | * |
||
87 | * @param LoggerInterface $logger |
||
88 | * |
||
89 | * @return void |
||
90 | */ |
||
91 | 36 | public function setLogger(LoggerInterface $logger) |
|
95 | } |
||
96 |