mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-11-21 14:07:42 +01:00
Added a reading of rounds
not finished yet
This commit is contained in:
parent
830b21afa2
commit
82370b25d7
16
src/Game.php
Normal file
16
src/Game.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: jeroen
|
||||
* Date: 1/02/19
|
||||
* Time: 17:17
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo;
|
||||
|
||||
use JeroenED\Libpairtwo\Models\Game as GameModel;
|
||||
|
||||
class Game extends GameModel
|
||||
{
|
||||
|
||||
}
|
15
src/Models/Game.php
Normal file
15
src/Models/Game.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: jeroen
|
||||
* Date: 1/02/19
|
||||
* Time: 17:16
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo\Models;
|
||||
|
||||
|
||||
class Game
|
||||
{
|
||||
|
||||
}
|
48
src/Models/Round.php
Normal file
48
src/Models/Round.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: jeroen
|
||||
* Date: 1/02/19
|
||||
* Time: 17:13
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo\Models;
|
||||
|
||||
class Round
|
||||
{
|
||||
private $date;
|
||||
private $games;
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*
|
||||
*/
|
||||
public function getDate()
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $date
|
||||
*/
|
||||
public function setDate($date): void
|
||||
{
|
||||
$this->date = $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Game[]
|
||||
*/
|
||||
public function getGames()
|
||||
{
|
||||
return $this->games;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Game[] $games
|
||||
*/
|
||||
public function setGames($games): void
|
||||
{
|
||||
$this->games = $games;
|
||||
}
|
||||
}
|
16
src/Round.php
Normal file
16
src/Round.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: jeroen
|
||||
* Date: 1/02/19
|
||||
* Time: 17:16
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo;
|
||||
|
||||
use JeroenED\Libpairtwo\Models\Round as RoundModel;
|
||||
|
||||
class Round extends RoundModel
|
||||
{
|
||||
|
||||
}
|
22
src/Sws.php
22
src/Sws.php
@ -278,6 +278,8 @@ class Sws extends SwsModel
|
||||
|
||||
$length = 4;
|
||||
$player->setFideElo(self::ReadData('Int', substr($swscontents, $offset, $length)));
|
||||
echo "offset: " . $offset . PHP_EOL;
|
||||
echo "length: " . $length . PHP_EOL;
|
||||
$offset += $length;
|
||||
|
||||
$length = 1;
|
||||
@ -457,6 +459,26 @@ class Sws extends SwsModel
|
||||
$sws->getTournament()->setOrganiserClub(self::ReadData('String', substr($swscontents, $offset, $length)));
|
||||
$offset += $length;
|
||||
|
||||
echo dechex($offset) . PHP_EOL;
|
||||
if ($sws->getBinaryData("CurrentRound") > 0) {
|
||||
echo "go" . PHP_EOL;
|
||||
for ($i = 0; $i < $sws->getBinaryData("CreatedRounds"); $i++) {
|
||||
$game = new Game();
|
||||
|
||||
$length = 4;
|
||||
echo $offset . "Opponent: " . self::ReadData('String', substr($swscontents, $offset, $length)) . PHP_EOL;
|
||||
$offset += $length;
|
||||
|
||||
$length = 1;
|
||||
echo $offset . "Color: " . self::ReadData('String', substr($swscontents, $offset, $length)) . PHP_EOL;
|
||||
$offset += $length;
|
||||
|
||||
$length = 1;
|
||||
echo $offset . "Result: " . self::ReadData('String', substr($swscontents, $offset, $length)) . PHP_EOL;
|
||||
$offset += $length;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $sws;
|
||||
}
|
||||
|
@ -41,4 +41,15 @@ class Tournament extends TournamentModel
|
||||
$newArray[$id] = $player;
|
||||
$this->setPlayers($newArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Round $round
|
||||
*/
|
||||
public function addRound(Round $round)
|
||||
{
|
||||
$newArray = $this->GetRounds();
|
||||
$newArray[] = $round;
|
||||
$this->setRounds($newArray);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user