public function qualifies(Team $team, $time, $city, $direction, $distance, $defaultIfNull) { if ($time != null) { if (current_mysql_time() >= $time) { return true; } } if ($direction != null && $distance != null && $city != null) { $checkIn = CheckIn::getMostRecent($team); if ($checkIn != null && Direction::inRange($checkIn, $city, $direction, $distance)) { return true; } } if ($time == null && ($direction == null || $distance == null || $city == null)) { return $defaultIfNull; } return false; }