Tournament Generator

WithTeams

Functions for objects that contain teams

Tags
author

Tomáš Vojík vojik@wboy.cz

since
0.4

Table of Contents

addTeam()  : $this
Add one or more teams into the object.
addTeamContainer()  : WithTeams
Add a child container for games
filterTeams()  : array<string|int, mixed>
Filter teams using the specified filters
getTeamContainer()  : TeamContainer
Get the container for games
getTeams()  : array<string|int, Team>
Get all teams in the object
sortTeams()  : array<string|int, Team>
Sort the teams by their score/points
team()  : Team
Create a new team and add it into the object

Methods

addTeam()

Add one or more teams into the object.

public addTeam(Team ...$teams) : $this
Parameters
$teams : Team

Team objects

Return values
$this

filterTeams()

Filter teams using the specified filters

public filterTeams(array<string|int, mixed> &$teams, array<string|int, TeamFilter$filters) : array<string|int, mixed>
Parameters
$teams : array<string|int, mixed>

Teams to filter through

$filters : array<string|int, TeamFilter>

Filters to use

Tags
throws
Exception
Return values
array<string|int, mixed>

getTeams()

Get all teams in the object

public getTeams([bool $ordered = false ][, string|null $ordering = Constants::POINTS ][, array<string|int, TeamFilter$filters = [] ]) : array<string|int, Team>
Parameters
$ordered : bool = false

If true - order the teams by their score/points

$ordering : string|null = Constants::POINTS

What to order the teams by - Constants::POINTS, Constants::SCORE

$filters : array<string|int, TeamFilter> = []

Filters to filter the returned teams (ex. if you only want to get the first 3 teams)

Return values
array<string|int, Team>

sortTeams()

Sort the teams by their score/points

public sortTeams([string|null $ordering = Constants::POINTS ][, array<string|int, TeamFilter$filters = [] ]) : array<string|int, Team>
Parameters
$ordering : string|null = Constants::POINTS

What to order the teams by - Constants::POINTS, Constants::SCORE

$filters : array<string|int, TeamFilter> = []

Filters to filter the returned teams (ex. if you only want to get the first 3 teams)

Return values
array<string|int, Team>

team()

Create a new team and add it into the object

public team([string $name = '' ][, string|int|null $id = null ]) : Team
Parameters
$name : string = ''

Name of the new team

$id : string|int|null = null

Id of the new team - if omitted -> it is generated automatically as unique string

Return values
Team

Newly created team

Search results