The advantage of Option 1 is that you can do something like:
PHP Code:
$MailLogger->log(new Mailer('template.tpl', $vars, 'my@email.com', 'My name'));
The advantage of Option 2 is that you can do something like:
PHP Code:
$mailer->GenerateTemplate('template.tpl', $vars, 'my@email.com', 'My name');
foreach ($maillist as $email) {
$mailer->SendTemplate($email->address, $email->name);
}
They are just different. Contrary to opinion, there is not a right or wrong way. That is one of the goals of patterns: to apply proven designs to a given situation.
Bookmarks