ENHANCEMENT: Better Docs generation

* NEW FEATURE: Added clean-dist and clean-dev targets
* ENHANCEMENT: Resized logo in Doxygen for better fit
* ENHANCEMENT: Doxygen takes branch name or version tag as `PROJECT_NUMBER`
* CHANGE: Version tag directly put in distribution filename
* CHANGE: `Tournament::GameExists()` renamed to `Tournament::gameExists()`
* CHANGE: Updated composer metadata
* CHANGE: Some setters changed to fluent setters. (More info: 7aca35057c10d2b982f93a698499c0c01df2fdc5)
This commit is contained in:
Jeroen De Meerleer 2019-06-20 15:32:26 +02:00
parent b60de6afb5
commit 1485859f27
16 changed files with 322 additions and 145 deletions

2
.gitignore vendored
View File

@ -8,7 +8,7 @@ composer.lock
/.idea
/doc/api/*
/libpairtwo-dist.zip
/libpairtwo-*-dist.zip
/dist/vendor/
/dist/composer.json

View File

@ -1,5 +1,15 @@
# CHANGELOG
## vx.y.z (Released: xx-yyy-zzzz)
* NEW FEATURE: Added clean-dist and clean-dev targets
* ENHANCEMENT: Better Docs generation
* ENHANCEMENT: Resied logo in Doxygen for better fit
* ENHANCEMENT: Doxygen takes branch name or version tag as `PROJECT_NUMBER`
* CHANGE: Version tag directly put in distribution filename
* CHANGE: `Tournament::GameExists()` renamed to `Tournament::gameExists()`
* CHANGE: Updated composer metadata
* CHANGE: Some setters changed to fluent setters. (More info: 7aca35057c10d2b982f93a698499c0c01df2fdc5)
## v1.1 (Released: 20-jun-2019)
* NEW FEATURE: Libpairtwo distribution releases (use these if you don't have knowledge of composer or dependency management)
* NEW FEATURE: Soccer Kashdan (aka: kashdan using 3-1-0 scoring)

View File

@ -38,7 +38,7 @@ PROJECT_NAME = libpairtwo
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = v1.1
PROJECT_NUMBER = $(VERSIONTAG)
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@ -51,7 +51,7 @@ PROJECT_BRIEF = "A library written in PHP that are saved using common p
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
PROJECT_LOGO = ./res/logo-lightback-96px.png
PROJECT_LOGO = ./res/logo-lightback-111px.png
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is

View File

@ -1,5 +1,7 @@
.PHONY: help tests dist
.DEFAULT_GOAL := help
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
VERSION := $(if $(TAG),$(TAG),$(BRANCH))
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-12s\033[0m %s\n", $$1, $$2}'
@ -14,11 +16,11 @@ view-coverage: ## Shows the code coverage report
open build/coverage/index.html
api: ## Generates api-docs
doxygen
VERSIONTAG=$(VERSION) doxygen
dist: ## Generates distribution
touch .libpairtwo-dist
git add -A
git add .libpairtwo-dist
git commit -m "Commit before release"
cp dist/composer* res/
mv dist/composer-dist.json dist/composer.json
@ -26,23 +28,27 @@ dist: ## Generates distribution
rm dist/composer.json
rm dist/composer.lock
mv dist/composer-dist-installed.json dist/composer.json
doxygen
make api
mkdir -p dist/doc
cp -r doc/api dist/doc
cd dist && zip -r ../libpairtwo-dist *
cd dist && zip -r ../libpairtwo-$(VERSION)-dist.zip *
git reset --hard HEAD^
mv res/composer* dist/
clean: ## Cleans the repository
rm -rf dist/doc
clean: clean-dist clean-dev
clean-dev:
rm -rf doc/api
rm -rf .idea
rm -rf .libpairtwo-distro
rm -rf vendor
rm -rf composer.lock
clean-dist:
rm -rf dist/doc
rm -rf dist/vendor
rm -rf dist/composer.json
rm -rf libpairtwo-dist.zip
rm -rf libpairtwo-*-dist.zip
cs: ## Fixes coding standard problems
vendor/bin/php-cs-fixer fix || true
@ -52,5 +58,6 @@ tag: ## Creates a new signed git tag
@echo Tagging $(TAG)
chag update $(TAG)
git add --all
git commit -m 'Release $(TAG)'
git tag -s $(TAG) -m 'Release $(TAG)'
git commit -m 'RELEASE: $(TAG) Release'
git tag -s $(TAG) -m 'RELEASE: $(TAG) Release'
make dist

View File

@ -1,8 +1,8 @@
{
"name": "jeroened/libpairtwo",
"type": "library",
"description": "PHP library that reads and writes SWS files from Pairtwo developed by the Belgian Chess Federation",
"keywords": ["chess", "frbe-kbsb", "pairtwo"],
"description": "A library written in PHP that are saved using common pairing applications",
"keywords": ["chess", "pairing"],
"license": "MIT",
"authors": [
{

BIN
res/logo-darkback-111px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -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
@ -129,76 +129,4 @@ class Game
$this->result = $result;
return $this;
}
/**
* @return DateTime
*/
public function getDate(): DateTime
{
return $this->date;
}
/**
* @param DateTime $date
* @return Round
*/
public function setDate(DateTime $date): Round
{
$this->date = $date;
return $this;
}
/**
* @return Game[]
*/
public function getGames(): array
{
return $this->games;
}
/**
* @param Game[] $games
* @return Round
*/
public function setGames(array $games): Round
{
$this->games = $games;
return $this;
}
/**
* @return int
*/
public function getRoundNo(): int
{
return $this->roundNo;
}
/**
* @param int $roundNo
* @return Round
*/
public function setRoundNo(int $roundNo): Round
{
$this->roundNo = $roundNo;
return $this;
}
/**
* @return Pairing[]
*/
public function getPairings(): array
{
return $this->pairings;
}
/**
* @param Pairing[] $pairings
* @return Round
*/
public function setPairings(array $pairings): Round
{
$this->pairings = $pairings;
return $this;
}
}

View File

@ -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
{

View File

@ -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
*/

View File

@ -66,12 +66,14 @@ class Player
* Adds a pairing to the tournament
*
* @param Pairing $pairing
* @return Player
*/
public function addPairing(Pairing $pairing)
public function addPairing(Pairing $pairing): Player
{
$newArray = $this->GetPairings();
$newArray[] = $pairing;
$this->setPairings($newArray);
return $this;
}
/**
@ -99,6 +101,7 @@ class Player
}
/**
* Returns the elo of elotype for the player
* @param string $type
* @return int
*/
@ -108,6 +111,8 @@ class Player
}
/**
* Sets the elo of elotype for the player
*
* @param string $type
* @param int $value
* @return Player
@ -121,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
*/
@ -130,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
@ -143,9 +156,11 @@ class Player
}
/**
* Returns the number of won matches for the player
*
* @return int
*/
public function getNoOfWins()
public function getNoOfWins(): int
{
$wins = 0;
foreach ($this->getPairings() as $pairing) {
@ -157,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
@ -174,9 +194,13 @@ 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
public function getPerformance(string $type, int $unratedElo): float
{
$total = 0;
$opponents = 0;
@ -199,6 +223,8 @@ class Player
/**
* Returns the number of played games of the player
*
* @return int
*/
public function getPlayedGames(): int
@ -213,6 +239,8 @@ class Player
}
/**
* Returns the name of the player
*
* @return string
*/
public function getName(): string
@ -221,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
{
@ -231,6 +261,8 @@ class Player
}
/**
* Returns an array of all ID's of the player
*
* @return string[]
*/
public function getIds(): ?array
@ -239,6 +271,8 @@ class Player
}
/**
* Sets an array of all ID's of the player
*
* @param string[] $Ids
* @return Player
*/
@ -249,6 +283,8 @@ class Player
}
/**
* Returns an array of all elos of the player
*
* @return int[]
*/
public function getElos(): ?array
@ -257,6 +293,8 @@ class Player
}
/**
* Sets an array of all elos of the player
*
* @param int[] $Elos
* @return Player
*/
@ -267,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
@ -293,6 +337,8 @@ class Player
}
/**
* Sets an array of all tiebreaks for the player
*
* @param float[] $Tiebreaks
* @return Player
*/
@ -303,6 +349,7 @@ class Player
}
/**
* Returns the nation of the player
* example value: BEL
*
* @return string
@ -313,6 +360,7 @@ class Player
}
/**
* Sets the nation of the player
* example value: BEL
*
* @param string $Nation
@ -325,6 +373,8 @@ class Player
}
/**
* Returns the category of the player
*
* @return string
*/
public function getCategory(): string
@ -333,6 +383,8 @@ class Player
}
/**
* Sets the category of the player
*
* @param string $Category
* @return Player
*/
@ -343,6 +395,8 @@ class Player
}
/**
* Returns the title of the player
*
* @return Title
*/
public function getTitle(): Title
@ -351,6 +405,8 @@ class Player
}
/**
* Sets the title of the player
*
* @param Title $Title
* @return Player
*/
@ -361,6 +417,8 @@ class Player
}
/**
* Returns the gender of the player
*
* @return Gender
*/
public function getGender(): Gender
@ -369,6 +427,8 @@ class Player
}
/**
* Sets the gender of the player
*
* @param Gender $Gender
* @return Player
*/
@ -379,6 +439,8 @@ class Player
}
/**
* Returns an array of all pairings of the player
*
* @return Pairing[]
*/
public function getPairings(): array
@ -387,6 +449,8 @@ class Player
}
/**
* Sets an array of all pairings of the player
*
* @param Pairing[] $Pairings
* @return Player
*/
@ -397,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
*/
@ -406,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

View File

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

View File

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

View File

@ -12,6 +12,7 @@
namespace JeroenED\Libpairtwo;
use Closure;
use DateTime;
use JeroenED\Libpairtwo\Enums\Tiebreak;
use JeroenED\Libpairtwo\Enums\Color;
@ -107,7 +108,7 @@ class Tournament
* @param integer $id
* @return Player
*/
public function getPlayerById(int $id)
public function getPlayerById(int $id): Player
{
return $this->GetPlayers()[$id];
}
@ -116,12 +117,14 @@ class Tournament
* Adds a player
*
* @param Player $Player
* @return Tournament
*/
public function addPlayer(Player $Player)
public function addPlayer(Player $Player): Tournament
{
$newArray = $this->GetPlayers();
$newArray[] = $Player;
$this->setPlayers($newArray);
return $this;
}
/**
@ -129,36 +132,42 @@ class Tournament
*
* @param int $id
* @param Player $player
* @return Tournament
*/
public function updatePlayer(int $id, Player $player)
public function updatePlayer(int $id, Player $player): Tournament
{
$newArray = $this->GetPlayers();
$newArray[$id] = $player;
$this->setPlayers($newArray);
return $this;
}
/**
* Adds a Tiebreak
*
* @param Tiebreak $tiebreak
* @return Tournament
*/
public function addTiebreak(Tiebreak $tiebreak)
public function addTiebreak(Tiebreak $tiebreak): Tournament
{
$newArray = $this->getTiebreaks();
$newArray[] = $tiebreak;
$this->setTiebreaks($newArray);
return $this;
}
/**
* Adds a round with given Round object
*
* @param Round $round
* @return Tournament
*/
public function addRound(Round $round)
public function addRound(Round $round): Tournament
{
$newArray = $this->getRounds();
$newArray[$round->getRoundNo()] = $round;
$this->setRounds($newArray);
return $this;
}
/**
@ -176,18 +185,22 @@ class Tournament
* Adds a pairing to the tournament
*
* @param Pairing $pairing
* @return Tournament
*/
public function addPairing(Pairing $pairing)
public function addPairing(Pairing $pairing): Tournament
{
$newArray = $this->GetPairings();
$newArray[] = $pairing;
$this->setPairings($newArray);
return $this;
}
/**
* Converts pairings into games with a black and white player
*
* @return Tournament
*/
public function pairingsToRounds(): void
public function pairingsToRounds(): Tournament
{
/** @var Pairing[] $pairings */
$pairings = $this->getPairings();
@ -225,11 +238,12 @@ class Tournament
$cache[] = $pairing;
} else {
// Check if game already exists
if (!$this->GameExists($game, $round)) {
if (!$this->gameExists($game, $round)) {
$this->AddGame($game, $round);
}
}
}
return $this;
}
/**
@ -239,7 +253,7 @@ class Tournament
* @param int $round
* @return bool
*/
public function GameExists(Game $game, int $round = -1): bool
public function gameExists(Game $game, int $round = -1): bool
{
$search = [ $round ];
if ($round == -1) {
@ -275,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();
@ -285,6 +300,7 @@ class Tournament
}
$this->getRoundByNo($round)->addGame($game);
return $this;
}
/**
@ -292,7 +308,7 @@ class Tournament
*
* @return Player[]
*/
public function getRanking()
public function getRanking(): array
{
$players = $this->getPlayers();
foreach ($this->getTiebreaks() as $tbkey=>$tiebreak) {
@ -337,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)) {
@ -352,7 +368,7 @@ class Tournament
/**
* @return float|null
* @return float | null
*/
private function calculateTiebreak(Tiebreak $tiebreak, Player $player, int $tbkey = 0): ?float
{
@ -452,7 +468,7 @@ class Tournament
/**
* @param Player $player
* @return float|null
* @return float | null
*/
private function calculateKeizer(Player $player): ?float
{
@ -462,7 +478,7 @@ class Tournament
/**
* @param Player $player
* @return float|null
* @return float | null
*/
private function calculateAmerican(Player $player): ?float
{
@ -472,7 +488,7 @@ class Tournament
/**
* @param Player $player
* @return float|null
* @return float | null
*/
private function calculatePoints(Player $player): ?float
{
@ -482,7 +498,7 @@ class Tournament
/**
* @param Player $player
* @return float|null
* @return float | null
*/
private function calculateBaumbach(Player $player): ?float
{
@ -498,7 +514,7 @@ class Tournament
/**
* @param Player $player
* @return float|null
* @return float | null
*/
private function calculateBlackPlayed(Player $player): ?float
{
@ -513,7 +529,7 @@ class Tournament
/**
* @param Player $player
* @return float|null
* @return float | null
*/
private function calculateBlackWin(Player $player): ?float
{
@ -528,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
{
@ -568,6 +586,8 @@ class Tournament
/**
* The average rating of the opponents
*
* @param Player $player
* @param int $cut
* @return float
@ -591,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
{
@ -614,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
{
@ -635,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
{
@ -672,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
{
@ -692,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
{
@ -717,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
{
@ -742,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
{
@ -763,6 +796,8 @@ class Tournament
}
/**
* Returns the name of the tournament
*
* @return string
*/
public function getName(): string
@ -771,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
{
@ -781,6 +818,8 @@ class Tournament
}
/**
* Returns the organiser of the tournament
*
* @return string
*/
public function getOrganiser(): string
@ -789,6 +828,8 @@ class Tournament
}
/**
* Sets the organiser of the tournament
*
* @param string $Organiser
* @return Tournament
*/
@ -799,6 +840,8 @@ class Tournament
}
/**
* Returns the clubidentifier of the tournament
*
* @return int
*/
public function getOrganiserClubNo(): int
@ -807,6 +850,8 @@ class Tournament
}
/**
* Sets the clubidentifier of the tournament
*
* @param int $OrganiserClubNo
* @return Tournament
*/
@ -817,6 +862,8 @@ class Tournament
}
/**
* Returns the club of the organiser
*
* @return string
*/
public function getOrganiserClub(): string
@ -825,6 +872,8 @@ class Tournament
}
/**
* Sets the club of the organiser
*
* @param string $OrganiserClub
* @return Tournament
*/
@ -835,6 +884,8 @@ class Tournament
}
/**
* Returns the location of the tournament
*
* @return string
*/
public function getOrganiserPlace(): string
@ -843,6 +894,8 @@ class Tournament
}
/**
* Sets the location of the tournament
*
* @param string $OrganiserPlace
* @return Tournament
*/
@ -853,6 +906,8 @@ class Tournament
}
/**
* Returns the country where the tournament is held
*
* @return string
*/
public function getOrganiserCountry(): string
@ -861,6 +916,8 @@ class Tournament
}
/**
* Sets the country where the tournament is held
*
* @param string $OrganiserCountry
* @return Tournament
*/
@ -871,6 +928,8 @@ class Tournament
}
/**
* Returns the fide homologation
*
* @return int
*/
public function getFideHomol(): int
@ -879,6 +938,8 @@ class Tournament
}
/**
* Sets the fide homologation
*
* @param int $FideHomol
* @return Tournament
*/
@ -889,6 +950,8 @@ class Tournament
}
/**
* Returns the start date of the tournament
*
* @return DateTime
*/
public function getStartDate(): DateTime
@ -897,6 +960,8 @@ class Tournament
}
/**
* Sets the start date of the tournament
*
* @param DateTime $StartDate
* @return Tournament
*/
@ -907,6 +972,8 @@ class Tournament
}
/**
* Returns the end date of the tournament
*
* @return DateTime
*/
public function getEndDate(): DateTime
@ -915,6 +982,8 @@ class Tournament
}
/**
* Sets the end date of the tournament
*
* @param DateTime $EndDate
* @return Tournament
*/
@ -925,6 +994,8 @@ class Tournament
}
/**
* Returns the arbiter of the tournament
*
* @return string
*/
public function getArbiter(): string
@ -933,6 +1004,8 @@ class Tournament
}
/**
* Sets the arbiter of the tournament
*
* @param string $Arbiter
* @return Tournament
*/
@ -943,6 +1016,8 @@ class Tournament
}
/**
* Returns the number of round
*
* @return int
*/
public function getNoOfRounds(): int
@ -951,6 +1026,8 @@ class Tournament
}
/**
* Sets the number of rounds
*
* @param int $NoOfRounds
* @return Tournament
*/
@ -961,6 +1038,8 @@ class Tournament
}
/**
* Returns an array containing all rounds of the tournament
*
* @return Round[]
*/
public function getRounds(): array
@ -969,6 +1048,8 @@ class Tournament
}
/**
* Sets an array containing all rounds of the tournament
*
* @param Round[] $Rounds
* @return Tournament
*/
@ -979,6 +1060,8 @@ class Tournament
}
/**
* Returns the tempo of the tournament
*
* @return string
*/
public function getTempo(): string
@ -987,6 +1070,8 @@ class Tournament
}
/**
* Sets the tempo of the tournament
*
* @param string $Tempo
* @return Tournament
*/
@ -997,6 +1082,8 @@ class Tournament
}
/**
* Returns the elo of a player if the player does not have one
*
* @return int
*/
public function getNonRatedElo(): int
@ -1005,6 +1092,8 @@ class Tournament
}
/**
* Sets the elo of a player if the player does not have one
*
* @param int $NonRatedElo
* @return Tournament
*/
@ -1015,6 +1104,8 @@ class Tournament
}
/**
* Returns the tournament system
*
* @return TournamentSystem
*/
public function getSystem(): TournamentSystem
@ -1023,6 +1114,8 @@ class Tournament
}
/**
* Sets the tournament system
*
* @param TournamentSystem $System
* @return Tournament
*/
@ -1033,6 +1126,8 @@ class Tournament
}
/**
* Returns the first period of the tempo
*
* @return string
*/
public function getFirstPeriod(): string
@ -1041,6 +1136,8 @@ class Tournament
}
/**
* Sets the first period of the tempo
*
* @param string $FirstPeriod
* @return Tournament
*/
@ -1051,6 +1148,8 @@ class Tournament
}
/**
* Returns the second period of the tempo
*
* @return string
*/
public function getSecondPeriod(): string
@ -1059,6 +1158,8 @@ class Tournament
}
/**
* Sets the second period of the tempo
*
* @param string $SecondPeriod
* @return Tournament
*/
@ -1069,6 +1170,8 @@ class Tournament
}
/**
* Returns the federation the tournament belongs to
*
* @return string
*/
public function getFederation(): string
@ -1077,6 +1180,8 @@ class Tournament
}
/**
* Sets the federation the tournament belongs to
*
* @param string $Federation
* @return Tournament
*/
@ -1087,6 +1192,8 @@ class Tournament
}
/**
* Returns an array of all players of the tournament
*
* @return Player[]
*/
public function getPlayers(): array
@ -1095,6 +1202,8 @@ class Tournament
}
/**
* Sets an array of all players of the tournament
*
* @param Player[] $Players
* @return Tournament
*/
@ -1105,6 +1214,8 @@ class Tournament
}
/**
* Returns the year the tournament is held in
*
* @return int
*/
public function getYear(): int
@ -1113,6 +1224,8 @@ class Tournament
}
/**
* Sets the year the tournament is held in
*
* @param int $Year
* @return Tournament
*/
@ -1123,6 +1236,8 @@ class Tournament
}
/**
* Returns an array of all pairings of the tournament
*
* @return Pairing[]
*/
public function getPairings(): array
@ -1131,6 +1246,8 @@ class Tournament
}
/**
* Sets an array of all pairings of the tournament
*
* @param Pairing[] $Pairings
* @return Tournament
*/
@ -1141,6 +1258,8 @@ class Tournament
}
/**
* Returns an array of all tiebreaks of the tournament
*
* @return Tiebreak[]
*/
public function getTiebreaks(): array
@ -1149,6 +1268,8 @@ class Tournament
}
/**
* Sets an array of all tiebreaks of the tournament
*
* @param Tiebreak[] $Tiebreaks
* @return Tournament
*/
@ -1159,6 +1280,8 @@ class Tournament
}
/**
* Returns the elo that has priority
*
* @return string
*/
public function getPriorityElo(): string
@ -1167,6 +1290,8 @@ class Tournament
}
/**
* Sets the elo that has priority
*
* @param string $PriorityElo
* @return Tournament
*/
@ -1176,6 +1301,8 @@ class Tournament
return $this;
}
/**
* Returns the identifier that has priority
*
* @return string
*/
public function getPriorityId(): string
@ -1184,6 +1311,8 @@ class Tournament
}
/**
* Sets the identifier that has priority
*
* @param string $PriorityId
* @return Tournament
*/