public function isRunningFromDB($day, $hour, $minute) { if(!$this->holidays && Holidays::is_holiday()) { // this shuttle does not run on holidays // and today is a holiday return False; } $next_stop = $this->getNextStop($day, $hour, $minute); $day = new day($day); // Calculate a time offset if the next stop is tommorow if($day == $next_stop["real_day"]) { $offset = 0; } elseif($day->next() == $next_stop["real_day"]) { $offset = 24 * 60; } else { // the next stop is not anytime soon, more than a day into // future return False; } $next_stop_time = $offset + $next_stop["hour"] * 60 + $next_stop["minute"]; $this_time = $hour * 60 + $minute; if($next_stop_time - $this_time > 25) { // next stop more than 25 minutes into the future return False; } else { return True; } }