Example #1
0
 public function doClock(Context $context, $time)
 {
     if (strtotime($time) >= strtotime(service_start_time) && strtotime($time) < strtotime(lunch_start_time)) {
         $context->changeState(DayState::getInstance());
     }
     if (strtotime($time) >= strtotime(lunch_start_time) && strtotime($time) < strtotime(lunch_end_time)) {
         $context->changeState(LunchState::getInstance());
     }
     if (strtotime($time) >= strtotime(lunch_end_time) && strtotime($time) < strtotime(service_end_time)) {
         $context->changeState(DayState::getInstance());
     }
     if (strtotime($time) >= strtotime(service_end_time)) {
         $context->changeState(NightState::getInstance());
     }
 }
Example #2
0
 public function doClock(Context $context, $time)
 {
     if (strtotime(service_start_time) <= strtotime($time) || strtotime($time) < strtotime(service_end_time)) {
         $context->changeState(DayState::getInstance());
     }
 }