Skip to main content

GV\Collection

A generic Collection base class.

Source: future/includes/class-gv-collection.php:14

Details

  • Kind: class
  • Namespace: GV

Properties

PropertyTypeDescription
$storagearray<T>Main storage for objects in this collection.

Methods

MethodDescription
add()Add an object to this collection.
clear()Clear this collection.
merge()Merge another collection into here.
all()Returns all the objects in this collection as an an array.
last()Get the last added object.
first()Get the first added object.
count()Returns the count of the objects in this collection.

Method Reference

add()

public function add( $value )

Add an object to this collection.

Parameters

NameTypeDefaultDescription
$valueTThe object to be added.

Returns

  • void

Since: 2.0

Source: future/includes/class-gv-collection.php:29

clear()

public function clear()

Clear this collection.

Returns

  • void

Since: 2.0

Source: future/includes/class-gv-collection.php:40

merge()

public function merge( Collection $collection )

Merge another collection into here.

Parameters

NameTypeDefaultDescription
$collection\GV\Collection<T>The collection to be merged.

Returns

  • void

Since: 2.0

Source: future/includes/class-gv-collection.php:53

all()

public function all()

Returns all the objects in this collection as an an array.

Returns

  • array<T> — The objects in this collection.

Since: 2.0

Source: future/includes/class-gv-collection.php:64

last()

public function last()

Get the last added object.

Returns

  • T | null — The last item in here, or null if there are none.

Since: 2.0

Source: future/includes/class-gv-collection.php:75

first()

public function first()

Get the first added object.

Returns

  • T | null — The first item in here, or null if there are none.

Since: 2.0

Source: future/includes/class-gv-collection.php:86

count()

public function count()

Returns the count of the objects in this collection.

Returns

  • int — The size of this collection.

Since: 2.0

Source: future/includes/class-gv-collection.php:97