From 682cf386b6ce5ad8c4345b6783b525c7aea39fde Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Mon, 11 Feb 2019 16:42:20 +0100 Subject: [PATCH] Added tournament year and rounddates --- src/Models/Tournament.php | 17 +++++++++++++++++ src/Sws.php | 13 ++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/Models/Tournament.php b/src/Models/Tournament.php index 55dc789..bac122b 100644 --- a/src/Models/Tournament.php +++ b/src/Models/Tournament.php @@ -54,6 +54,7 @@ class Tournament private $SecondPeriod; private $Federation; private $Players; + private $Year; /** * @return string @@ -359,4 +360,20 @@ class Tournament $this->Players = $Players; } + /** + * @return mixed + */ + public function getYear() + { + return $this->Year; + } + + /** + * @param mixed $Year + */ + public function setYear($Year): void + { + $this->Year = $Year; + } + } diff --git a/src/Sws.php b/src/Sws.php index 8a5ae0d..1acee90 100644 --- a/src/Sws.php +++ b/src/Sws.php @@ -457,7 +457,18 @@ class Sws extends SwsModel $sws->getTournament()->setOrganiserClub(self::ReadData('String', substr($swscontents, $offset, $length))); $offset += $length; - // echo dechex($offset) . PHP_EOL; + // Tournament year + $length = 4; + $sws->getTournament()->setYear(self::ReadData('Int', substr($swscontents, $offset, $length))); + $offset += $length; + + // Round dates + for ($i = 1; $i < $sws->getTournament()->getRounds(); $i++) { + $length = 4; + $sws->setBinaryData('Round_' . $i . '_date', self::ReadData('Date', substr($swscontents, $offset, $length))); + $offset += $length; + } + if ($sws->getBinaryData("CurrentRound") > 0) { // echo "go" . PHP_EOL; for ($i = 0; $i < $sws->getBinaryData("CreatedRounds"); $i++) {