Tournament Generator

ContainerQuery

Class ContainerQuery

Container query is a helper class to filter, sort, etc. the values of the container hierarchy.

Tags
author

Tomá? Vojík vojik@wboy.cz

since
0.4

Table of Contents

$container  : BaseContainer
$desc  : bool
$filters  : array<string|int, mixed>
$sortClosure  : Closure
$sorter  : BaseSorter
$sortProperty  : string
$topLevelOnly  : bool
$uniqueOnly  : bool
__construct()  : mixed
ContainerQuery constructor.
addSorter()  : $this
desc()  : $this
Sort in descending order
filter()  : $this
Add a filter callback
get()  : array<string|int, mixed>
Get the result
sort()  : $this
Sort a result using a callback - maintaining the index association
sortBy()  : $this
Sort a result set by a given property
unique()  : $this
Get only unique values
sortByPropertyCallback()  : int
Sort function for sorting by a defined property

Properties

Methods

__construct()

ContainerQuery constructor.

public __construct(BaseContainer $container[, bool $topLevelOnly = false ]) : mixed
Parameters
$container : BaseContainer

Queried container

$topLevelOnly : bool = false
Return values
mixed

desc()

Sort in descending order

public desc() : $this
Return values
$this

filter()

Add a filter callback

public filter(Closure $callback) : $this
Parameters
$callback : Closure
Return values
$this

get()

Get the result

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

sort()

Sort a result using a callback - maintaining the index association

public sort(Closure $callback) : $this
Parameters
$callback : Closure
Return values
$this

sortBy()

Sort a result set by a given property

public sortBy(string $property) : $this
Parameters
$property : string
Tags
warning

Sort callback has a priority.

Return values
$this

unique()

Get only unique values

public unique() : $this
Return values
$this

sortByPropertyCallback()

Sort function for sorting by a defined property

protected sortByPropertyCallback(array<string|int, mixed>|object $value1, array<string|int, mixed>|object $value2) : int
Parameters
$value1 : array<string|int, mixed>|object
$value2 : array<string|int, mixed>|object
Return values
int

Search results