Not using literal values for Result

This commit is contained in:
Jeroen De Meerleer 2019-03-19 16:47:19 +01:00
parent d4d774aae6
commit 3f44bc6f01
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 12 additions and 12 deletions

View File

@ -18,7 +18,7 @@ class Result extends Enum
const won = '1'; const won = '1';
const absent = '0 FF'; const absent = '0 FF';
const wonforfait = '1 FF'; const wonforfait = '1 FF';
const adjourn = '0 A'; const adjourned = '0 A';
const drawadjourned = '0.5 A'; const drawadjourned = '0.5 A';
const wonadjourned = '1 A'; const wonadjourned = '1 A';
const bye = '0 Bye'; const bye = '0 Bye';

View File

@ -580,37 +580,37 @@ class Sws extends SwsModel
$length = 1; $length = 1;
switch (self::ReadData('Int', substr($swscontents, $offset, $length))) { switch (self::ReadData('Int', substr($swscontents, $offset, $length))) {
case 0: case 0:
$result = '*'; $result = Result::none;
break; break;
case 1: case 1:
$result = '0'; $result = Result::lost;
break; break;
case 2: case 2:
$result = '0 FF'; $result = Result::absent;
break; break;
case 3: case 3:
$result = '0 A'; $result = Result::adjourned;
break; break;
case 4: case 4:
$result = '0 Bye'; $result = Result::bye;
break; break;
case 6: case 6:
$result = '0.5'; $result = Result::draw;
break; break;
case 8: case 8:
$result = '0.5 A'; $result = Result::drawadjourned;
break; break;
case 11: case 11:
$result = '1'; $result = Result::won;
break; break;
case 12: case 12:
$result = '1 FF'; $result = Result::wonforfait;
break; break;
case 13: case 13:
$result = '1 A'; $result = Result::wonadjourned;
break; break;
case 13: case 13:
$result = '1 Bye'; $result = Result::wonbye;
break; break;
} }
$pairing->setResult(new Result($result)); $pairing->setResult(new Result($result));