Tournament Generator

Filter

Filter class

Filter is a helper class to apply TeamFilter classes to an array of teams.

Tags
since
0.2
author

Tomáš Vojík vojik@wboy.cz

Table of Contents

$filters  : array<string|int, mixed>
$groups  : array<string|int, mixed>
__construct()  : mixed
Filter constructor.
filter()  : array<string|int, Team>
Apply filters
filterMulti()  : void
Apply "multiplied" filters
filterAnd()  : bool
Apply filters using and AND operand
filterOr()  : bool
Apply filters using and OR operand
getGroupsIds()  : array<string|int, string>|array<string|int, int>
Get ids of the considered groups

Properties

$filters

private array<string|int, mixed> $filters

$groups

private array<string|int, mixed> $groups

Methods

__construct()

Filter constructor.

public __construct(array<string|int, TeamFilter>|array<string|int, array<string|int, TeamFilter>> $filters, array<string|int, Group$groups) : mixed
Parameters
$filters : array<string|int, TeamFilter>|array<string|int, array<string|int, TeamFilter>>

Filter classes - can be structured in an hierarchical array with "and" / "or" keys.

$groups : array<string|int, Group>

Groups to consider when getting team stats.

Return values
mixed

filter()

Apply filters

public filter(array<string|int, Team&$teams) : array<string|int, Team>
Parameters
$teams : array<string|int, Team>

Team array to filter

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

filterMulti()

Apply "multiplied" filters

protected filterMulti(array<string|int, Team&$teams, array<string|int, TeamFilter>|array<string|int, array<string|int, TeamFilter>> $filters[, string $how = 'and' ]) : void

Filters can be structured in an array with "and" / "or" keys, that will be parsed.

Parameters
$teams : array<string|int, Team>
$filters : array<string|int, TeamFilter>|array<string|int, array<string|int, TeamFilter>>
$how : string = 'and'

Logical operator - AND, OR (case insensitive).

Tags
throws
Exception
Return values
void

filterAnd()

Apply filters using and AND operand

private filterAnd(Team $team, array<string|int, TeamFilter>|array<string|int, array<string|int, TeamFilter>> $filters) : bool
Parameters
$team : Team
$filters : array<string|int, TeamFilter>|array<string|int, array<string|int, TeamFilter>>
Tags
throws
Exception
Return values
bool

filterOr()

Apply filters using and OR operand

private filterOr(Team $team, array<string|int, TeamFilter>|array<string|int, array<string|int, TeamFilter>> $filters) : bool
Parameters
$team : Team
$filters : array<string|int, TeamFilter>|array<string|int, array<string|int, TeamFilter>>
Tags
throws
Exception
Return values
bool

getGroupsIds()

Get ids of the considered groups

private getGroupsIds() : array<string|int, string>|array<string|int, int>
Return values
array<string|int, string>|array<string|int, int>

Search results