Created
November 15, 2020 13:10
-
-
Save ksmylmz/6337305ea34f88ed50eb8de3d17f0bd2 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 | |
////low Level sınıflarımız | |
class Email | |
{ | |
function sendEmail(); | |
} | |
class SMS | |
{ | |
function sendSms(); | |
} | |
class PushNotification | |
{ | |
function sendPushNotification(); | |
} | |
///High Level Sınıfımız | |
class MessageManager | |
{ | |
$Email; | |
$SMS; | |
$PushNotification; | |
$type; | |
function __construct($type) | |
{ | |
$this->type = $type; | |
} | |
public function sendMessage() | |
{ | |
switch ($this->type) | |
{ | |
case 'email': | |
$Email = new Email(); | |
$Email->sendEmail(); | |
break; | |
case 'SMS': | |
$SMS = new SMS(); | |
$SMS->sendSms(); | |
break; | |
case 'push': | |
$PushNotification = new PushNotification(); | |
$PushNotification->sendPushNotification(); | |
break; | |
default: | |
# code... | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment