Tournament Generator

BlankTeam extends Team
in package

Blank / dummy team used for simulating the games

It's not a "real" team, but it holds a reference to the original team that it was created from. The dummy teams are created in progressions where we do not really care for the real results, but only for the games that will be generated. It keeps the original team's id, but everything else can be different.

Tags
author

Tomáš Vojík vojik@wboy.cz

since
0.1

Table of Contents

$groupResults  : array<string|int, mixed>
$from  : Group
$games  : array<string|int, mixed>
$gamesWith  : array<string|int, mixed>
$id  : string|int
$name  : string
$progression  : Progression
$sumPoints  : int
$sumScore  : int
__construct()  : mixed
BlankTeam constructor.
__toString()  : string
addDraw()  : $this
Adds a draw to the team
addGame()  : $this
Adds a game to this team
addGameWith()  : $this
Adds a record of a game with another team in a group
addGroup()  : $this
Adds a group to a team and creates an array for all games to be played
addGroupResults()  : $this
Creates a new data-array to store statistics for a new group
addLoss()  : $this
Adds a loss to the team
addPoints()  : $this
Adds points to the total sum
addScore()  : $this
Adds score to the total sum
addSecond()  : $this
Add points for being second to the team
addThird()  : $this
Add points for being third to the team
addWin()  : $this
Adds a win to the team
export()  : ExporterInterface
Prepares an export query for the object
getGames()  : array<string|int, mixed>
Gets all game from given group
getGamesInfo()  : array<string|int, mixed>
Gets team statistics from the given group without the group object
getGameWith()  : array<string|int, mixed>|int
Gets a record of a game with another team or teams
getGroupResults()  : array<string|int, mixed>
Gets team statistics from the given group
getId()  : string|int
Gets the unique identifier of the object
getName()  : string
Gets the name of the object
getSumPoints()  : int
Gets all points that the team has acquired through the tournament
getSumScore()  : int
Gets all score that the team has acquired through the tournament
removeDraw()  : $this
Remove a draw from the team
removeLoss()  : $this
Remove a loss from the team
removePoints()  : $this
Removes points to the total sum
removeScore()  : $this
Removes score to the total sum
removeSecond()  : $this
Remove points for being second from the team
removeThird()  : $this
Remove points for being third from the team
removeWin()  : $this
Remove a win from the team
setId()  : self
Sets the unique identifier of the object
setName()  : self
Sets the name of the object
sumPoints()  : int
Calculate all the points acquired from given group ids
sumScore()  : int
Calculate all score acquired from given group ids

Properties

$groupResults

public array<string|int, mixed> $groupResults = []
Tags
details

[

  • groupId => [
    • "group" => Group, # GROUP OBJECT
    • "points" => int 0, # NUMBER OF POINTS ACQUIRED
    • "score" => int 0, # SUM OF SCORE ACQUIRED
    • "wins" => int 0, # NUMBER OF WINS
    • "draws" => int 0, # NUMBER OF DRAWS
    • "losses" => int 0, # NUMBER OF LOSSES
    • "second" => int 0, # NUMBER OF TIMES BEING SECOND (ONLY FOR INGAME OPTION OF 3 OR 4)
    • "third" => int 0 # NUMBER OF TIMES BEING THIRD (ONLY FOR INGAME OPTION OF 4)
  • ] ]

$games

protected array<string|int, mixed> $games = []

$gamesWith

protected array<string|int, mixed> $gamesWith = []

$id

protected string|int $id

$name

protected string $name = ''

Methods

__construct()

BlankTeam constructor.

public __construct(string $name, Team $original, Group $from, Progression $progression) : mixed
Parameters
$name : string

New team name

$original : Team

Original team that this team is derived from

$from : Group

A group that the original team was playing in

$progression : Progression

A progression object that created this team

Return values
mixed

__toString()

public __toString() : string
Return values
string

Name of the object

addDraw()

Adds a draw to the team

public addDraw([string|int|null $groupId = '' ]) : $this
Parameters
$groupId : string|int|null = ''

An id of group to add the results from

Tags
throws
Exception

if the group results have not been added

uses
Group::getDrawPoints()

to retrieve the points to add

Return values
$this

addGame()

Adds a game to this team

public addGame(Game $game) : $this
Parameters
$game : Game

A game to add

Return values
$this

addGameWith()

Adds a record of a game with another team in a group

public addGameWith(Team $team, Group $group) : $this
Parameters
$team : Team

A team that played with this team

$group : Group

A group that the teams were playing in

Return values
$this

addGroup()

Adds a group to a team and creates an array for all games to be played

public addGroup(Group $group) : $this
Parameters
$group : Group

A group to add

Return values
$this

addGroupResults()

Creates a new data-array to store statistics for a new group

public addGroupResults(Group $group) : $this

Resets the statistics if the group was already added

Parameters
$group : Group

A group object to add its results

Return values
$this

addLoss()

Adds a loss to the team

public addLoss([string|int|null $groupId = '' ]) : $this
Parameters
$groupId : string|int|null = ''

An id of group to add the results from

Tags
throws
Exception

if the group results have not been added

uses
Group::getLossPoints()

to retrieve the points to add

Return values
$this

addPoints()

Adds points to the total sum

public addPoints(int $points) : $this
Parameters
$points : int

Points to add

Return values
$this

addScore()

Adds score to the total sum

public addScore(int $score) : $this
Parameters
$score : int

Score to add

Return values
$this

addSecond()

Add points for being second to the team

public addSecond([string|int|null $groupId = '' ]) : $this
Parameters
$groupId : string|int|null = ''

An id of group to add the results from

Tags
throws
Exception

if the group results have not been added

uses
Group::getSecondPoints()

to retrieve the points to add

Return values
$this

addThird()

Add points for being third to the team

public addThird([string|int|null $groupId = '' ]) : $this
Parameters
$groupId : string|int|null = ''

An id of group to add the results from

Tags
throws
Exception

if the group results have not been added

uses
Group::getThirdPoints()

to retrieve the points to add

Return values
$this

addWin()

Adds a win to the team

public addWin([string|int|null $groupId = '' ]) : $this
Parameters
$groupId : string|int|null = ''

An id of group to add the results from

Tags
throws
Exception

if the group results have not been added

uses
Group::getWinPoints()

to retrieve the points to add

Return values
$this

getGames()

Gets all game from given group

public getGames([Group|null $group = null ][, string|int|null $groupId = null ]) : array<string|int, mixed>
Parameters
$group : Group|null = null

A group to get its game from

$groupId : string|int|null = null

An id of group to get its game from

Return values
array<string|int, mixed>

Games from a group or all games if both arguments are null

getGamesInfo()

Gets team statistics from the given group without the group object

public getGamesInfo(string|int $groupId) : array<string|int, mixed>
Parameters
$groupId : string|int

Unique identifier of the group to get its results

Tags
throws
Exception

if the group with given groupId doesn't exist

Return values
array<string|int, mixed>

All the statistics including points, score, wins, draws, losses, times being second, times being third

getGameWith()

Gets a record of a game with another team or teams

public getGameWith([Team|null $team = null ][, Group|null $group = null ]) : array<string|int, mixed>|int
Parameters
$team : Team|null = null

A team to get the games with

$group : Group|null = null

A group from where to get the games

Return values
array<string|int, mixed>|int

The number of games played with a team in a group if both arguments are given, array of all games with all teams from a group if only group is given, array of games with team from all groups if only a team argument is given or all games with all teams from all groups if no argument is given

getGroupResults()

Gets team statistics from the given group

public getGroupResults([string|int|null $groupId = null ]) : array<string|int, mixed>
Parameters
$groupId : string|int|null = null

Unique identifier of the group to get its results

Tags
throws
Exception

if the group with given groupId doesn't exist

Return values
array<string|int, mixed>

All the statistics including points, score, wins, draws, losses, times being second, times being third if the group id is set or all the statistics

getId()

Gets the unique identifier of the object

public getId() : string|int
Return values
string|int

Unique identifier of the object

getName()

Gets the name of the object

public getName() : string
Return values
string

Name of the object

getSumPoints()

Gets all points that the team has acquired through the tournament

public getSumPoints() : int
Return values
int

Sum of the points acquired

getSumScore()

Gets all score that the team has acquired through the tournament

public getSumScore() : int
Return values
int

Sum of the score acquired

removeDraw()

Remove a draw from the team

public removeDraw([string|int|null $groupId = '' ]) : $this
Parameters
$groupId : string|int|null = ''

An id of group to add the results from

Tags
throws
Exception

if the group results have not been added

uses
Group::getDrawPoints()

to retrieve the points to add

Return values
$this

removeLoss()

Remove a loss from the team

public removeLoss([string|int|null $groupId = '' ]) : $this
Parameters
$groupId : string|int|null = ''

An id of group to add the results from

Tags
throws
Exception

if the group results have not been added

uses
Group::getLossPoints()

to retrieve the points to add

Return values
$this

removePoints()

Removes points to the total sum

public removePoints(int $points) : $this
Parameters
$points : int

Points to remove

Return values
$this

removeScore()

Removes score to the total sum

public removeScore(int $score) : $this
Parameters
$score : int

Score to add

Return values
$this

removeSecond()

Remove points for being second from the team

public removeSecond([string|int|null $groupId = '' ]) : $this
Parameters
$groupId : string|int|null = ''

An id of group to add the results from

Tags
throws
Exception

if the group results have not been added

uses
Group::getSecondPoints()

to retrieve the points to add

Return values
$this

removeThird()

Remove points for being third from the team

public removeThird([string|int|null $groupId = '' ]) : $this
Parameters
$groupId : string|int|null = ''

An id of group to add the results from

Tags
throws
Exception

if the group results have not been added

uses
Group::getThirdPoints()

to retrieve the points to add

Return values
$this

removeWin()

Remove a win from the team

public removeWin([string|int|null $groupId = '' ]) : $this
Parameters
$groupId : string|int|null = ''

An id of group to add the results from

Tags
throws
Exception

if the group results have not been added

uses
Group::getWinPoints()

to retrieve the points to add

Return values
$this

setId()

Sets the unique identifier of the object

public setId(string|int $id) : self
Parameters
$id : string|int

Unique identifier of the object

Tags
throws
InvalidArgumentException

if the provided argument is not of type 'string' or 'int'

Return values
self

setName()

Sets the name of the object

public setName(string $name) : self
Parameters
$name : string

Name of the object

Return values
self

sumPoints()

Calculate all the points acquired from given group ids

public sumPoints([array<string|int, mixed> $groupIds = [] ]) : int
Parameters
$groupIds : array<string|int, mixed> = []

Array of group ids

Return values
int

Sum of the points or sum of all points if argument is empty

sumScore()

Calculate all score acquired from given group ids

public sumScore([array<string|int, mixed> $groupIds = [] ]) : int
Parameters
$groupIds : array<string|int, mixed> = []

Array of group ids

Return values
int

Sum of score or sum of all score if argument is empty

Search results