database->conn); $timeMapper = new TimeMapper($app->database->conn); $prev_hash = (int)filter_input(INPUT_GET, 'h'); $data = []; $times = $timeMapper->getAll(); foreach ($times as $time) { $team = $teamMapper->get($time->teamId); if (!$team) { return; } $row = [ "name" => $team->name, "rounds" => $team->rounds, "bestTime" => $team->bestTime ]; array_push($data, $row); } $hash = crc32(serialize($data)); if ($prev_hash !== $hash) { $app->api([ "hash" => $hash, "data" => $data ]); } // return nothing http_response_code(204);