Tournament Generator

TeamFilter
in package

TeamFilter is a wrapper class for rules that filter teams

Filtering teams can be useful in progressions, or in getting teams that need to pass some condition.

Tags
since
0.1
author

Tomáš Vojík vojik@wboy.cz

Table of Contents

$groups  : array<string|int, mixed>
$how  : string
$val  : int|Team
$what  : string
__construct()  : mixed
TeamFilter constructor.
__toString()  : string
Returns filter description
getGroups()  : array<string|int, mixed>|array<string|int, int>|array<string|int, string>
getHow()  : string
getVal()  : int|Team
getWhat()  : string
validate()  : bool
Check if a team passes the filter
validateCalc()  : bool
Check a value using an aggregate operation
validateProgressed()  : bool
Check if a team is progressed from some group
validateTeam()  : bool
Validate a specific team

Properties

$groups

private array<string|int, mixed> $groups

$how

private string $how
Tags
details

Available values:

  • <
  • =

  • <=
  • =
  • !=

$what

private string $what
Tags
details

Available values:

  • points
  • score
  • wins
  • losses
  • draws
  • second
  • third
  • team
  • not-progressed
  • progressed

Methods

__construct()

TeamFilter constructor.

public __construct([string $what = 'points' ][, string $how = '>' ], int|Team $val[, array<string|int, Group$groups = [] ]) : mixed
Parameters
$what : string = 'points'

What to compare

$how : string = '>'

How to compare values

$val : int|Team

Value to compare to

$groups : array<string|int, Group> = []

Groups to get the statistics from

Tags
throws
InvalidArgumentException
Return values
mixed

__toString()

Returns filter description

public __toString() : string
Return values
string

getGroups()

public getGroups() : array<string|int, mixed>|array<string|int, int>|array<string|int, string>
Return values
array<string|int, mixed>|array<string|int, int>|array<string|int, string>

getHow()

public getHow() : string
Return values
string

getWhat()

public getWhat() : string
Return values
string

validate()

Check if a team passes the filter

public validate(Team $team, array<string|int, int>|array<string|int, string> $groupsId[, string $operation = 'sum' ][, Group|null $from = null ]) : bool
Parameters
$team : Team

Team to check

$groupsId : array<string|int, int>|array<string|int, string>

Ids of groups to consider

$operation : string = 'sum'

Aggregate operation (sum, avg, max, min)

$from : Group|null = null

If checking for progression -> what group to check progression from

Tags
throws
Exception
Return values
bool

validateCalc()

Check a value using an aggregate operation

protected validateCalc(Team $team, array<string|int, string>|array<string|int, int> $groupsId[, string $operation = 'sum' ]) : bool
Parameters
$team : Team

Team to check

$groupsId : array<string|int, string>|array<string|int, int>

Groups' ids to aggregate from

$operation : string = 'sum'

Aggregate operation (sum, avg, max, min)

Tags
throws
Exception
see
FilterComparator::compare()
Return values
bool

validateProgressed()

Check if a team is progressed from some group

protected validateProgressed(Team $team[, Group|null $from = null ]) : bool
Parameters
$team : Team
$from : Group|null = null
Tags
throws
Exception
Return values
bool

validateTeam()

Validate a specific team

protected validateTeam(Team $team) : bool
Parameters
$team : Team
Return values
bool

Search results