Exemplo n.º 1
0
 /**
  * @param int $hour
  */
 public function __construct($hour)
 {
     if (DayState::isDay($hour)) {
         $this->state = DayState::getInstance();
     } else {
         $this->state = NightState::getInstance();
     }
 }
Exemplo n.º 2
0
 /**
  * @param ContextInterface $context
  * @param int              $hour
  */
 public function doClock(ContextInterface $context, $hour)
 {
     if (DayState::isDay($hour)) {
         $context->changeState(DayState::getInstance());
     }
 }