Last active
August 29, 2015 14:14
-
-
Save amacgregor/170d1b99e12bd3b12ca6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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