From a2a0f99b147e290dba4d6f241dc59ecc7295a1f3 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Tue, 19 Mar 2019 16:35:54 +0100 Subject: [PATCH] Replaced pairtwo Tournament System Values for generic Values --- src/Enums/TournamentSystem.php | 8 ++++---- src/Sws.php | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Enums/TournamentSystem.php b/src/Enums/TournamentSystem.php index 1fc2c64..3f7755d 100644 --- a/src/Enums/TournamentSystem.php +++ b/src/Enums/TournamentSystem.php @@ -12,8 +12,8 @@ use MyCLabs\Enum\Enum; class TournamentSystem extends Enum { - const Swiss = 0; - const Closed = 2; - const American = 4; - const Imperial = 6; + const Swiss = 'Swiss'; + const Closed = 'Closed'; + const American = 'American'; + const Imperial = 'Imperal'; } diff --git a/src/Sws.php b/src/Sws.php index 7a43ba0..45c6868 100644 --- a/src/Sws.php +++ b/src/Sws.php @@ -483,7 +483,20 @@ class Sws extends SwsModel // Type $length = 4; - $sws->getTournament()->setSystem(new TournamentSystem(self::ReadData('Int', substr($swscontents, $offset, $length)))); + Switch(self::ReadData('Int', substr($swscontents, $offset, $length))) { + case 0: + $system = TournamentSystem::Swiss; + break; + case 2: + $system = TournamentSystem::Closed; + break; + case 4: + $system = TournamentSystem::American; + break; + case 6: + $system = TournamentSystem::Imperial; + } + $sws->getTournament()->setSystem(new TournamentSystem($system)); $offset += $length; // Federation