1 | <?php |
||
15 | abstract class Mail extends Nette\Object |
||
16 | { |
||
17 | |||
18 | const CONFIG_LOG = 'log'; |
||
19 | const CONFIG_SEND = 'send'; |
||
20 | const CONFIG_BOTH = 'both'; |
||
21 | |||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $config; |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $mails; |
||
32 | |||
33 | /** |
||
34 | * @var Nette\Mail\IMailer |
||
35 | */ |
||
36 | protected $mailer; |
||
37 | |||
38 | /** |
||
39 | * @var Nette\Mail\Message |
||
40 | */ |
||
41 | protected $message; |
||
42 | |||
43 | /** |
||
44 | * @var array |
||
45 | */ |
||
46 | protected $args; |
||
47 | |||
48 | /** |
||
49 | * @var Nette\Application\LinkGenerator |
||
50 | */ |
||
51 | protected $linkGenerator; |
||
52 | |||
53 | /** |
||
54 | * @var ILogger |
||
55 | */ |
||
56 | protected $logger; |
||
57 | |||
58 | /** |
||
59 | * @var Nette\Application\UI\ITemplate |
||
60 | */ |
||
61 | protected $template; |
||
62 | |||
63 | /** |
||
64 | * @var string |
||
65 | */ |
||
66 | protected $underscore_name; |
||
67 | |||
68 | /** |
||
69 | * @var string |
||
70 | */ |
||
71 | protected $log_type; |
||
72 | |||
73 | /** |
||
74 | * @var string |
||
75 | */ |
||
76 | protected $mail_images_base_path; |
||
77 | |||
78 | /** |
||
79 | * @var string |
||
80 | */ |
||
81 | protected $template_file; |
||
82 | |||
83 | |||
84 | public function __construct( |
||
111 | |||
112 | |||
113 | /** |
||
114 | * Set template file |
||
115 | * @return void |
||
116 | */ |
||
117 | public function setTemplateFile($template_file) |
||
121 | |||
122 | |||
123 | /** |
||
124 | * Set template variables |
||
125 | * @return void |
||
126 | */ |
||
127 | protected function setTemplateVariables() |
||
133 | |||
134 | |||
135 | /** |
||
136 | * Set absolute base path for images |
||
137 | * @param string $mail_images_base_path |
||
138 | */ |
||
139 | public function setBasePath($mail_images_base_path) |
||
145 | |||
146 | |||
147 | /** |
||
148 | * Stick to convention that Email: |
||
149 | * ?/mailing/Mails/FooMail.php |
||
150 | * |
||
151 | * will have template with path of: |
||
152 | * ?/mailing/Mails/templates/foo_mail.latte |
||
153 | * |
||
154 | * @return string |
||
155 | */ |
||
156 | public function getTemplateFile() |
||
193 | |||
194 | |||
195 | /** |
||
196 | * Render latte template to string and send (and/or log) mail |
||
197 | * @return void |
||
198 | */ |
||
199 | public function send() |
||
238 | |||
239 | } |
||
240 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: