updated test

This commit is contained in:
Jeroen De Meerleer 2019-06-01 16:32:23 +02:00
parent 11dd03b9e6
commit 21d105627e
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6

View File

@ -78,13 +78,14 @@ echo "Tiebreak 5: " . $sws->getTournament()->getTiebreaks()[4]->getValue() . P
echo "Tiebreak 6: " . $sws->getTournament()->getTiebreaks()[5]->getValue() . PHP_EOL; echo "Tiebreak 6: " . $sws->getTournament()->getTiebreaks()[5]->getValue() . PHP_EOL;
echo "Average Elo: " . $sws->getTournament()->getAverageElo() . PHP_EOL; echo "Average Elo: " . $sws->getTournament()->getAverageElo() . PHP_EOL;
foreach ($sws->getTournament()->getRanking() as $player) { foreach ($sws->getTournament()->getRanking() as $player) {
echo str_pad($player->getName() . '(' . $player->getElo($sws->getTournament()->getPriorityElo()) . ') ', 35) . implode_pad(' ', $player->getTiebreaks(), 5,' ') . PHP_EOL; echo str_pad($player->getName() . '(' . $player->getElo($sws->getTournament()->getPriorityElo()) . ') ', 35) . implode_pad(' ', $player->getTiebreaks(), 5, ' ') . PHP_EOL;
} }
function implode_pad ($glue, $collection, $padlength, $padstring): string { function implode_pad($glue, $collection, $padlength, $padstring): string
$newarray = []; {
foreach ($collection as $elem) { $newarray = [];
$newarray[] = str_pad($elem, $padlength, $padstring); foreach ($collection as $elem) {
} $newarray[] = str_pad($elem, $padlength, $padstring);
return implode($glue, $newarray); }
return implode($glue, $newarray);
} }