PHP Интерфейс Collections\CollectionInterface

Наследование: extends collections\ConstCollectionInterface, extends collections\OutputCollectionInterface
Показать файл Открыть проект

Открытые методы

Метод Описание
add ( $item ) : collections\CollectionInterface Returns a collection with $item added.
at ( $index ) : mixed Returns the item in the collection at $index.
clear ( ) : collections\CollectionInterface Removes every item from the collection.
contains ( callable $condition ) : boolean Returns true if the collection contains any items that satisfy $condition, returns false if it contains none.
count ( ) : integer Returns the number of items in the collection.
drop ( $num ) : Collection Removes all of the items in the collection starting at index $num.
dropRight ( $num ) : Collection Removes all of the items in the collectioin between index 0 and $num.
dropWhile ( callable $condition ) : Collection Iteratively drops items in the collection that satisfy $condition until an item is encountered that does not satisfy $condition.
each ( callable $callable ) Applies the callback function $callable to each item in the collection.
every ( callable $condition ) : boolean Returns true if every item in the collection satisfies $condition, returns false if not.
filter ( callable $condition ) : collections\CollectionInterface Returns a collection that only contains the items which satisfy $condition.
find ( callable $condition ) : mixed Returns the first item in the collection that satisfies $condition, returns false if no such item exists.
findIndex ( callable $condition ) : integer Returns the index of the first item in the collection that satisfies $condition, returns -1 if no such item exists.
findLast ( callable $condition ) : mixed Returns the last item in the collection that satisfies $condition, returns false if no such item exists.
findLastIndex ( callable $condition ) : integer Returns the index of the last item in the collection that satisfies $condition, returns -1 if no such item exists.
getIterator ( ) : ArrayIterato\ArrayIterator Returns an array iterator for the collection.
getType ( ) : string Returns the type of the collection.
indexExists ( $index ) : boolean Returns true if $index is within the collection's range and returns false if it is not.
insert ( $index, $item ) Inserts $item at $index.
insertRange ( $index, array $items ) Inserts the range $items at $index.
map ( callable $callable ) : collections\CollectionInterface Returns a new instance of the collection with the callback function $callable applied to each item.
merge ( $items ) : collections\CollectionInterface Adds every member of $items to the collection.
reduce ( callable $callable, null $initial = null ) : mixed Iteratively reduces the collection to a single value using the callback function $callable.
reduceRight ( callable $callable, null $initial = null ) : mixed Iteratively reduces the collection to a single value using the callback function $callable starting at the rightmost index.
removeAt ( $index ) : collections\CollectionInterface Removes the item at $index.
reverse ( ) : collections\CollectionInterface Reverses the order of the items in the collection.
shuffle ( ) : collections\CollectionInterface Randomly reorders the items in the collection.
slice ( $start, $end ) : collections\CollectionInterface Returns a collection that contains the subset of items ranging from the index $start to $end.
sort ( callable $callback ) : collections\CollectionInterface Sorts the items in the collection using the user supplied comparison function $callback.
tail ( ) : Collection Removes the first item in the collection.
take ( $num ) : Collection Removes all of the items in the collection starting at index $num.
takeRight ( $num ) : Collection Removes all of the items in the collection before index $num.
takeWhile ( callable $condition ) : Collection Iterates through the collection until an item is encountered that does not satisfy $condition, then drops all of the items starting at that index.
toArray ( ) : array Returns an array containing the items in the collection.
without ( callable $condition ) : Collection Removes all of the items that satisfy $condition.

Описание методов

add() публичный Метод

Returns a collection with $item added.
public add ( $item ) : collections\CollectionInterface
$item
Результат collections\CollectionInterface

at() публичный Метод

Returns the item in the collection at $index.
public at ( $index ) : mixed
$index
Результат mixed

clear() публичный Метод

Removes every item from the collection.
public clear ( ) : collections\CollectionInterface
Результат collections\CollectionInterface

contains() публичный Метод

Returns true if the collection contains any items that satisfy $condition, returns false if it contains none.
public contains ( callable $condition ) : boolean
$condition callable
Результат boolean

count() публичный Метод

Returns the number of items in the collection.
public count ( ) : integer
Результат integer

drop() публичный Метод

Removes all of the items in the collection starting at index $num.
public drop ( $num ) : Collection
$num
Результат Collection

dropRight() публичный Метод

Removes all of the items in the collectioin between index 0 and $num.
public dropRight ( $num ) : Collection
$num
Результат Collection

dropWhile() публичный Метод

Iteratively drops items in the collection that satisfy $condition until an item is encountered that does not satisfy $condition.
public dropWhile ( callable $condition ) : Collection
$condition callable
Результат Collection

each() публичный Метод

Applies the callback function $callable to each item in the collection.
public each ( callable $callable )
$callable callable

every() публичный Метод

Returns true if every item in the collection satisfies $condition, returns false if not.
public every ( callable $condition ) : boolean
$condition callable
Результат boolean

filter() публичный Метод

Returns a collection that only contains the items which satisfy $condition.
public filter ( callable $condition ) : collections\CollectionInterface
$condition callable
Результат collections\CollectionInterface

find() публичный Метод

Returns the first item in the collection that satisfies $condition, returns false if no such item exists.
public find ( callable $condition ) : mixed
$condition callable
Результат mixed

findIndex() публичный Метод

Returns the index of the first item in the collection that satisfies $condition, returns -1 if no such item exists.
public findIndex ( callable $condition ) : integer
$condition callable
Результат integer

findLast() публичный Метод

Returns the last item in the collection that satisfies $condition, returns false if no such item exists.
public findLast ( callable $condition ) : mixed
$condition callable
Результат mixed

findLastIndex() публичный Метод

Returns the index of the last item in the collection that satisfies $condition, returns -1 if no such item exists.
public findLastIndex ( callable $condition ) : integer
$condition callable
Результат integer

getIterator() публичный Метод

Returns an array iterator for the collection.
public getIterator ( ) : ArrayIterato\ArrayIterator
Результат ArrayIterato\ArrayIterator

getType() публичный Метод

Returns the type of the collection.
public getType ( ) : string
Результат string

indexExists() публичный Метод

Returns true if $index is within the collection's range and returns false if it is not.
public indexExists ( $index ) : boolean
$index
Результат boolean

insert() публичный Метод

Inserts $item at $index.
public insert ( $index, $item )
$index
$item

insertRange() публичный Метод

Inserts the range $items at $index.
public insertRange ( $index, array $items )
$index
$items array

map() публичный Метод

Returns a new instance of the collection with the callback function $callable applied to each item.
public map ( callable $callable ) : collections\CollectionInterface
$callable callable
Результат collections\CollectionInterface

merge() публичный Метод

Adds every member of $items to the collection.
public merge ( $items ) : collections\CollectionInterface
$items
Результат collections\CollectionInterface

reduce() публичный Метод

Iteratively reduces the collection to a single value using the callback function $callable.
public reduce ( callable $callable, null $initial = null ) : mixed
$callable callable
$initial null
Результат mixed

reduceRight() публичный Метод

Iteratively reduces the collection to a single value using the callback function $callable starting at the rightmost index.
public reduceRight ( callable $callable, null $initial = null ) : mixed
$callable callable
$initial null
Результат mixed

removeAt() публичный Метод

Removes the item at $index.
public removeAt ( $index ) : collections\CollectionInterface
$index
Результат collections\CollectionInterface

reverse() публичный Метод

Reverses the order of the items in the collection.
public reverse ( ) : collections\CollectionInterface
Результат collections\CollectionInterface

shuffle() публичный Метод

Randomly reorders the items in the collection.
public shuffle ( ) : collections\CollectionInterface
Результат collections\CollectionInterface

slice() публичный Метод

Returns a collection that contains the subset of items ranging from the index $start to $end.
public slice ( $start, $end ) : collections\CollectionInterface
$start
$end
Результат collections\CollectionInterface

sort() публичный Метод

Sorts the items in the collection using the user supplied comparison function $callback.
public sort ( callable $callback ) : collections\CollectionInterface
$callback callable
Результат collections\CollectionInterface

tail() публичный Метод

Removes the first item in the collection.
public tail ( ) : Collection
Результат Collection

take() публичный Метод

Removes all of the items in the collection starting at index $num.
public take ( $num ) : Collection
$num
Результат Collection

takeRight() публичный Метод

Removes all of the items in the collection before index $num.
public takeRight ( $num ) : Collection
$num
Результат Collection

takeWhile() публичный Метод

Iterates through the collection until an item is encountered that does not satisfy $condition, then drops all of the items starting at that index.
public takeWhile ( callable $condition ) : Collection
$condition callable
Результат Collection

toArray() публичный Метод

Returns an array containing the items in the collection.
public toArray ( ) : array
Результат array

without() публичный Метод

Removes all of the items that satisfy $condition.
public without ( callable $condition ) : Collection
$condition callable
Результат Collection