'; foreach ($snapshot->getMessages() as $message) { echo getMessageHTML($message) . "
\n"; } echo '

'; } /** * @param Message $message * @return string */ function getMessageHTML($message) { $sender = $message->getSender(); return 'getUUID() . '\">' . $sender->getUsername() . ' - ' . $message->getMessage(); } /** * @param String $identifier * @param array $snapshotData Snapshot data array. * @return Snapshot */ function toSnapshot($identifier, $snapshotData) { $players = toPlayers($snapshotData['usernames']); $messages = toMessages($players, $snapshotData['snapshots']); $timeGenerated = $snapshotData["time_generated"]; return new Snapshot($identifier, $messages, $players, $timeGenerated); } /** * @param Player[] $players * @param array $messagesData Messages data array. * @return Message[] */ function toMessages($players, $messagesData) { $messages = array(); for ($i = 0; $i < count($messagesData); $i++) { $messages[$i] = getMessage($players, $messagesData[$i]); } return $messages; } /** * @param Player[] $players * @param array $messageData Message data array. * @return Message */ function getMessage($players, $messageData) { $sender = getPlayer($players, $messageData['sender']); $recipients = getPlayersFromUUIDs($players, $messageData['recipients']); $timestamp = $messageData['time']; $message = $messageData['message']; return new Message($sender, $recipients, $timestamp, $message); } /** * @param Player[] $players * @param String[] $uuidArray the UUIDs of the players to fetch * @return Player[] */ function getPlayersFromUUIDs($players, $uuidArray) { $matchedPlayers = array(); for ($i = 0; $i < count($uuidArray); $i++) { $matchedPlayers[$i] = getPlayer($players, $uuidArray[$i]); } return $matchedPlayers; } /** * @param Player[] $playersArray * @return Player[] */ function toPlayers($playersArray) // String UUID as Key { $players = array(); foreach ($playersArray as $uuid => $username) { $players[$uuid] = new Player($uuid, $username); } return $players; } /** * @param Player[] $players * @param String $uuid * @return Player */ function getPlayer($players, $uuid) { $player = $players[$uuid]; if ($player != null) { return $player; } else { throw new RuntimeException('Player for UUID not found.'); } } /** * @param String $input * @return String */ function removeBadCharacters($input) { return preg_replace('/[^A-Za-z0-9_\-]/', '_', $input); } ?> Snapshot for Report #<?php echo $reportNumber ?> getTimeGenerated() / 1000; $friendlyDateTime = date('m/d/y \a\t h:ia', $seconds); echo '

'; echo 'Snapshot taken at: ' . $friendlyDateTime; echo '
'; echo 'Player names were valid at this time.'; echo '

'; ?>