From 34a9e43da9d63189e642dd7827246819fdde0e3f Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Thu, 26 Sep 2019 14:48:55 +0200 Subject: [PATCH] Added posibility to add multiple arbiters --- src/Tournament.php | 51 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/src/Tournament.php b/src/Tournament.php index 45e037e..da2aa20 100644 --- a/src/Tournament.php +++ b/src/Tournament.php @@ -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; }