Imagine you have a function library which lets you write this...
PHP Code:
$email = parse_template('emails/NewAcct.txt', $_REQUEST);
send_email($email, $_REQUEST['email']);
Then replace the function paramaters with setters on objects...
PHP Code:
$template = new Template('emails/NewAcct.txt');
$template->set_data($_REQUEST);
$email = new Email;
$email->set_message($template->parse());
$email->set_email($_REQUEST['email']);
$email->send();
And lets split that big, bad array up into more setters and getters...
PHP Code:
$template = new Template('emails/NewAcctEmail.txt');
$template->set('username', $request->get('username'));
$template->set('password', $request->get('password'));
$ActivationEmail= new Email();
$ActivationEmail->setMessage($template->render());
$ActivationEmail->setEmail($request->get('email'));
$ActivationEmail->send();
oops... so all this object oriented stuff comes down to using global classes instead of global functions?
I don't think so.
Regards,
Douglas
Bookmarks