Replaced pairtwo Tournament System Values for generic Values

This commit is contained in:
Jeroen De Meerleer 2019-03-19 16:35:54 +01:00
parent 34f0e592df
commit 32a0021ff2
2 changed files with 18 additions and 5 deletions

View File

@ -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';
}

View File

@ -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