diff --git a/src/Tiebreaks.php b/src/Tiebreaks.php new file mode 100644 index 0000000..4b5cb81 --- /dev/null +++ b/src/Tiebreaks.php @@ -0,0 +1,45 @@ +getPlayers() as $player) { + $currentTiebreaks = $player->getTiebreaks(); + $currentTiebreaks[$key] = $player->getBinaryData('ScoreAmerican'); + $player->setTiebreaks($currentTiebreaks); + } + } + + /** + * @param int $key + */ + protected function calculateAmerican(int $key) + { + foreach ($this->getPlayers() as $player) { + $currentTiebreaks = $player->getTiebreaks(); + $currentTiebreaks[$key] = $player->getBinaryData('ScoreAmerican'); + $player->setTiebreaks($currentTiebreaks); + } + } + + /** + * @param int $key + */ + protected function calculatePoints(int $key) + { + foreach ($this->getPlayers() as $player) { + $currentTiebreaks = $player->getTiebreaks(); + $currentTiebreaks[$key] = $player->getBinaryData('Points'); + $player->setTiebreaks($currentTiebreaks); + } + } +} diff --git a/src/Tournament.php b/src/Tournament.php index 125329b..b071d21 100644 --- a/src/Tournament.php +++ b/src/Tournament.php @@ -9,10 +9,9 @@ namespace JeroenED\Libpairtwo; use JeroenED\Libpairtwo\Enums\Tiebreak; -use JeroenED\Libpairtwo\Models\Tournament as TournamentModel; use JeroenED\Libpairtwo\Enums\Color; -class Tournament extends TournamentModel +class Tournament extends Tiebreaks { /** * Gets a player by its ID @@ -246,40 +245,4 @@ class Tournament extends TournamentModel } return $this; } - - /** - * @param int $key - */ - private function calculateKeizer(int $key) - { - foreach ($this->getPlayers() as $player) { - $currentTiebreaks = $player->getTiebreaks(); - $currentTiebreaks[$key] = $player->getBinaryData('ScoreAmerican'); - $player->setTiebreaks($currentTiebreaks); - } - } - - /** - * @param int $key - */ - private function calculateAmerican(int $key) - { - foreach ($this->getPlayers() as $player) { - $currentTiebreaks = $player->getTiebreaks(); - $currentTiebreaks[$key] = $player->getBinaryData('ScoreAmerican'); - $player->setTiebreaks($currentTiebreaks); - } - } - - /** - * @param int $key - */ - private function calculatePoints(int $key) - { - foreach ($this->getPlayers() as $player) { - $currentTiebreaks = $player->getTiebreaks(); - $currentTiebreaks[$key] = $player->getBinaryData('Points'); - $player->setTiebreaks($currentTiebreaks); - } - } }