<?php
//The essence of the Proxy is to hold a reference to the subject object in an instance variable and to
//pass method calls on the Proxy class down to the subject.
//Lastly, your Proxy class must provide all of the public methods your subject class supports
class Subject {
function someMethon(){
echo __METHOD__ . " called in " . __CLASS__;
}
}
class ProxySubject {
public $subject ;
function __construct(){
$this->subject = new Subject();
}
function someMethon(){
$this->subject->someMethon();
}
}
$proxy = new ProxySubject();
$proxy->someMethon();
//The essence of the Proxy is to hold a reference to the subject object in an instance variable and to
//pass method calls on the Proxy class down to the subject.
//Lastly, your Proxy class must provide all of the public methods your subject class supports
class Subject {
function someMethon(){
echo __METHOD__ . " called in " . __CLASS__;
}
}
class ProxySubject {
public $subject ;
function __construct(){
$this->subject = new Subject();
}
function someMethon(){
$this->subject->someMethon();
}
}
$proxy = new ProxySubject();
$proxy->someMethon();