Collection
class Collection implements Countable, Iterator
Collection, an util to conventionally store a key-value pair.
Properties
| protected array | $data | 
Methods
I think you are supposed to know what this does.
No description
Returns the current element.
Fetch the key from the current element.
Advances the internal pointer.
Resets the internal pointer.
Checks if current position is valid.
Sets a key-value pair.
Removes an item from the collection by its key.
Clears the Collection.
Returns all items.
Breaks the collection into multiple, smaller chunks of a given size. Returns a new Collection.
Returns the total number of items in the collection.
Returns a copy of itself.
Compares the collection against another collection or a plain PHP array based on its value. Returns a new Collection.
Compares the collection against another collection or a plain PHP array based on its key. Returns a new Collection.
Iterates over the items in the collection and passes each item to a given callback. Returning false in the callback will stop the processing.
Returns true if all elements pass the given truth test.
Returns all items in the collection except for those with the specified keys. Returns a new Collection.
Filters the collection by a given callback, keeping only those items that pass a given truth test. Returns a new Collection.
Returns the first element in the collection that passes a given truth test.
Flattens a multi-dimensional collection into a single dimension. Returns a new Collection.
Returns the item for a given key. If the key does not exist, null is returned.
Groups the collection's items by a given key. Returns a new Collection.
Determines if a given key exists in the collection.
Joins the items in a collection. Its arguments depend on the type of items in the collection.
Returns the position of the given value in the collection. Returns null if the given value couldn't be found.
Removes any values that are not present in the given array or collection. Returns a new Collection.
Returns all of the collection's keys. Returns a new Collection.
Returns the last element in the collection that passes a given truth test.
Iterates through the collection and passes each value to the given callback. The callback is free to modify the item and return it, thus forming a new collection of modified items.
Return the maximum value of a given key.
Return the minimum value of a given key.
Merges the given collection into this collection, resulting in a new collection.
Creates a new collection consisting of every n-th element.
Returns the items in the collection with the specified keys. Returns a new Collection.
Partitions the collection into two collections where the first collection contains the items that passed and the second contains the items that failed.
Return the values from a single column in the input array. Returns a new Collection.
Returns one random item, or multiple random items inside a Collection, from the Collection. Returns a new Collection.
Reduces the collection to a single value, passing the result of each iteration into the subsequent iteration.
Reverses the order of the collection's items. Returns a new Collection.
Searches the collection for the given value and returns its key if found. If the item is not found, false is returned.
Randomly shuffles the items in the collection. Returns a new Collection.
Returns a slice of the collection starting at the given index. Returns a new Collection.
Returns true if at least one element passes the given truth test.
Sorts the collection, using sort behaviour flags. Returns a new Collection.
Sorts the collection by key, using sort behaviour flags. Returns a new Collection.
Sorts the collection using a custom sorting function. Returns a new Collection.
Sorts the collection by key using a custom sorting function. Returns a new Collection.
Returns all of the unique items in the collection. Returns a new Collection.
Returns a new collection with the keys reset to consecutive integers.
No description
Details
        at         line 25
                            
    __construct(array $data = null)
        
    
    I think you are supposed to know what this does.
        at         line 35
                            mixed
    __debugInfo()
        
    
    
        at         line 44
                            mixed
    current()
        
    
    Returns the current element.
        at         line 53
                            mixed
    key()
        
    
    Fetch the key from the current element.
        at         line 62
                            mixed|false
    next()
        
    
    Advances the internal pointer.
        at         line 71
                            mixed|false
    rewind()
        
    
    Resets the internal pointer.
        at         line 80
                            bool
    valid()
        
    
    Checks if current position is valid.
        at         line 90
                            $this
    set(mixed $key, mixed $value)
        
    
    Sets a key-value pair.
        at         line 100
                            $this
    delete(mixed $key)
        
    
    Removes an item from the collection by its key.
        at         line 110
                            $this
    clear()
        
    
    Clears the Collection.
        at         line 119
                            mixed[]
    all()
        
    
    Returns all items.
        at         line 129
                            Collection
    chunk(int $numitems, bool $preserve_keys = false)
        
    
    Breaks the collection into multiple, smaller chunks of a given size. Returns a new Collection.
        at         line 137
                            int
    count()
        
    
    Returns the total number of items in the collection.
        at         line 145
                            Collection
    copy()
        
    
    Returns a copy of itself.
        at         line 154
                            Collection
    diff(mixed[]|Collection $arr)
        
    
    Compares the collection against another collection or a plain PHP array based on its value. Returns a new Collection.
        at         line 167
                            Collection
    diffKeys(mixed[]|Collection $arr)
        
    
    Compares the collection against another collection or a plain PHP array based on its key. Returns a new Collection.
        at         line 180
                            $this
    each(callable $closure)
        
    
    Iterates over the items in the collection and passes each item to a given callback. Returning false in the callback will stop the processing.
        at         line 196
                            bool
    every(callable $closure)
        
    
    Returns true if all elements pass the given truth test.
        at         line 211
                            Collection
    except(array $keys)
        
    
    Returns all items in the collection except for those with the specified keys. Returns a new Collection.
        at         line 227
                            Collection
    filter(callable $closure)
        
    
    Filters the collection by a given callback, keeping only those items that pass a given truth test. Returns a new Collection.
        at         line 244
                            mixed|null
    first(callable $closure = null)
        
    
    Returns the first element in the collection that passes a given truth test.
        at         line 269
                            Collection
    flatten(int $depth = 0)
        
    
    Flattens a multi-dimensional collection into a single dimension. Returns a new Collection.
        at         line 279
                            mixed|null
    get(mixed $key)
        
    
    Returns the item for a given key. If the key does not exist, null is returned.
        at         line 288
                            Collection
    groupBy(callable|mixed $column)
        
    
    Groups the collection's items by a given key. Returns a new Collection.
        at         line 314
                            bool
    has(mixed $key)
        
    
    Determines if a given key exists in the collection.
        at         line 326
                            string
    implode(mixed $col, string $glue = ', ')
        
    
    Joins the items in a collection. Its arguments depend on the type of items in the collection.
If the collection contains arrays or objects, you should pass the key of the attributes you wish to join, and the "glue" string you wish to place between the values.
        at         line 355
                            int|null
    indexOf(mixed $value)
        
    
    Returns the position of the given value in the collection. Returns null if the given value couldn't be found.
        at         line 374
                            Collection
    intersect(mixed[]|Collection $arr)
        
    
    Removes any values that are not present in the given array or collection. Returns a new Collection.
        at         line 386
                            Collection
    keys()
        
    
    Returns all of the collection's keys. Returns a new Collection.
        at         line 395
                            mixed|null
    last(callable $closure = null)
        
    
    Returns the last element in the collection that passes a given truth test.
        at         line 421
                            Collection
    map(callable $closure)
        
    
    Iterates through the collection and passes each value to the given callback. The callback is free to modify the item and return it, thus forming a new collection of modified items.
        at         line 433
                            int
    max(mixed|null $key = null)
        
    
    Return the maximum value of a given key.
        at         line 448
                            int
    min(mixed|null $key = null)
        
    
    Return the minimum value of a given key.
        at         line 464
                            Collection
    merge(Collection $collection)
        
    
    Merges the given collection into this collection, resulting in a new collection.
Any string key in the given collection matching a string key in this collection will overwrite the value in this collection.
        at         line 475
                            Collection
    nth(int $nth, int $offset = 0)
        
    
    Creates a new collection consisting of every n-th element.
        at         line 495
                            Collection
    only(array $keys)
        
    
    Returns the items in the collection with the specified keys. Returns a new Collection.
        at         line 511
                            Collection[]
    partition(callable $closure)
        
    
    Partitions the collection into two collections where the first collection contains the items that passed and the second contains the items that failed.
        at         line 532
                            Collection
    pluck(mixed $key, mixed $index = null)
        
    
    Return the values from a single column in the input array. Returns a new Collection.
        at         line 563
                            Collection
    random(int $num = 1)
        
    
    Returns one random item, or multiple random items inside a Collection, from the Collection. Returns a new Collection.
        at         line 583
                            mixed|null|void
    reduce(callable $closure, mixed|null $carry = null)
        
    
    Reduces the collection to a single value, passing the result of each iteration into the subsequent iteration.
        at         line 596
                            Collection
    reverse(bool $preserve_keys = false)
        
    
    Reverses the order of the collection's items. Returns a new Collection.
        at         line 606
                            mixed|bool
    search(mixed $needle, bool $strict = true)
        
    
    Searches the collection for the given value and returns its key if found. If the item is not found, false is returned.
        at         line 614
                            Collection
    shuffle()
        
    
    Randomly shuffles the items in the collection. Returns a new Collection.
        at         line 628
                            Collection
    slice(int $offset, int $limit = null, bool $preserve_keys = false)
        
    
    Returns a slice of the collection starting at the given index. Returns a new Collection.
        at         line 638
                            bool
    some(callable $closure)
        
    
    Returns true if at least one element passes the given truth test.
        at         line 654
                            Collection
    sort(bool $descending = false, int $options = \SORT_REGULAR)
        
    
    Sorts the collection, using sort behaviour flags. Returns a new Collection.
        at         line 672
                            Collection
    sortKey(bool $descending = false, int $options = \SORT_REGULAR)
        
    
    Sorts the collection by key, using sort behaviour flags. Returns a new Collection.
        at         line 689
                            Collection
    sortCustom(callable $closure)
        
    
    Sorts the collection using a custom sorting function. Returns a new Collection.
        at         line 701
                            Collection
    sortCustomKey(callable $closure)
        
    
    Sorts the collection by key using a custom sorting function. Returns a new Collection.
        at         line 715
                            Collection
    unique(mixed|null $key, int $options = \SORT_REGULAR)
        
    
    Returns all of the unique items in the collection. Returns a new Collection.
        at         line 751
                            Collection
    values()
        
    
    Returns a new collection with the keys reset to consecutive integers.