Tournament Generator

WithTeams

Trait WithTeams

Tags
author

Tomáš Vojík vojik@wboy.cz

since
0.4

Table of Contents

$teams  : TeamContainer
addTeam()  : WithTeams
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
splitTeams()  : $this
Split teams into its Groups
team()  : Team
Create a new team and add it into the object

Properties

Methods

filterTeams()

Filter teams using the specified filters

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

Teams to filter through

$filters : array<string|int, TeamFilter>|array<string|int, 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>|array<string|int, 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>|array<string|int, array<string|int, TeamFilter>> = []

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

Tags
throws
Exception
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>|array<string|int, 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>|array<string|int, array<string|int, TeamFilter>> = []

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

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

splitTeams()

Split teams into its Groups

public splitTeams(Round ...$wheres) : $this
Parameters
$wheres : Round
Tags
throws
Exception
noinspection

CallableParameterUseCaseInTypeContextInspection

Return values
$this

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