<?php
/**
** :
**
** :1. , ,
**2.
****/
//
interface Target{
public function simpleFunction1();
public function simpleFunction2();
}
//
class Adaptee{
public function simpleFunction1(){
echo 'simpleFunction1';
}
}
//
class Adapter implements Target{
private $adaptee;
public function __construct(Adaptee $adaptee){
$this->adaptee=$adaptee;
}
public function simpleFunction1(){
echo $this->adaptee->simpleFunction1();
}
public function simpleFunction2(){
echo 'Adapter Simple ';
}
}
class client{
public static function main(){
$adaptee = new Adaptee();
$adapter = new Adapter($adaptee);
$adapter->simpleFunction1();
$adapter->simpleFunction2();
}
}
client::main();