Added posibility to add multiple arbiters

This commit is contained in:
Jeroen De Meerleer 2019-09-26 14:48:55 +02:00
parent 89627cd369
commit 34a9e43da9
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6

View File

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