phplegends/collections

1.0.4 2016-07-16 18:12 UTC

This package is auto-updated.

Last update: 2024-05-06 22:11:43 UTC


README

### Class: \PHPLegends\Collections\ListCollection
Visibility Function
public __construct(array $items=array()) : void
public add(mixed $item) : void
public addAll(\PHPLegends\Collections\Contracts\Collectible $collection) : void
public all() : void
public chunk(mixed $size, bool $preserveKeys=true) : void
public clear() : \PHPLegends\Collections$this
public contains(mixed $value) : void
public count() : int
Countable implementation
public static create(array $items=array()) : mixed
public diff(\PHPLegends\Collections\Contracts\Collectible $collection) : void
public every(\callable $callback) : boolean
Check if all elements return true in test of callback
public except(array $keys) : \PHPLegends\Collections\Collective
public filter(\PHPLegends\Collections\callable/null/\callable $callback) : \PHPLegends\Collections\Collection
public first(\PHPLegends\Collections\callable/null/\callable $callback=null) : mixed
public getIterator() : \ArrayIterator
public intersect(\PHPLegends\Collections\Contracts\Collectible $collection) : void
public isEmpty() : boolean
Is empty?
public jsonSerialize() : array
public keys() : array
public last(\PHPLegends\Collections\callable/null/\callable $callback=null) : mixed
public map(\PHPLegends\Collections\callable/null/\callable $callback=null) : array
public only(array $keys) : \PHPLegends\Collections\Collective
public pop() : mixed
Removes last item from items
public randomItem() : mixed
public reduce(\callable $callback, mixed/mixed/null $initial=null) : mixed
public reject(\callable $callback) : void
public remove(mixed $value) : void
public removeAll(\PHPLegends\Collections\Contracts\Collectible $collection) : void
public reverse(bool $preserveKeys=true) : \PHPLegends\Collections\Collection
public search(mixed $key) : void
public setItems(array $items) : void
public shift() : mixed
Shift
public shuffle() : \PHPLegends\Collections\Collection
public slice(mixed $offset, mixed $length=null, bool $preserveKeys=true) : void
public some(\callable $callback) : boolean
Some value returns true.
public sort(\PHPLegends\Collections\callable/null/\callable $callback=null) : \PHPLegends\Collections\Collection
public sortBy(\callable $callback, bool $ascending=true) : void
public sortByDesc(\callable $callback) : void
public toArray() : void
public unique() : void
public unshift(mixed $item) : \PHPLegends\Collections$this
Unshift

This class implements \PHPLegends\Collections\Contracts\Arrayable, \PHPLegends\Collections\Contracts\Collectible, \Countable, \JsonSerializable, \PHPLegends\Collections\Contracts\Modifiable, \PHPLegends\Collections\Contracts\Validatable, \IteratorAggregate, \Traversable

### Class: \PHPLegends\Collections\Collection
Visibility Function
public addAll(\PHPLegends\Collections\Collection/\PHPLegends\Collections\Contracts\Collectible $collection) : \PHPLegends\Collections$this
public delete(int/string $key) : mixed
Unset item from collection via index and return value
public get(string/int $key) : mixed
public getOrDefault(int/string $key, mixed/mixed/null $default=null) : mixed
Get an item from collection and, if doesnt have, returns default value
public has(mixed $key) : boolean
public merge(array $items, bool/boolean $recursive=false) : \PHPLegends\Collections$this
public offsetExists(string/int $key) : boolean
public offsetGet(string/int $key) : mixed
public offsetSet(string/int $key, mixed $value) : mixed
public offsetUnset(string/int $key) : void
public replace(array $items, bool/boolean $recursive=false) : \PHPLegends\Collections$this
public set(int/string $key, mixed $value) : \PHPLegends\Collections$this
public setItems(array $items) : \PHPLegends\Collections$this
public sortByKeys(bool/mixed $ascending=true) : \PHPLegends\Collections\Collective
public values() : array
Returns all values in an array with "reseted" keys

This class extends \PHPLegends\Collections\ListCollection

This class implements \Traversable, \IteratorAggregate, \PHPLegends\Collections\Contracts\Validatable, \PHPLegends\Collections\Contracts\Modifiable, \JsonSerializable, \Countable, \PHPLegends\Collections\Contracts\Collectible, \PHPLegends\Collections\Contracts\Arrayable, \ArrayAccess, \PHPLegends\Collections\Contracts\Accessible

### Class: \PHPLegends\Collections\MathCollection
Visibility Function
public average(\callable $callback=null) : mixed
public max(\callable $callback=null) : mixed
public min(\callable $callback=null) : mixed
public sum(\callable $callback=null) : mixed

This class extends \PHPLegends\Collections\Collection

This class implements \PHPLegends\Collections\Contracts\Accessible, \ArrayAccess, \PHPLegends\Collections\Contracts\Arrayable, \PHPLegends\Collections\Contracts\Collectible, \Countable, \JsonSerializable, \PHPLegends\Collections\Contracts\Modifiable, \PHPLegends\Collections\Contracts\Validatable, \IteratorAggregate, \Traversable

### Class: \PHPLegends\Collections\RecursiveCollection
Visibility Function
public getIterator() : \RecursiveArrayIterator
Overwrites the parent method to make a recursive iterator
public isRecursive(mixed $key) : bool
Detects if the index passed is a recursive in collection
public setItems(array $items) : void

This class extends \PHPLegends\Collections\Collection

This class implements \PHPLegends\Collections\Contracts\Accessible, \ArrayAccess, \PHPLegends\Collections\Contracts\Arrayable, \PHPLegends\Collections\Contracts\Collectible, \Countable, \JsonSerializable, \PHPLegends\Collections\Contracts\Modifiable, \PHPLegends\Collections\Contracts\Validatable, \IteratorAggregate, \Traversable

### Interface: \PHPLegends\Collections\Contracts\Modifiable
Visibility Function
public chunk(mixed $amont, bool/boolean $preserveKeys=true) : \PHPLegends\Collections\Contracts\Collection
public diff(\PHPLegends\Collections\Contracts\Collectible $collection) : \PHPLegends\Collections\Contracts\Collectible
public filter(\callable $callback) : \PHPLegends\Collections\Contracts\Collectible
public intersect(\PHPLegends\Collections\Contracts\Collectible $collection) : \PHPLegends\Collections\Contracts\Collectible
public map(\callable $callback=null) : \PHPLegends\Collections\Contracts\Collectible
public reject(\callable $callback) : \PHPLegends\Collections\Contracts\Collectible
public reverse(bool/boolean $preserveKeys=true) : \PHPLegends\Collections\Contracts\Collectible
public shuffle() : \PHPLegends\Collections\Contracts\Collectible
public slice(int $offset, null/int $limit) : \PHPLegends\Collections\Contracts\Collectible
Returns the slice for collection
public sort(\callable $callback=null) : \PHPLegends\Collections\Contracts\Collectible
public sortBy(\PHPLegends\Collections\Contracts\callable/null/\callable $callback, bool/boolean $ascending=true) : \PHPLegends\Collections\Contracts\Collectible
public unique() : \PHPLegends\Collections\Contracts\Collectible
### Interface: \PHPLegends\Collections\Contracts\Collectible
Visibility Function
public __construct(array $items=array()) : void
public add(mixed $item) : \PHPLegends\Collections\Contracts$this
Adds an item in collection
public addAll(\PHPLegends\Collections\Contracts\Collectible $collection) : \PHPLegends\Collections\Contracts$this
Adds all items of another collection in this collection
public all() : array
Gives all itens from collection
public contains(mixed $item) : boolean
Checks if this Collection contains an determined item
public keys() : array
public remove(mixed $item) : void
Removes an item from collection
public removeAll(\PHPLegends\Collections\Contracts\Collectible $collection) : \PHPLegends\Collections\Contracts$this
Removes all from this collection based on another collection
public search(int/string $key) : int/string/false
Searches element by index in collecion
### Interface: \PHPLegends\Collections\Contracts\Accessible

Interface for key value collection. Contract for use named keys in collection

Visibility Function
public delete(mixed $key) : mixed
Delete an item from Collection by index
public except(array $keys) : \PHPLegends\Collections\Contracts\Collection
Returns all elements of Collection, except the specified in $keys
public get(int/\PHPLegends\Collections\Contracts\key $key) : mixed
Description
public has(int/string $key) : boolean
Checks if key exists in Collection
public keys() : array
All keys of Collection
public merge(array $items, bool/boolean $recursive=false) : \PHPLegends\Collections\Contracts$this
public only(array $keys) : \PHPLegends\Collections\Contracts\Collection
Returns elements in collection specified in $keys
public replace(array $items, bool/boolean $recursive=false) : \PHPLegends\Collections\Contracts$this
Replaces items in Collection
public set(int/\PHPLegends\Collections\Contracts\key $key, mixed $value) : \PHPLegends\Collections\Contracts\self
Description
public sortByKeys(bool/boolean $ascending=true) : void
### Interface: \PHPLegends\Collections\Contracts\Validatable
Visibility Function
public every(\callable $callback) : boolean
Checks if every elements returns true
public isEmpty() : boolean
This Collection is Empty?
public some(\callable $callback) : boolean
Checks if at least one element returns true
### Interface: \PHPLegends\Collections\Contracts\Arrayable
Visibility Function
public toArray() : array
### Class: \PHPLegends\Collections\Exceptions\CollectionException

This class extends \Exception