Originator::showState PHP Method

showState() public method

public showState ( )
    public function showState()
    {
        echo $this->_state;
        echo "<br>";
    }

Usage Example

示例#1
0
 public static function main()
 {
     //创建目标对象
     $orig = new Originator();
     $orig->setState('open');
     $orig->showState();
     //创建备忘
     $memento = $orig->createMemento();
     //通过Caretaker保存此备忘
     $caretaker = new Caretaker();
     $caretaker->setMemento($memento);
     //改变目标对象的状态
     $orig->setState('close');
     $orig->showState();
     //还原操作
     $orig->restoreMemento($caretaker->getMemento());
     $orig->showState();
 }
All Usage Examples Of Originator::showState