Design Patterns in PHP--façade mode
' ;} }//(2) PC Machine class Pcmachine {public Function turnOn () {} public Function turnoff () {echo ' Turn off pcmathion
' ;}} (3) Power off class Power {public Function turnOn () {} public Function turnoff () {echo ' Turn off power
' ; }}//shutdown of the façade role class Pcfacade implements Facade{private $PcLight; private $Pcmachine; private $Power; Public Function __construct () {$this->pclight = new Pclight (); $this->pcmachine = new Pcmachine (); $this->power = new Power ();} Application of the façade role public function turnoff () {$this->pclight->turnoff (); $this->pcmachine->turnoff (); $this->power->turnoff (); } public Function TurnOn () {}}//applies $button = new Pcfacade (); $button->turnoff (); /* In fact, the façade mode is to put several subsystems (instances or classes.) Unified a unified interface to perform, the client does not care about the subsystem, only with the façade can be
http://www.bkjia.com/PHPjc/962642.html www.bkjia.com true http://www.bkjia.com/PHPjc/962642.html techarticle the design pattern in PHP--façade mode;} }//(2) PC Machine class Pcmachine {public Function turnOn () {} public Function turnoff () {echo Turn off pcmathion;}} (3) Power off CLA ...