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