mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-11-21 22:17:41 +01:00
Merge branch 'task/multiple-arbiters' into develop
This commit is contained in:
commit
3282e18058
@ -2,7 +2,9 @@
|
||||
|
||||
## v1.2 (Release: aa-bbb-cccc)
|
||||
* NEW READER: `swar-4` for reading out files created with Swar version 4.
|
||||
* NEW FEATURE: `Tournament::getArbiters` for multiple arbiters in 1 tournament
|
||||
* ENHANCEMENT: `Class::getBinaryData` methods return null if field is non-existent
|
||||
* CHANGE: `Tournament::getArbiter` accepts a `int` parameter representing the order of the arbiters
|
||||
* BUGFIX: `Player:GetId` returns elo instead of id
|
||||
|
||||
## v1.1.2 (Release: 21-jun-2019)
|
||||
|
3
dist/boilerplate.php
vendored
3
dist/boilerplate.php
vendored
@ -27,7 +27,8 @@ echo "Name: " . $reader->getTournament()->getName() . PHP_EOL;
|
||||
echo "Organiser: " . $reader->getTournament()->getOrganiser(). PHP_EOL;
|
||||
echo "Tempo: " . $reader->getTournament()->getTempo() . PHP_EOL;
|
||||
echo "Country: " . $reader->getTournament()->getOrganiserCountry() . PHP_EOL;
|
||||
echo "Arbiter: " . $reader->getTournament()->getArbiter() . PHP_EOL;
|
||||
echo "Arbiter 1: " . $reader->getTournament()->getArbiter(0) . PHP_EOL;
|
||||
echo "Arbiter 2: " . $reader->getTournament()->getArbiter(1) . PHP_EOL;
|
||||
echo "Rounds: " . $reader->getTournament()->getNoOfRounds() . PHP_EOL;
|
||||
echo "Participants: " . $reader->getTournament()->getParticipants() . PHP_EOL;
|
||||
echo "Fidehomol: " . $reader->getTournament()->getFideHomol() . PHP_EOL;
|
||||
|
@ -571,7 +571,7 @@ class Pairtwo6 implements ReaderInterface
|
||||
|
||||
// Arbiters
|
||||
$length = 128;
|
||||
$this->getTournament()->setArbiter($this->readData('String', substr($swscontents, $offset, $length)));
|
||||
$this->getTournament()->setArbiter($this->readData('String', substr($swscontents, $offset, $length)), 0);
|
||||
$offset += $length;
|
||||
|
||||
// Rounds
|
||||
|
@ -128,9 +128,8 @@ class Swar4 implements ReaderInterface
|
||||
$this->getTournament()->setOrganiserClub($this->readData('String', $swshandle));
|
||||
$this->getTournament()->setOrganiserPlace($this->readData('String', $swshandle));
|
||||
|
||||
// @todo: Make arbiter an array to set multiple arbiters
|
||||
$this->getTournament()->setArbiter($this->readData('String', $swshandle));
|
||||
$this->getTournament()->setBinaryData('Arbiter2', $this->readData('String', $swshandle));
|
||||
$this->getTournament()->setArbiter($this->readData('String', $swshandle), 0);
|
||||
$this->getTournament()->setArbiter($this->readData('String', $swshandle), 1);
|
||||
|
||||
$this->getTournament()->setStartDate($this->readData('Date', $swshandle));
|
||||
$this->getTournament()->setEndDate($this->readData('Date', $swshandle));
|
||||
|
@ -57,8 +57,8 @@ class Tournament
|
||||
/** @var DateTime */
|
||||
private $EndDate;
|
||||
|
||||
/** @var string */
|
||||
private $Arbiter;
|
||||
/** @var string[] */
|
||||
private $Arbiters;
|
||||
|
||||
/** @var int */
|
||||
private $NoOfRounds;
|
||||
@ -198,6 +198,21 @@ class Tournament
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds an arbiter to the tournament
|
||||
*
|
||||
* @param string $Arbiter
|
||||
* @return Tournament
|
||||
*/
|
||||
public function addArbiter(string $Arbiter): Tournament
|
||||
{
|
||||
$newArray = $this->getArbiters();
|
||||
$newArray[] = $Arbiter;
|
||||
$this->setArbiters($newArray);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts pairings into games with a black and white player
|
||||
*
|
||||
@ -999,20 +1014,42 @@ class Tournament
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getArbiter(): string
|
||||
public function getArbiter(int $order = 0): string
|
||||
{
|
||||
return $this->Arbiter;
|
||||
return $this->Arbiters[$order];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the arbiters of the tournament
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getArbiters(): array
|
||||
{
|
||||
return $this->Arbiters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the arbiter of the tournament
|
||||
*
|
||||
* @param string $Arbiter
|
||||
* @param string[] $Arbiter
|
||||
* @return Tournament
|
||||
*/
|
||||
public function setArbiter(string $Arbiter): Tournament
|
||||
public function setArbiter(string $Arbiter, int $order = 0): Tournament
|
||||
{
|
||||
$this->Arbiter = $Arbiter;
|
||||
$this->Arbiters[$order] = $Arbiter;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the arbiters of the tournament
|
||||
*
|
||||
* @param string[] $Arbiters
|
||||
* @return Tournament
|
||||
*/
|
||||
public function setArbiters(array $Arbiters): Tournament
|
||||
{
|
||||
$this->Arbiters = $Arbiters;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,8 @@ echo "TempoIndex: " . $sws->getTournament()->getBinaryData('TempoIndex') . PHP
|
||||
echo "TempoType: " . $sws->getTournament()->getBinaryData('TournoiStd') . PHP_EOL;
|
||||
echo "Tempo: " . $sws->getTournament()->getTempo() . PHP_EOL;
|
||||
echo "Place: " . $sws->getTournament()->getOrganiserPlace() . PHP_EOL;
|
||||
echo "Arbiter: " . $sws->getTournament()->getArbiter() . PHP_EOL;
|
||||
echo "Arbiter 1: " . $sws->getTournament()->getArbiter(0) . PHP_EOL;
|
||||
echo "Arbiter 2: " . $sws->getTournament()->getArbiter(1) . PHP_EOL;
|
||||
echo "Rounds: " . $sws->getTournament()->getNoOfRounds() . PHP_EOL;
|
||||
echo "Fidehomol: " . $sws->getTournament()->getFideHomol() . PHP_EOL;
|
||||
echo "Start-Date: " . $sws->getTournament()->getStartDate()->format('d/m/Y') . PHP_EOL;
|
||||
|
Loading…
Reference in New Issue
Block a user