GameContainer
extends BaseContainer
in package
Class GameContainer
Special container for games.
Tags
Table of Contents
- $id : string|int
- $autoIncrement : int
- $children : array<string|int, mixed>
- $currentIndex : int
- $firstIncrement : int
- $parent : BaseContainer|null
- $values : array<string|int, mixed>
- __construct() : mixed
- BaseContainer constructor.
- addChild() : $this
- Adds a child container
- addSorter() : ContainerQuery
- count() : int
- Returns the value count
- current() : mixed
- Get the current value
- filter() : ContainerQuery
- Add a filter callback
- fromArray() : BaseContainer
- Create a new container from array
- get() : array<string|int, mixed>
- Get all values from the container - including child nodes
- getAutoIncrement() : int
- getFirstIncrement() : int
- getLeafIds() : array<string|int, string>|array<string|int, int>
- Gets all ids of the leaf containers
- getParent() : BaseContainer|null
- Get a parent container
- getQuery() : ContainerQuery
- getTopLevel() : array<string|int, mixed>
- Get all top-level values from the container
- getTopLevelQuery() : ContainerQuery
- ids() : ContainerQuery
- Get only the object's ids
- incrementId() : void
- Increments the auto-incremented id
- insert() : $this
- Insert a value into container
- insertFlat() : $this
- Insert a value into container
- key() : int
- Return the current key
- next() : void
- Move pointer to next
- only() : ContainerQuery
- Pluck a specific key from all values
- resetAutoIncrement() : GameContainer
- Resets the autoincrement number for games to the FirstIncrement
- rewind() : void
- Rewind the iterator
- setAutoIncrement() : GameContainer
- Sets the autoincrement number for games
- setParent() : BaseContainer
- Set a container's parent
- sort() : ContainerQuery
- Sort a result using a callback - maintaining the index association
- sortBy() : ContainerQuery
- Sort a result set by a given property
- unique() : ContainerQuery
- Get only unique values
- valid() : bool
- Check if the current value exists
- whereId() : ContainerQuery
- Filter results to only contain those with a specific ID
Properties
$id
public
string|int
$id
$autoIncrement
protected
int
$autoIncrement
= 1
$children
protected
array<string|int, mixed>
$children
= []
$currentIndex
protected
int
$currentIndex
= 0
$firstIncrement
protected
int
$firstIncrement
= 1
$parent
protected
BaseContainer|null
$parent
$values
protected
array<string|int, mixed>
$values
= []
Methods
__construct()
BaseContainer constructor.
public
__construct(string|int $id[, BaseContainer $parent = null ]) : mixed
Parameters
- $id : string|int
- $parent : BaseContainer = null
Return values
mixed —addChild()
Adds a child container
public
addChild(array<string|int, GameContainer> ...$containers) : $this
Parameters
- $containers : array<string|int, GameContainer>
Tags
Return values
$this —addSorter()
public
addSorter(BaseSorter $sorter) : ContainerQuery
Parameters
- $sorter : BaseSorter
Return values
ContainerQuery —count()
Returns the value count
public
count() : int
Return values
int —current()
Get the current value
public
current() : mixed
Return values
mixed —filter()
Add a filter callback
public
filter(Closure $callback) : ContainerQuery
Parameters
- $callback : Closure
Return values
ContainerQuery —fromArray()
Create a new container from array
public
static fromArray(array<string|int, mixed> $data) : BaseContainer
Parameters
- $data : array<string|int, mixed>
Tags
Return values
BaseContainer —get()
Get all values from the container - including child nodes
public
get() : array<string|int, mixed>
Return values
array<string|int, mixed> —All values
getAutoIncrement()
public
getAutoIncrement() : int
Tags
Return values
int —getFirstIncrement()
public
getFirstIncrement() : int
Tags
Return values
int —getLeafIds()
Gets all ids of the leaf containers
public
getLeafIds() : array<string|int, string>|array<string|int, int>
Return values
array<string|int, string>|array<string|int, int> —getParent()
Get a parent container
public
getParent() : BaseContainer|null
Tags
Return values
BaseContainer|null —getQuery()
public
getQuery() : ContainerQuery
Return values
ContainerQuery —getTopLevel()
Get all top-level values from the container
public
getTopLevel() : array<string|int, mixed>
Return values
array<string|int, mixed> —All values
getTopLevelQuery()
public
getTopLevelQuery() : ContainerQuery
Return values
ContainerQuery —ids()
Get only the object's ids
public
ids() : ContainerQuery
Tags
Return values
ContainerQuery —incrementId()
Increments the auto-incremented id
public
incrementId([GameContainer|null $sender = null ]) : void
Parameters
- $sender : GameContainer|null = null
Tags
Return values
void —insert()
Insert a value into container
public
insert(array<string|int, mixed> ...$values) : $this
Parameters
- $values : array<string|int, mixed>
-
Any value to insert into container
Tags
Return values
$this —insertFlat()
Insert a value into container
public
insertFlat(array<string|int, mixed> ...$values) : $this
Parameters
- $values : array<string|int, mixed>
-
Any value to insert into container
Tags
Return values
$this —key()
Return the current key
public
key() : int
Return values
int —next()
Move pointer to next
public
next() : void
Return values
void —only()
Pluck a specific key from all values
public
only(string $property) : ContainerQuery
Parameters
- $property : string
-
Property, array key or method to extract from values
Tags
Return values
ContainerQuery —resetAutoIncrement()
Resets the autoincrement number for games to the FirstIncrement
public
resetAutoIncrement([GameContainer|null $sender = null ]) : GameContainer
Parameters
- $sender : GameContainer|null = null
Tags
Return values
GameContainer —rewind()
Rewind the iterator
public
rewind() : void
Return values
void —setAutoIncrement()
Sets the autoincrement number for games
public
setAutoIncrement(int $autoIncrement) : GameContainer
Parameters
- $autoIncrement : int
Tags
Return values
GameContainer —setParent()
Set a container's parent
public
setParent(BaseContainer|null $parent) : BaseContainer
Parameters
- $parent : BaseContainer|null
Tags
Return values
BaseContainer —sort()
Sort a result using a callback - maintaining the index association
public
sort(Closure $callback) : ContainerQuery
Parameters
- $callback : Closure
Return values
ContainerQuery —sortBy()
Sort a result set by a given property
public
sortBy(string $property) : ContainerQuery
Parameters
- $property : string
Tags
Return values
ContainerQuery —unique()
Get only unique values
public
unique() : ContainerQuery
Return values
ContainerQuery —valid()
Check if the current value exists
public
valid() : bool
Return values
bool —whereId()
Filter results to only contain those with a specific ID
public
whereId(string|int $id) : ContainerQuery
Parameters
- $id : string|int