public function undo()
 {
     switch ($this->prevSpeed) {
         case CeilingFan::HIGH:
             $this->ceilingFan->high();
             break;
         case CeilingFan::MEDIUM:
             $this->ceilingFan->medium();
             break;
         case CeilingFan::LOW:
             $this->ceilingFan->low();
             break;
         default:
             $this->ceilingFan->off();
             break;
     }
 }
コード例 #2
0
 public function undo()
 {
     if ($this->prevSpeed == CeilingFan::HIGH) {
         $this->ceilingFan->high();
     } else {
         if ($this->prevSpeed == CeilingFan::MEDIUM) {
             $this->ceilingFan->medium();
         } else {
             if ($this->prevSpeed == CeilingFan::LOW) {
                 $this->ceilingFan->low();
             } else {
                 if ($this->prevSpeed == CeilingFan::OFF) {
                     $this->ceilingFan->off();
                 }
             }
         }
     }
 }
コード例 #3
0
 public function execute()
 {
     $this->ceilingFan->off();
 }