摘要:
备忘录模式 <?php class Memento{ private $_state; public function __construct($state){ $this->_state=$state; } public function getState(){ return $this->_st 阅读全文
摘要:
_bulb = $bulb; } public function execute() { $this->_bulb->turnOn(); } public function undo() { $this->_bulb->turnOff(); } public function redo() { ... 阅读全文
摘要:
next = $account; } public function canPay($amount) { return $this->balance >= $amount; } public function pay($amount) { if ($this->canPay($amount)) { echo ... 阅读全文
摘要:
door = new Door(); } public function open($password) { if ($this->authenticate($password)) { $this->door->open(); } else { echo 'The password is wrong... 阅读全文