mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-11-22 06:26:57 +01:00
Updated docs
This commit is contained in:
parent
50a97ad572
commit
db989487a1
16
src/Game.php
16
src/Game.php
@ -29,13 +29,13 @@ use JeroenED\Libpairtwo\Pairing;
|
||||
*/
|
||||
class Game
|
||||
{
|
||||
/** @var Pairing|null */
|
||||
/** @var Pairing | null */
|
||||
private $white;
|
||||
|
||||
/** @var Pairing|null */
|
||||
/** @var Pairing | null */
|
||||
private $black;
|
||||
|
||||
/** @var GameResult|null */
|
||||
/** @var GameResult | null */
|
||||
private $result;
|
||||
|
||||
/**
|
||||
@ -77,7 +77,7 @@ class Game
|
||||
/**
|
||||
* Gets pairing for white player
|
||||
*
|
||||
* @return Pairing|null
|
||||
* @return Pairing | null
|
||||
*/
|
||||
public function getWhite(): ?Pairing
|
||||
{
|
||||
@ -87,7 +87,7 @@ class Game
|
||||
/**
|
||||
* Sets pairing for white player
|
||||
*
|
||||
* @param Pairing|null $white
|
||||
* @param Pairing | null $white
|
||||
* @return Game
|
||||
*/
|
||||
public function setWhite(?Pairing $white): Game
|
||||
@ -99,7 +99,7 @@ class Game
|
||||
/**
|
||||
* Gets pairing for black player
|
||||
*
|
||||
* @return Pairing|null
|
||||
* @return Pairing | null
|
||||
*/
|
||||
public function getBlack(): ?Pairing
|
||||
{
|
||||
@ -109,7 +109,7 @@ class Game
|
||||
/**
|
||||
* Sets pairing for black player
|
||||
*
|
||||
* @param Pairing|null $black
|
||||
* @param Pairing | null $black
|
||||
* @return Game
|
||||
*/
|
||||
public function setBlack(?Pairing $black): Game
|
||||
@ -121,7 +121,7 @@ class Game
|
||||
/**
|
||||
* Sets result for game
|
||||
*
|
||||
* @param Gameresult|null $result
|
||||
* @param Gameresult | null $result
|
||||
* @return Game
|
||||
*/
|
||||
public function setResult(?Gameresult $result): Game
|
||||
|
@ -42,8 +42,11 @@ abstract class IOFactory
|
||||
/**
|
||||
* Creates a reader for $type
|
||||
*
|
||||
* Compatible types are Pairtwo-5 and Pairtwo-6
|
||||
*
|
||||
* @param string $type
|
||||
* @return ReaderInterface
|
||||
* @throws LibpairtwoException
|
||||
*/
|
||||
public static function createReader(string $type): ReaderInterface
|
||||
{
|
||||
|
@ -27,10 +27,10 @@ use JeroenED\Libpairtwo\Enums\Result;
|
||||
*/
|
||||
class Pairing
|
||||
{
|
||||
/** @var Player|null */
|
||||
/** @var Player | null */
|
||||
private $Player;
|
||||
|
||||
/** @var Player|null */
|
||||
/** @var Player | null */
|
||||
private $Opponent;
|
||||
|
||||
/** @var Color */
|
||||
@ -43,7 +43,9 @@ class Pairing
|
||||
private $Round;
|
||||
|
||||
/**
|
||||
* @return Player|null
|
||||
* Returns the player of the pairing
|
||||
*
|
||||
* @return Player | null
|
||||
*/
|
||||
public function getPlayer(): ?Player
|
||||
{
|
||||
@ -51,7 +53,9 @@ class Pairing
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Player|null $Player
|
||||
* Sets the player of the pairing
|
||||
*
|
||||
* @param Player | null $Player
|
||||
* @return Pairing
|
||||
*/
|
||||
public function setPlayer(?Player $Player): Pairing
|
||||
@ -61,7 +65,9 @@ class Pairing
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Player|null
|
||||
* Returns the opponent of the pairing
|
||||
*
|
||||
* @return Player | null
|
||||
*/
|
||||
public function getOpponent(): ?Player
|
||||
{
|
||||
@ -69,7 +75,9 @@ class Pairing
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Player|null $Opponent
|
||||
* Sets the opponent of the pairing
|
||||
*
|
||||
* @param Player | null $Opponent
|
||||
* @return Pairing
|
||||
*/
|
||||
public function setOpponent(?Player $Opponent): Pairing
|
||||
@ -79,6 +87,8 @@ class Pairing
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the color of the pairing
|
||||
*
|
||||
* @return Color
|
||||
*/
|
||||
public function getColor(): Color
|
||||
@ -87,6 +97,8 @@ class Pairing
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color of the pairing
|
||||
*
|
||||
* @param Color $Color
|
||||
* @return Pairing
|
||||
*/
|
||||
@ -97,6 +109,8 @@ class Pairing
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the individual result of the pairing
|
||||
*
|
||||
* @return Result
|
||||
*/
|
||||
public function getResult(): Result
|
||||
@ -105,6 +119,8 @@ class Pairing
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the individual result of the pairing
|
||||
*
|
||||
* @param Result $Result
|
||||
* @return Pairing
|
||||
*/
|
||||
@ -115,6 +131,8 @@ class Pairing
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the round number of the pairing
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRound(): int
|
||||
@ -123,6 +141,8 @@ class Pairing
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the round number of the pairing
|
||||
*
|
||||
* @param int $Round
|
||||
* @return Pairing
|
||||
*/
|
||||
|
@ -101,6 +101,7 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the elo of elotype for the player
|
||||
* @param string $type
|
||||
* @return int
|
||||
*/
|
||||
@ -110,6 +111,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the elo of elotype for the player
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $value
|
||||
* @return Player
|
||||
@ -123,6 +126,10 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the identifier of type for the player
|
||||
*
|
||||
* Common possible values are Fide or National
|
||||
*
|
||||
* @param string $type
|
||||
* @return string
|
||||
*/
|
||||
@ -132,6 +139,10 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the identifier of type for the player
|
||||
*
|
||||
* Common possible values are Fide or National
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $value
|
||||
* @return Player
|
||||
@ -145,6 +156,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of won matches for the player
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getNoOfWins(): int
|
||||
@ -159,6 +172,11 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the points of the player.
|
||||
*
|
||||
* 1 Point is awarded for winning
|
||||
* 0.5 points are awarded for draw
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPoints(): float
|
||||
@ -176,6 +194,10 @@ class Player
|
||||
|
||||
|
||||
/**
|
||||
* Returns the performance rating of the player
|
||||
*
|
||||
* WARNING: Calculation currently incorrect. Uses the rule of 400 as temporary solution
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPerformance(string $type, int $unratedElo): float
|
||||
@ -201,6 +223,8 @@ class Player
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of played games of the player
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPlayedGames(): int
|
||||
@ -215,6 +239,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the player
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
@ -223,8 +249,10 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of the player
|
||||
*
|
||||
* @param string $Name
|
||||
* @return \JeroenED\Libpairtwo\Models\Player
|
||||
* @return Player
|
||||
*/
|
||||
public function setName(string $Name): Player
|
||||
{
|
||||
@ -233,6 +261,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all ID's of the player
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getIds(): ?array
|
||||
@ -241,6 +271,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an array of all ID's of the player
|
||||
*
|
||||
* @param string[] $Ids
|
||||
* @return Player
|
||||
*/
|
||||
@ -251,6 +283,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all elos of the player
|
||||
*
|
||||
* @return int[]
|
||||
*/
|
||||
public function getElos(): ?array
|
||||
@ -259,6 +293,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an array of all elos of the player
|
||||
*
|
||||
* @param int[] $Elos
|
||||
* @return Player
|
||||
*/
|
||||
@ -269,24 +305,30 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
* Returns the date of birth of the player
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getDateOfBirth(): \DateTime
|
||||
public function getDateOfBirth(): DateTime
|
||||
{
|
||||
return $this->DateOfBirth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $DateOfBirth
|
||||
* Sets the date of birth of the player
|
||||
*
|
||||
* @param DateTime $DateOfBirth
|
||||
* @return Player
|
||||
*/
|
||||
public function setDateOfBirth(\DateTime $DateOfBirth): Player
|
||||
public function setDateOfBirth(DateTime $DateOfBirth): Player
|
||||
{
|
||||
$this->DateOfBirth = $DateOfBirth;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all tiebreaks for the player
|
||||
*
|
||||
* @return float[]
|
||||
*/
|
||||
public function getTiebreaks(): array
|
||||
@ -295,6 +337,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an array of all tiebreaks for the player
|
||||
*
|
||||
* @param float[] $Tiebreaks
|
||||
* @return Player
|
||||
*/
|
||||
@ -305,6 +349,7 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nation of the player
|
||||
* example value: BEL
|
||||
*
|
||||
* @return string
|
||||
@ -315,6 +360,7 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the nation of the player
|
||||
* example value: BEL
|
||||
*
|
||||
* @param string $Nation
|
||||
@ -327,6 +373,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the category of the player
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCategory(): string
|
||||
@ -335,6 +383,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the category of the player
|
||||
*
|
||||
* @param string $Category
|
||||
* @return Player
|
||||
*/
|
||||
@ -345,6 +395,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of the player
|
||||
*
|
||||
* @return Title
|
||||
*/
|
||||
public function getTitle(): Title
|
||||
@ -353,6 +405,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title of the player
|
||||
*
|
||||
* @param Title $Title
|
||||
* @return Player
|
||||
*/
|
||||
@ -363,6 +417,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the gender of the player
|
||||
*
|
||||
* @return Gender
|
||||
*/
|
||||
public function getGender(): Gender
|
||||
@ -371,6 +427,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the gender of the player
|
||||
*
|
||||
* @param Gender $Gender
|
||||
* @return Player
|
||||
*/
|
||||
@ -381,6 +439,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all pairings of the player
|
||||
*
|
||||
* @return Pairing[]
|
||||
*/
|
||||
public function getPairings(): array
|
||||
@ -389,6 +449,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an array of all pairings of the player
|
||||
*
|
||||
* @param Pairing[] $Pairings
|
||||
* @return Player
|
||||
*/
|
||||
@ -399,6 +461,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns binary data that was read out the pairtwo file but was not needed immediately
|
||||
*
|
||||
* @param string $Key
|
||||
* @return bool|DateTime|int|string
|
||||
*/
|
||||
@ -408,6 +472,8 @@ class Player
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets binary data that is read out the pairtwo file but is not needed immediately
|
||||
*
|
||||
* @param string $Key
|
||||
* @param bool|int|DateTime|string $Value
|
||||
* @return Player
|
||||
|
@ -55,6 +55,8 @@ class Pairtwo6 implements ReaderInterface
|
||||
private $BinaryData;
|
||||
|
||||
/**
|
||||
* Returns the version tag of Pairtwo which created the pairtwo file
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRelease(): string
|
||||
@ -63,8 +65,10 @@ class Pairtwo6 implements ReaderInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the version tag of Pairtwo which created the pairtwo file
|
||||
*
|
||||
* @param string $Release
|
||||
* @return \JeroenED\Libpairtwo\Readers\Models\Pairtwo6
|
||||
* @return Pairtwo6
|
||||
*/
|
||||
public function setRelease(string $Release): Pairtwo6
|
||||
{
|
||||
@ -73,6 +77,8 @@ class Pairtwo6 implements ReaderInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tournament that was read out of the pairtwo file
|
||||
*
|
||||
* @return Tournament
|
||||
*/
|
||||
public function getTournament(): Tournament
|
||||
@ -81,6 +87,8 @@ class Pairtwo6 implements ReaderInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tournament that was read out of the pairtwo file
|
||||
*
|
||||
* @param Tournament $Tournament
|
||||
* @return Pairtwo6
|
||||
*/
|
||||
@ -92,6 +100,8 @@ class Pairtwo6 implements ReaderInterface
|
||||
|
||||
|
||||
/**
|
||||
* Returns binary data that was read out the pairtwo file but was not needed immediately
|
||||
*
|
||||
* @param string $Key
|
||||
* @return bool|DateTime|int|string
|
||||
*/
|
||||
@ -102,6 +112,8 @@ class Pairtwo6 implements ReaderInterface
|
||||
|
||||
|
||||
/**
|
||||
* Sets binary data that is read out the pairtwo file but is not needed immediately
|
||||
*
|
||||
* @param string $Key
|
||||
* @param bool|int|DateTime|string $Value
|
||||
* @return Pairtwo6
|
||||
@ -119,7 +131,7 @@ class Pairtwo6 implements ReaderInterface
|
||||
* @return Pairtwo6
|
||||
* @throws IncompatibleReaderException
|
||||
*/
|
||||
public function read($filename): ReaderInterface
|
||||
public function read(string $filename): ReaderInterface
|
||||
{
|
||||
$swshandle = fopen($filename, 'rb');
|
||||
$swscontents = fread($swshandle, filesize($filename));
|
||||
|
@ -142,7 +142,7 @@ class Round
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns an array of all games in the tournament
|
||||
* Returns an array of all games for the round
|
||||
*
|
||||
* @return Game[]
|
||||
*/
|
||||
@ -151,7 +151,7 @@ class Round
|
||||
return $this->games;
|
||||
}
|
||||
/**
|
||||
* Sets Round::games to $games
|
||||
* Sets an array of all games for the round
|
||||
*
|
||||
* @param Game[] $games
|
||||
* @return Round
|
||||
@ -162,7 +162,7 @@ class Round
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns the round number
|
||||
* Returns the round number of the round
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@ -171,7 +171,7 @@ class Round
|
||||
return $this->roundNo;
|
||||
}
|
||||
/**
|
||||
* Sets the round number
|
||||
* Sets the round number of the round
|
||||
*
|
||||
* @param int $roundNo
|
||||
* @return Round
|
||||
@ -182,7 +182,7 @@ class Round
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns an array of all pairings for this round
|
||||
* Returns an array of all pairings for the round
|
||||
*
|
||||
* @return Pairing[]
|
||||
*/
|
||||
@ -191,7 +191,7 @@ class Round
|
||||
return $this->pairings;
|
||||
}
|
||||
/**
|
||||
* Sets Round::Pairings to $pairings
|
||||
* Sets an array of all pairings for the round
|
||||
*
|
||||
* @param Pairing[] $pairings
|
||||
* @return Round
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
namespace JeroenED\Libpairtwo;
|
||||
|
||||
use Closure;
|
||||
use DateTime;
|
||||
use JeroenED\Libpairtwo\Enums\Tiebreak;
|
||||
use JeroenED\Libpairtwo\Enums\Color;
|
||||
@ -288,8 +289,9 @@ class Tournament
|
||||
*
|
||||
* @param Game $game
|
||||
* @param int $round
|
||||
* @return Tournament
|
||||
*/
|
||||
public function addGame(Game $game, int $round)
|
||||
public function addGame(Game $game, int $round): Tournament
|
||||
{
|
||||
if (!isset($this->getRounds()[$round])) {
|
||||
$roundObj = new Round();
|
||||
@ -298,6 +300,7 @@ class Tournament
|
||||
}
|
||||
|
||||
$this->getRoundByNo($round)->addGame($game);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -305,7 +308,7 @@ class Tournament
|
||||
*
|
||||
* @return Player[]
|
||||
*/
|
||||
public function getRanking()
|
||||
public function getRanking(): array
|
||||
{
|
||||
$players = $this->getPlayers();
|
||||
foreach ($this->getTiebreaks() as $tbkey=>$tiebreak) {
|
||||
@ -350,10 +353,10 @@ class Tournament
|
||||
/**
|
||||
* @param Player $a
|
||||
* @param Player $b
|
||||
* @return \Closure
|
||||
* @return Closure
|
||||
*/
|
||||
|
||||
private function sortTiebreak(int $key)
|
||||
private function sortTiebreak(int $key): Closure
|
||||
{
|
||||
return function (Player $a, Player $b) use ($key) {
|
||||
if (($b->getTiebreaks()[$key] == $a->getTiebreaks()[$key]) || ($a->getTiebreaks()[$key] === false) || ($b->getTiebreaks()[$key] === false)) {
|
||||
@ -365,7 +368,7 @@ class Tournament
|
||||
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateTiebreak(Tiebreak $tiebreak, Player $player, int $tbkey = 0): ?float
|
||||
{
|
||||
@ -465,7 +468,7 @@ class Tournament
|
||||
|
||||
/**
|
||||
* @param Player $player
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateKeizer(Player $player): ?float
|
||||
{
|
||||
@ -475,7 +478,7 @@ class Tournament
|
||||
|
||||
/**
|
||||
* @param Player $player
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateAmerican(Player $player): ?float
|
||||
{
|
||||
@ -485,7 +488,7 @@ class Tournament
|
||||
|
||||
/**
|
||||
* @param Player $player
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculatePoints(Player $player): ?float
|
||||
{
|
||||
@ -495,7 +498,7 @@ class Tournament
|
||||
|
||||
/**
|
||||
* @param Player $player
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateBaumbach(Player $player): ?float
|
||||
{
|
||||
@ -511,7 +514,7 @@ class Tournament
|
||||
|
||||
/**
|
||||
* @param Player $player
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateBlackPlayed(Player $player): ?float
|
||||
{
|
||||
@ -526,7 +529,7 @@ class Tournament
|
||||
|
||||
/**
|
||||
* @param Player $player
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateBlackWin(Player $player): ?float
|
||||
{
|
||||
@ -541,10 +544,12 @@ class Tournament
|
||||
|
||||
|
||||
/**
|
||||
* Result between the tied players
|
||||
*
|
||||
* @param Player $player
|
||||
* @param array $opponents
|
||||
* @param int $key
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateMutualResult(Player $player, array $opponents, int $key): ?float
|
||||
{
|
||||
@ -581,6 +586,8 @@ class Tournament
|
||||
|
||||
|
||||
/**
|
||||
* The average rating of the opponents
|
||||
*
|
||||
* @param Player $player
|
||||
* @param int $cut
|
||||
* @return float
|
||||
@ -604,9 +611,11 @@ class Tournament
|
||||
|
||||
|
||||
/**
|
||||
* The average performance of the opponents
|
||||
*
|
||||
* @param Player $player
|
||||
* @param int $cut
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateAveragePerformance(Player $player, string $type, int $cut = 0): ?float
|
||||
{
|
||||
@ -627,9 +636,11 @@ class Tournament
|
||||
|
||||
|
||||
/**
|
||||
* Points against players who have more than $cut % points
|
||||
*
|
||||
* @param Player $player
|
||||
* @param int $cut
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateKoya(Player $player, int $cut = 50): ?float
|
||||
{
|
||||
@ -648,10 +659,11 @@ class Tournament
|
||||
|
||||
|
||||
/**
|
||||
* The combined points of the opponents
|
||||
* @param Player $player
|
||||
* @param int $cutlowest
|
||||
* @param int $cuthighest
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateBuchholz(Player $player, int $cutlowest = 0, int $cuthighest = 0): ?float
|
||||
{
|
||||
@ -685,8 +697,10 @@ class Tournament
|
||||
|
||||
|
||||
/**
|
||||
* The points of $player's opponents who $player won against, plus half of the points of $player's opponents who $player drew against
|
||||
*
|
||||
* @param Player $player
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateSonneborn(Player $player): ?float
|
||||
{
|
||||
@ -705,8 +719,10 @@ class Tournament
|
||||
|
||||
|
||||
/**
|
||||
* 3 points for each, 1 for each draw and no for losing. -1 for not played games
|
||||
*
|
||||
* @param Player $player
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateSoccerKashdan(Player $player): ?float
|
||||
{
|
||||
@ -730,8 +746,10 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* 4 points for each, 2 for each draw and 1 point for losing. 0 points for not played games
|
||||
*
|
||||
* @param Player $player
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateKashdan(Player $player): ?float
|
||||
{
|
||||
@ -755,8 +773,10 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Combined score of $player after each round
|
||||
*
|
||||
* @param Player $player
|
||||
* @return float|null
|
||||
* @return float | null
|
||||
*/
|
||||
private function calculateCumulative(Player $player): ?float
|
||||
{
|
||||
@ -776,6 +796,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the tournament
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
@ -784,8 +806,10 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of the tournament
|
||||
*
|
||||
* @param string $Name
|
||||
* @return \JeroenED\Libpairtwo\Models\Tournament
|
||||
* @return Tournament
|
||||
*/
|
||||
public function setName(string $Name): Tournament
|
||||
{
|
||||
@ -794,6 +818,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the organiser of the tournament
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOrganiser(): string
|
||||
@ -802,6 +828,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the organiser of the tournament
|
||||
*
|
||||
* @param string $Organiser
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -812,6 +840,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the clubidentifier of the tournament
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOrganiserClubNo(): int
|
||||
@ -820,6 +850,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the clubidentifier of the tournament
|
||||
*
|
||||
* @param int $OrganiserClubNo
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -830,6 +862,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the club of the organiser
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOrganiserClub(): string
|
||||
@ -838,6 +872,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the club of the organiser
|
||||
*
|
||||
* @param string $OrganiserClub
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -848,6 +884,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the location of the tournament
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOrganiserPlace(): string
|
||||
@ -856,6 +894,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the location of the tournament
|
||||
*
|
||||
* @param string $OrganiserPlace
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -866,6 +906,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the country where the tournament is held
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOrganiserCountry(): string
|
||||
@ -874,6 +916,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the country where the tournament is held
|
||||
*
|
||||
* @param string $OrganiserCountry
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -884,6 +928,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the fide homologation
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getFideHomol(): int
|
||||
@ -892,6 +938,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the fide homologation
|
||||
*
|
||||
* @param int $FideHomol
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -902,6 +950,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the start date of the tournament
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getStartDate(): DateTime
|
||||
@ -910,6 +960,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the start date of the tournament
|
||||
*
|
||||
* @param DateTime $StartDate
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -920,6 +972,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the end date of the tournament
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getEndDate(): DateTime
|
||||
@ -928,6 +982,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the end date of the tournament
|
||||
*
|
||||
* @param DateTime $EndDate
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -938,6 +994,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the arbiter of the tournament
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getArbiter(): string
|
||||
@ -946,6 +1004,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the arbiter of the tournament
|
||||
*
|
||||
* @param string $Arbiter
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -956,6 +1016,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of round
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getNoOfRounds(): int
|
||||
@ -964,6 +1026,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of rounds
|
||||
*
|
||||
* @param int $NoOfRounds
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -974,6 +1038,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing all rounds of the tournament
|
||||
*
|
||||
* @return Round[]
|
||||
*/
|
||||
public function getRounds(): array
|
||||
@ -982,6 +1048,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an array containing all rounds of the tournament
|
||||
*
|
||||
* @param Round[] $Rounds
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -992,6 +1060,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tempo of the tournament
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTempo(): string
|
||||
@ -1000,6 +1070,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tempo of the tournament
|
||||
*
|
||||
* @param string $Tempo
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -1010,6 +1082,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the elo of a player if the player does not have one
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getNonRatedElo(): int
|
||||
@ -1018,6 +1092,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the elo of a player if the player does not have one
|
||||
*
|
||||
* @param int $NonRatedElo
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -1028,6 +1104,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tournament system
|
||||
*
|
||||
* @return TournamentSystem
|
||||
*/
|
||||
public function getSystem(): TournamentSystem
|
||||
@ -1036,6 +1114,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tournament system
|
||||
*
|
||||
* @param TournamentSystem $System
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -1046,6 +1126,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first period of the tempo
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstPeriod(): string
|
||||
@ -1054,6 +1136,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the first period of the tempo
|
||||
*
|
||||
* @param string $FirstPeriod
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -1064,6 +1148,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the second period of the tempo
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSecondPeriod(): string
|
||||
@ -1072,6 +1158,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the second period of the tempo
|
||||
*
|
||||
* @param string $SecondPeriod
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -1082,6 +1170,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the federation the tournament belongs to
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFederation(): string
|
||||
@ -1090,6 +1180,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the federation the tournament belongs to
|
||||
*
|
||||
* @param string $Federation
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -1100,6 +1192,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all players of the tournament
|
||||
*
|
||||
* @return Player[]
|
||||
*/
|
||||
public function getPlayers(): array
|
||||
@ -1108,6 +1202,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an array of all players of the tournament
|
||||
*
|
||||
* @param Player[] $Players
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -1118,6 +1214,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the year the tournament is held in
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getYear(): int
|
||||
@ -1126,6 +1224,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the year the tournament is held in
|
||||
*
|
||||
* @param int $Year
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -1136,6 +1236,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all pairings of the tournament
|
||||
*
|
||||
* @return Pairing[]
|
||||
*/
|
||||
public function getPairings(): array
|
||||
@ -1144,6 +1246,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an array of all pairings of the tournament
|
||||
*
|
||||
* @param Pairing[] $Pairings
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -1154,6 +1258,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all tiebreaks of the tournament
|
||||
*
|
||||
* @return Tiebreak[]
|
||||
*/
|
||||
public function getTiebreaks(): array
|
||||
@ -1162,6 +1268,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an array of all tiebreaks of the tournament
|
||||
*
|
||||
* @param Tiebreak[] $Tiebreaks
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -1172,6 +1280,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the elo that has priority
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPriorityElo(): string
|
||||
@ -1180,6 +1290,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the elo that has priority
|
||||
*
|
||||
* @param string $PriorityElo
|
||||
* @return Tournament
|
||||
*/
|
||||
@ -1189,6 +1301,8 @@ class Tournament
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Returns the identifier that has priority
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPriorityId(): string
|
||||
@ -1197,6 +1311,8 @@ class Tournament
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the identifier that has priority
|
||||
*
|
||||
* @param string $PriorityId
|
||||
* @return Tournament
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user