GameSorter
in package
implements
BaseSorter
Tournament generator sorter for games
WORKS BY COMPARING AVAILABLE GAMES BY THEIR TEAMS TEAMS FROM LAST 3 GAMES 1 = PLAYED ONLY 3RD GAME FROM END 2 = PLAYED ONLY 2ND GAME FROM END 3 = PLAYED 3RD AND 2ND GAME FROM END 4 = PLAYED ONLY THE LAST GAME 5 = PLAYED 3RD AND 1ST GAME FROM END 6 = PLAYED 2ND ANS 1ST GAME FROM END 7 = PLAYED ALL 3 LAST GAMES
Tags
Interfaces, Classes and Traits
- BaseSorter
- Class BaseSorter
Table of Contents
- $games : array<string|int, mixed>
- $group : Group
- __construct() : mixed
- Orders games from group
- sort() : array<string|int, mixed>
- Orders games from group
- cycle1() : bool
- Teams that did not play in the last game (< 4)
- cycle2() : bool
- Teams that did not play in the last two games (not 6 or 7)
- cycle3() : bool
- Teams that did not play in the last three games (not 7) and teams that did not play in the last game (< 4)
- cycle4() : bool
- Teams that did not play in the last three games (not 7)
- cycle5() : bool
- Teams that did not play in the last game will play this game (< 4)
- moveCalculatedGames() : void
- Move teams that did not play in the last game (< 4)
- orderCheckTeamsVal() : bool
- Get first available game
- resetGameIds() : void
- Resets the game ids
Properties
$games
protected
array<string|int, mixed>
$games
= []
$group
protected
Group
$group
Methods
__construct()
Orders games from group
public
__construct(Group $group) : mixed
Parameters
- $group : Group
Return values
mixed —sort()
Orders games from group
public
sort(array<string|int, Game> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, Game>
Tags
Return values
array<string|int, mixed> —cycle1()
Teams that did not play in the last game (< 4)
protected
cycle1(array<string|int, mixed> &$games, array<string|int, mixed> &$teams) : bool
Parameters
- $games : array<string|int, mixed>
- $teams : array<string|int, mixed>
Return values
bool —cycle2()
Teams that did not play in the last two games (not 6 or 7)
protected
cycle2(array<string|int, mixed> &$games, array<string|int, mixed> &$teams) : bool
Parameters
- $games : array<string|int, mixed>
- $teams : array<string|int, mixed>
Return values
bool —cycle3()
Teams that did not play in the last three games (not 7) and teams that did not play in the last game (< 4)
protected
cycle3(array<string|int, mixed> &$games, array<string|int, mixed> &$teams) : bool
Parameters
- $games : array<string|int, mixed>
- $teams : array<string|int, mixed>
Return values
bool —cycle4()
Teams that did not play in the last three games (not 7)
protected
cycle4(array<string|int, mixed> &$games, array<string|int, mixed> &$teams) : bool
Parameters
- $games : array<string|int, mixed>
- $teams : array<string|int, mixed>
Return values
bool —cycle5()
Teams that did not play in the last game will play this game (< 4)
protected
cycle5(array<string|int, mixed> &$games, array<string|int, mixed> &$teams) : bool
Parameters
- $games : array<string|int, mixed>
- $teams : array<string|int, mixed>
Return values
bool —moveCalculatedGames()
Move teams that did not play in the last game (< 4)
protected
moveCalculatedGames(Game $game, array<string|int, mixed> &$teams) : void
Parameters
- $game : Game
- $teams : array<string|int, mixed>
Return values
void —orderCheckTeamsVal()
Get first available game
protected
orderCheckTeamsVal(Game $game, array<string|int, mixed> $teams, array<string|int, mixed> $checkVals[, array<string|int, mixed> $required = [] ]) : bool
Parameters
- $game : Game
- $teams : array<string|int, mixed>
- $checkVals : array<string|int, mixed>
- $required : array<string|int, mixed> = []
Return values
bool —resetGameIds()
Resets the game ids
protected
resetGameIds() : void