From 55587a424bba9d083504b307ed9de1c353a7cb40 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Wed, 1 May 2019 16:27:07 +0200 Subject: [PATCH] Updated Showing the pairings of a specific round (markdown) --- Showing-the-pairings-of-a-specific-round.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Showing-the-pairings-of-a-specific-round.md b/Showing-the-pairings-of-a-specific-round.md index 3783d9d..615906d 100644 --- a/Showing-the-pairings-of-a-specific-round.md +++ b/Showing-the-pairings-of-a-specific-round.md @@ -8,15 +8,23 @@ When you have the round object you can the `Round::GetPairings()` method to get ## Example ````php -require_once('vendor/autoload.php''); -use JeroenED/Libpairtwo/Sws; +getTournament(); $pairings = $tournament->getRoundByNo($_GET['round'])->getPairings(); foreach($pairings as $pairing) { $player = $pairing->getPlayer()->getName(); - $opponent = $pairing->getOpponent()->getName(); - $color = $pairing->getColor()->getKey(); - echo $player . ' against ' . $opponent . ' using ' . $color; + if (!is_null($pairing->getOpponent())) { + $opponent = $pairing->getOpponent()->getName(); + $color = $pairing->getColor()->getKey(); + echo $player . ' against ' . $opponent . ' using ' . $color . PHP_EOL; + } elseif ($pairing->getResult() == Result::bye ) { + echo $player . ' is bye' . PHP_EOL; + } elseif ($pairing->getResult() == Result::absent ) { + echo $player . ' is absent' . PHP_EOL; + } } \ No newline at end of file