Skip to content

Instantly share code, notes, and snippets.

@amacgregor
Last active August 29, 2015 14:14
Show Gist options
  • Save amacgregor/170d1b99e12bd3b12ca6 to your computer and use it in GitHub Desktop.
Save amacgregor/170d1b99e12bd3b12ca6 to your computer and use it in GitHub Desktop.
<?php
class NotificationManager {
public function sendNotification($type = '', $data)
{
switch($type){
case "email":
$notification = new EmailService();
$notification->setTo($data['to']);
$notification->setFrom($data['from']);
$notification->setTitle($data['title']);
$notification->setMessage($data['message']);
$notification->sendEmail();
break;
case "twitter":
$notification = new TwitterService($data);
$notification->setMessage($data['message']);
$notification->sendTweet();
break;
case "sms":
$notification = new SmsService($data);
$notification->setRecipient($data['recipient']);
$notification->setMessage($data['message']);
$notification->sendText();
break;
default:
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment