Created
March 14, 2017 13:04
-
-
Save ArtyomLazyan/99c0aa451b46fb28cf34c715f00f5f67 to your computer and use it in GitHub Desktop.
Adapter Pattern
This file contains 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
************************* Addapter Pattern ************************ | |
<br>* nra hamara vor orinak mi qani tex nuyn funkcian es kanchum mekel mi or uzum es funkciayi * | |
<br>* anun@ poxes amen mekin@ arandzin arandzin chpoxes ena miangamic erku tex poxum es u verj * <br><br> | |
<?php | |
class Facebook | |
{ | |
public function posting($msg) | |
{ | |
echo "<br>Posting message..."; | |
} | |
} | |
interface socialMediaAdapter | |
{ | |
public function post($msg); | |
} | |
class FacebookAdapter implements socialMediaAdapter | |
{ | |
private $facebook; | |
// @ndunuma Facebook klass@ u veragrum private faceboookin | |
public function __construct(Facebook $facebook) | |
{ | |
$this->facebook = $facebook; | |
} | |
// es funkciayov el kanchum enq Facebook klasi metodneric mek@ | |
public function post($msg) | |
{ | |
$this->facebook->posting($msg); | |
} | |
} | |
// stexcum enq klass Adapter vorin poxancum enq facebook class@ | |
$facebook = new FacebookAdapter(new Facebook); | |
$msg = "med"; | |
$facebook->post($msg); | |
$facebook->post($msg); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment