libpairtwo/src/Models/Tournament.php

524 lines
10 KiB
PHP
Raw Normal View History

2019-01-10 20:05:23 +01:00
<?php
/*
* The MIT License
*
* Copyright 2019 Jeroen De Meerleer <schaak@jeroened.be>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
namespace JeroenED\Libpairtwo\Models;
2019-02-11 17:37:30 +01:00
use JeroenED\Libpairtwo\Enums\Tiebreak;
2019-02-01 15:55:34 +01:00
use JeroenED\Libpairtwo\Enums\TournamentSystem;
2019-03-20 17:33:09 +01:00
use JeroenED\Libpairtwo\Player;
2019-02-11 17:27:26 +01:00
use DateTime;
2019-02-01 15:55:34 +01:00
2019-01-10 20:05:23 +01:00
/**
* Description of Sws
*
* @author Jeroen De Meerleer <schaak@jeroened.be>
*/
2019-05-27 13:06:35 +02:00
abstract class Tournament
2019-01-16 18:03:07 +01:00
{
2019-03-20 17:33:09 +01:00
/** @var string */
2019-01-16 18:03:07 +01:00
private $Name;
2019-03-20 17:33:09 +01:00
/** @var string */
2019-01-16 18:03:07 +01:00
private $Organiser;
2019-03-20 17:33:09 +01:00
/** @var int */
2019-01-19 14:14:01 +01:00
private $OrganiserClubNo;
2019-03-20 17:33:09 +01:00
/** @var string */
2019-01-16 18:03:07 +01:00
private $OrganiserClub;
2019-03-20 17:33:09 +01:00
/** @var string */
2019-01-16 18:03:07 +01:00
private $OrganiserPlace;
2019-03-20 17:33:09 +01:00
/** @var string */
2019-01-16 18:03:07 +01:00
private $OrganiserCountry;
2019-03-20 17:33:09 +01:00
/** @var int */
2019-01-18 18:10:56 +01:00
private $FideHomol;
2019-03-20 17:33:09 +01:00
/** @var DateTime */
2019-01-16 18:03:07 +01:00
private $StartDate;
2019-03-20 17:33:09 +01:00
/** @var DateTime */
2019-01-16 18:03:07 +01:00
private $EndDate;
2019-03-20 17:33:09 +01:00
/** @var string */
2019-01-16 18:03:07 +01:00
private $Arbiter;
2019-03-20 17:33:09 +01:00
/** @var int */
private $NoOfRounds;
/** @var Round[] */
2019-05-28 14:10:42 +02:00
private $Rounds = [];
2019-03-20 17:33:09 +01:00
/** @var int */
2019-01-16 18:03:07 +01:00
private $Participants;
2019-03-20 17:33:09 +01:00
/** @var string */
2019-01-16 18:03:07 +01:00
private $Tempo;
2019-03-20 17:33:09 +01:00
/** @var int */
2019-01-16 18:03:07 +01:00
private $NonRatedElo;
2019-03-20 17:33:09 +01:00
/** @var TournamentSystem */
2019-01-16 18:03:07 +01:00
private $System;
2019-03-20 17:33:09 +01:00
/** @var string */
2019-01-19 14:14:01 +01:00
private $FirstPeriod;
2019-03-20 17:33:09 +01:00
/** @var string */
2019-01-19 14:14:01 +01:00
private $SecondPeriod;
2019-03-20 17:33:09 +01:00
/** @var string */
2019-01-19 14:14:01 +01:00
private $Federation;
2019-03-20 17:33:09 +01:00
/** @var Player[] */
2019-05-28 14:10:42 +02:00
private $Players = [];
2019-03-20 17:33:09 +01:00
/** @var int */
2019-02-11 16:42:20 +01:00
private $Year;
2019-03-20 17:33:09 +01:00
/** @var Pairing[] */
2019-05-28 14:10:42 +02:00
private $Pairings = [];
2019-01-16 18:03:07 +01:00
/** @var Tiebreak[] */
private $Tiebreaks = [];
2019-01-16 18:03:07 +01:00
/**
2019-01-18 18:10:56 +01:00
* @return string
2019-01-16 18:03:07 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getName(): string
2019-01-16 18:03:07 +01:00
{
return $this->Name;
}
/**
2019-01-18 18:10:56 +01:00
* @param string $Name
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setName(string $Name): Tournament
2019-01-16 18:03:07 +01:00
{
$this->Name = $Name;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-16 18:03:07 +01:00
}
/**
2019-01-18 18:10:56 +01:00
* @return string
2019-01-16 18:03:07 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getOrganiser(): string
2019-01-16 18:03:07 +01:00
{
return $this->Organiser;
}
/**
2019-01-18 18:10:56 +01:00
* @param string $Organiser
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setOrganiser(string $Organiser): Tournament
2019-01-16 18:03:07 +01:00
{
$this->Organiser = $Organiser;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-16 18:03:07 +01:00
}
/**
2019-05-28 14:10:42 +02:00
* @return int
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function getOrganiserClubNo(): int
2019-01-16 18:03:07 +01:00
{
2019-05-28 14:10:42 +02:00
return $this->OrganiserClubNo;
2019-01-16 18:03:07 +01:00
}
/**
2019-05-28 14:10:42 +02:00
* @param int $OrganiserClubNo
* @return Tournament
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setOrganiserClubNo(int $OrganiserClubNo): Tournament
2019-01-16 18:03:07 +01:00
{
2019-05-28 14:10:42 +02:00
$this->OrganiserClubNo = $OrganiserClubNo;
return $this;
2019-01-16 18:03:07 +01:00
}
2019-01-19 14:14:01 +01:00
/**
2019-05-28 14:10:42 +02:00
* @return string
2019-01-19 14:14:01 +01:00
*/
2019-05-28 14:10:42 +02:00
public function getOrganiserClub(): string
2019-01-19 14:14:01 +01:00
{
2019-05-28 14:10:42 +02:00
return $this->OrganiserClub;
2019-01-19 14:14:01 +01:00
}
/**
2019-05-28 14:10:42 +02:00
* @param string $OrganiserClub
* @return Tournament
2019-01-19 14:14:01 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setOrganiserClub(string $OrganiserClub): Tournament
2019-01-19 14:14:01 +01:00
{
2019-05-28 14:10:42 +02:00
$this->OrganiserClub = $OrganiserClub;
return $this;
2019-01-19 14:14:01 +01:00
}
2019-01-16 18:03:07 +01:00
/**
2019-01-18 18:10:56 +01:00
* @return string
2019-01-16 18:03:07 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getOrganiserPlace(): string
2019-01-16 18:03:07 +01:00
{
return $this->OrganiserPlace;
}
/**
2019-01-18 18:10:56 +01:00
* @param string $OrganiserPlace
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setOrganiserPlace(string $OrganiserPlace): Tournament
2019-01-16 18:03:07 +01:00
{
$this->OrganiserPlace = $OrganiserPlace;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-16 18:03:07 +01:00
}
/**
2019-01-18 18:10:56 +01:00
* @return string
2019-01-16 18:03:07 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getOrganiserCountry(): string
2019-01-16 18:03:07 +01:00
{
return $this->OrganiserCountry;
}
/**
2019-01-18 18:10:56 +01:00
* @param string $OrganiserCountry
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setOrganiserCountry(string $OrganiserCountry): Tournament
2019-01-16 18:03:07 +01:00
{
$this->OrganiserCountry = $OrganiserCountry;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-16 18:03:07 +01:00
}
/**
2019-02-11 17:27:26 +01:00
* @return int
2019-01-18 18:10:56 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getFideHomol(): int
2019-01-18 18:10:56 +01:00
{
return $this->FideHomol;
}
/**
2019-02-11 17:27:26 +01:00
* @param int $FideHomol
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-18 18:10:56 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setFideHomol(int $FideHomol): Tournament
2019-01-18 18:10:56 +01:00
{
$this->FideHomol = $FideHomol;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-18 18:10:56 +01:00
}
/**
2019-02-11 17:27:26 +01:00
* @return DateTime
2019-01-16 18:03:07 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getStartDate(): DateTime
2019-01-16 18:03:07 +01:00
{
return $this->StartDate;
}
/**
2019-02-11 17:27:26 +01:00
* @param DateTime $StartDate
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setStartDate(DateTime $StartDate): Tournament
2019-01-16 18:03:07 +01:00
{
$this->StartDate = $StartDate;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-16 18:03:07 +01:00
}
/**
2019-02-11 17:27:26 +01:00
* @return DateTime
2019-01-16 18:03:07 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getEndDate(): DateTime
2019-01-16 18:03:07 +01:00
{
return $this->EndDate;
2019-01-10 20:05:23 +01:00
}
2019-01-16 18:03:07 +01:00
/**
2019-02-11 17:27:26 +01:00
* @param DateTime $EndDate
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setEndDate(DateTime $EndDate): Tournament
2019-01-16 18:03:07 +01:00
{
$this->EndDate = $EndDate;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-10 20:05:23 +01:00
}
2019-01-16 18:03:07 +01:00
/**
2019-01-18 18:10:56 +01:00
* @return string
2019-01-16 18:03:07 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getArbiter(): string
2019-01-16 18:03:07 +01:00
{
return $this->Arbiter;
2019-01-10 20:05:23 +01:00
}
2019-01-16 18:03:07 +01:00
/**
2019-01-18 18:10:56 +01:00
* @param string $Arbiter
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setArbiter(string $Arbiter): Tournament
2019-01-16 18:03:07 +01:00
{
$this->Arbiter = $Arbiter;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-10 20:05:23 +01:00
}
2019-01-16 18:03:07 +01:00
/**
2019-02-11 17:27:26 +01:00
* @return int
2019-01-16 18:03:07 +01:00
*/
public function getNoOfRounds(): int
{
return $this->NoOfRounds;
}
/**
* @param int $NoOfRounds
2019-05-28 14:10:42 +02:00
* @return Tournament
*/
2019-05-28 14:10:42 +02:00
public function setNoOfRounds(int $NoOfRounds): Tournament
{
$this->NoOfRounds = $NoOfRounds;
2019-05-28 14:10:42 +02:00
return $this;
}
/**
* @return Round[]
*/
2019-05-28 14:10:42 +02:00
public function getRounds(): array
2019-01-16 18:03:07 +01:00
{
return $this->Rounds;
2019-01-10 20:05:23 +01:00
}
2019-01-16 18:03:07 +01:00
/**
* @param Round[] $Rounds
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setRounds(array $Rounds): Tournament
2019-01-16 18:03:07 +01:00
{
$this->Rounds = $Rounds;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-10 20:05:23 +01:00
}
2019-01-16 18:03:07 +01:00
/**
2019-02-11 17:27:26 +01:00
* @return int
2019-01-16 18:03:07 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getParticipants(): int
2019-01-16 18:03:07 +01:00
{
return $this->Participants;
2019-01-10 20:05:23 +01:00
}
2019-01-16 18:03:07 +01:00
/**
2019-02-11 17:27:26 +01:00
* @param int $Participants
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setParticipants(int $Participants): Tournament
2019-01-16 18:03:07 +01:00
{
$this->Participants = $Participants;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-10 20:05:23 +01:00
}
2019-01-16 18:03:07 +01:00
/**
2019-01-18 18:10:56 +01:00
* @return string
2019-01-16 18:03:07 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getTempo(): string
2019-01-16 18:03:07 +01:00
{
return $this->Tempo;
2019-01-10 20:05:23 +01:00
}
2019-01-16 18:03:07 +01:00
/**
2019-01-18 18:10:56 +01:00
* @param string $Tempo
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setTempo(string $Tempo): Tournament
2019-01-16 18:03:07 +01:00
{
$this->Tempo = $Tempo;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-10 20:05:23 +01:00
}
2019-01-16 18:03:07 +01:00
/**
2019-02-11 17:27:26 +01:00
* @return int
2019-01-16 18:03:07 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getNonRatedElo(): int
2019-01-16 18:03:07 +01:00
{
return $this->NonRatedElo;
2019-01-10 20:05:23 +01:00
}
2019-01-16 18:03:07 +01:00
/**
2019-02-11 17:27:26 +01:00
* @param int $NonRatedElo
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setNonRatedElo(int $NonRatedElo): Tournament
2019-01-16 18:03:07 +01:00
{
$this->NonRatedElo = $NonRatedElo;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-10 20:05:23 +01:00
}
2019-01-16 18:03:07 +01:00
/**
2019-01-19 14:14:01 +01:00
* @return TournamentSystem
2019-01-16 18:03:07 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getSystem(): TournamentSystem
2019-01-16 18:03:07 +01:00
{
return $this->System;
2019-01-10 20:05:23 +01:00
}
2019-01-16 18:03:07 +01:00
/**
2019-01-19 14:14:01 +01:00
* @param TournamentSystem $System
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-16 18:03:07 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setSystem(TournamentSystem $System): Tournament
2019-01-16 18:03:07 +01:00
{
$this->System = $System;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-10 20:05:23 +01:00
}
2019-01-19 14:14:01 +01:00
/**
2019-02-11 17:27:26 +01:00
* @return string
2019-01-19 14:14:01 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getFirstPeriod(): string
2019-01-19 14:14:01 +01:00
{
return $this->FirstPeriod;
}
/**
2019-02-11 17:27:26 +01:00
* @param string $FirstPeriod
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-19 14:14:01 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setFirstPeriod(string $FirstPeriod): Tournament
2019-01-19 14:14:01 +01:00
{
$this->FirstPeriod = $FirstPeriod;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-19 14:14:01 +01:00
}
/**
2019-02-11 17:27:26 +01:00
* @return string
2019-01-19 14:14:01 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getSecondPeriod(): string
2019-01-19 14:14:01 +01:00
{
return $this->SecondPeriod;
}
/**
2019-02-11 17:27:26 +01:00
* @param string $SecondPeriod
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-19 14:14:01 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setSecondPeriod(string $SecondPeriod): Tournament
2019-01-19 14:14:01 +01:00
{
$this->SecondPeriod = $SecondPeriod;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-19 14:14:01 +01:00
}
/**
2019-02-11 17:27:26 +01:00
* @return string
2019-01-19 14:14:01 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getFederation(): string
2019-01-19 14:14:01 +01:00
{
return $this->Federation;
}
/**
2019-02-11 17:27:26 +01:00
* @param string $Federation
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-01-19 14:14:01 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setFederation(string $Federation): Tournament
2019-01-19 14:14:01 +01:00
{
$this->Federation = $Federation;
2019-05-28 14:10:42 +02:00
return $this;
2019-01-19 14:14:01 +01:00
}
2019-02-01 15:55:34 +01:00
/**
2019-02-11 17:27:26 +01:00
* @return Player[]
2019-02-01 15:55:34 +01:00
*/
2019-05-28 14:10:42 +02:00
public function getPlayers(): array
2019-02-01 15:55:34 +01:00
{
return $this->Players;
}
/**
2019-02-11 17:27:26 +01:00
* @param Player[] $Players
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-02-01 15:55:34 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setPlayers(array $Players): Tournament
2019-02-01 15:55:34 +01:00
{
$this->Players = $Players;
2019-05-28 14:10:42 +02:00
return $this;
2019-02-01 15:55:34 +01:00
}
2019-01-10 20:05:23 +01:00
2019-02-11 16:42:20 +01:00
/**
2019-02-11 17:27:26 +01:00
* @return int
2019-02-11 16:42:20 +01:00
*/
2019-02-11 17:27:26 +01:00
public function getYear(): int
2019-02-11 16:42:20 +01:00
{
return $this->Year;
}
/**
2019-02-11 17:27:26 +01:00
* @param int $Year
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-02-11 16:42:20 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setYear(int $Year): Tournament
2019-02-11 16:42:20 +01:00
{
$this->Year = $Year;
2019-05-28 14:10:42 +02:00
return $this;
2019-02-11 16:42:20 +01:00
}
2019-02-11 16:43:36 +01:00
/**
* @return Pairing[]
*/
2019-05-28 14:10:42 +02:00
public function getPairings(): array
2019-02-11 16:43:36 +01:00
{
return $this->Pairings;
}
/**
* @param Pairing[] $Pairings
2019-05-28 14:10:42 +02:00
* @return Tournament
2019-02-11 16:43:36 +01:00
*/
2019-05-28 14:10:42 +02:00
public function setPairings(array $Pairings): Tournament
2019-02-11 16:43:36 +01:00
{
$this->Pairings = $Pairings;
2019-05-28 14:10:42 +02:00
return $this;
2019-02-11 16:43:36 +01:00
}
/**
* @return Tiebreak[]
*/
public function getTiebreaks(): array
{
return $this->Tiebreaks;
}
/**
* @param Tiebreak[] $Tiebreaks
2019-05-28 14:10:42 +02:00
* @return Tournament
*/
2019-05-28 14:10:42 +02:00
public function setTiebreaks(array $Tiebreaks): Tournament
{
$this->Tiebreaks = $Tiebreaks;
2019-05-28 14:10:42 +02:00
return $this;
}
2019-01-10 20:05:23 +01:00
}