WithTeams
Trait WithTeams
Tags
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
$teams
protected
TeamContainer
$teams
Methods
addTeam()
Add one or more teams into the object.
public
addTeam(Team ...$teams) : WithTeams
Parameters
- $teams : Team
-
Team objects
Return values
WithTeams —addTeamContainer()
Add a child container for games
public
addTeamContainer(TeamContainer $container) : WithTeams
Parameters
- $container : TeamContainer
Return values
WithTeams —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
Return values
array<string|int, mixed> —getTeamContainer()
Get the container for games
public
getTeamContainer() : TeamContainer
Return values
TeamContainer —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
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
Return values
array<string|int, Team> —splitTeams()
Split teams into its Groups
public
splitTeams(Round ...$wheres) : $this
Parameters
- $wheres : Round
Tags
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