1563 lines
33 KiB
YAML
1563 lines
33 KiB
YAML
name: Collection
|
|
class_comment: '# * @template TKey of array-key
|
|
|
|
# *
|
|
|
|
# * @template-covariant TValue
|
|
|
|
# *
|
|
|
|
# * @implements \ArrayAccess<TKey, TValue>
|
|
|
|
# * @implements \Illuminate\Support\Enumerable<TKey, TValue>'
|
|
dependencies:
|
|
- name: ArrayAccess
|
|
type: class
|
|
source: ArrayAccess
|
|
- name: ArrayIterator
|
|
type: class
|
|
source: ArrayIterator
|
|
- name: CanBeEscapedWhenCastToString
|
|
type: class
|
|
source: Illuminate\Contracts\Support\CanBeEscapedWhenCastToString
|
|
- name: EnumeratesValues
|
|
type: class
|
|
source: Illuminate\Support\Traits\EnumeratesValues
|
|
- name: Macroable
|
|
type: class
|
|
source: Illuminate\Support\Traits\Macroable
|
|
- name: InvalidArgumentException
|
|
type: class
|
|
source: InvalidArgumentException
|
|
- name: stdClass
|
|
type: class
|
|
source: stdClass
|
|
- name: Traversable
|
|
type: class
|
|
source: Traversable
|
|
properties:
|
|
- name: items
|
|
visibility: protected
|
|
comment: "# * @template TKey of array-key\n# *\n# * @template-covariant TValue\n\
|
|
# *\n# * @implements \\ArrayAccess<TKey, TValue>\n# * @implements \\Illuminate\\\
|
|
Support\\Enumerable<TKey, TValue>\n# */\n# class Collection implements ArrayAccess,\
|
|
\ CanBeEscapedWhenCastToString, Enumerable\n# {\n# /**\n# * @use \\Illuminate\\\
|
|
Support\\Traits\\EnumeratesValues<TKey, TValue>\n# */\n# use EnumeratesValues,\
|
|
\ Macroable;\n# \n# /**\n# * The items contained in the collection.\n# *\n# *\
|
|
\ @var array<TKey, TValue>"
|
|
methods:
|
|
- name: __construct
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
default: '[]'
|
|
comment: "# * @template TKey of array-key\n# *\n# * @template-covariant TValue\n\
|
|
# *\n# * @implements \\ArrayAccess<TKey, TValue>\n# * @implements \\Illuminate\\\
|
|
Support\\Enumerable<TKey, TValue>\n# */\n# class Collection implements ArrayAccess,\
|
|
\ CanBeEscapedWhenCastToString, Enumerable\n# {\n# /**\n# * @use \\Illuminate\\\
|
|
Support\\Traits\\EnumeratesValues<TKey, TValue>\n# */\n# use EnumeratesValues,\
|
|
\ Macroable;\n# \n# /**\n# * The items contained in the collection.\n# *\n# *\
|
|
\ @var array<TKey, TValue>\n# */\n# protected $items = [];\n# \n# /**\n# * Create\
|
|
\ a new collection.\n# *\n# * @param \\Illuminate\\Contracts\\Support\\Arrayable<TKey,\
|
|
\ TValue>|iterable<TKey, TValue>|null $items\n# * @return void"
|
|
- name: range
|
|
visibility: public
|
|
parameters:
|
|
- name: from
|
|
- name: to
|
|
comment: '# * Create a collection with the given range.
|
|
|
|
# *
|
|
|
|
# * @param int $from
|
|
|
|
# * @param int $to
|
|
|
|
# * @return static<int, int>'
|
|
- name: all
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Get all of the items in the collection.
|
|
|
|
# *
|
|
|
|
# * @return array<TKey, TValue>'
|
|
- name: lazy
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Get a lazy collection for the items in this collection.
|
|
|
|
# *
|
|
|
|
# * @return \Illuminate\Support\LazyCollection<TKey, TValue>'
|
|
- name: median
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
default: 'null'
|
|
comment: '# * Get the median of a given key.
|
|
|
|
# *
|
|
|
|
# * @param string|array<array-key, string>|null $key
|
|
|
|
# * @return float|int|null'
|
|
- name: mode
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
default: 'null'
|
|
comment: '# * Get the mode of a given key.
|
|
|
|
# *
|
|
|
|
# * @param string|array<array-key, string>|null $key
|
|
|
|
# * @return array<int, float|int>|null'
|
|
- name: collapse
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Collapse the collection of items into a single array.
|
|
|
|
# *
|
|
|
|
# * @return static<int, mixed>'
|
|
- name: contains
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
- name: operator
|
|
default: 'null'
|
|
- name: value
|
|
default: 'null'
|
|
comment: '# * Determine if an item exists in the collection.
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue, TKey): bool)|TValue|string $key
|
|
|
|
# * @param mixed $operator
|
|
|
|
# * @param mixed $value
|
|
|
|
# * @return bool'
|
|
- name: containsStrict
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
- name: value
|
|
default: 'null'
|
|
comment: '# * Determine if an item exists, using strict comparison.
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue): bool)|TValue|array-key $key
|
|
|
|
# * @param TValue|null $value
|
|
|
|
# * @return bool'
|
|
- name: doesntContain
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
- name: operator
|
|
default: 'null'
|
|
- name: value
|
|
default: 'null'
|
|
comment: '# * Determine if an item is not contained in the collection.
|
|
|
|
# *
|
|
|
|
# * @param mixed $key
|
|
|
|
# * @param mixed $operator
|
|
|
|
# * @param mixed $value
|
|
|
|
# * @return bool'
|
|
- name: crossJoin
|
|
visibility: public
|
|
parameters:
|
|
- name: '...$lists'
|
|
comment: '# * Cross join with the given lists, returning all possible permutations.
|
|
|
|
# *
|
|
|
|
# * @template TCrossJoinKey
|
|
|
|
# * @template TCrossJoinValue
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TCrossJoinKey, TCrossJoinValue>|iterable<TCrossJoinKey,
|
|
TCrossJoinValue> ...$lists
|
|
|
|
# * @return static<int, array<int, TValue|TCrossJoinValue>>'
|
|
- name: diff
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
comment: '# * Get the items in the collection that are not present in the given
|
|
items.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key,
|
|
TValue> $items
|
|
|
|
# * @return static'
|
|
- name: diffUsing
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
- name: callback
|
|
comment: '# * Get the items in the collection that are not present in the given
|
|
items, using the callback.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key,
|
|
TValue> $items
|
|
|
|
# * @param callable(TValue, TValue): int $callback
|
|
|
|
# * @return static'
|
|
- name: diffAssoc
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
comment: '# * Get the items in the collection whose keys and values are not present
|
|
in the given items.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey,
|
|
TValue> $items
|
|
|
|
# * @return static'
|
|
- name: diffAssocUsing
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
- name: callback
|
|
comment: '# * Get the items in the collection whose keys and values are not present
|
|
in the given items, using the callback.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey,
|
|
TValue> $items
|
|
|
|
# * @param callable(TKey, TKey): int $callback
|
|
|
|
# * @return static'
|
|
- name: diffKeys
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
comment: '# * Get the items in the collection whose keys are not present in the
|
|
given items.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey,
|
|
TValue> $items
|
|
|
|
# * @return static'
|
|
- name: diffKeysUsing
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
- name: callback
|
|
comment: '# * Get the items in the collection whose keys are not present in the
|
|
given items, using the callback.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey,
|
|
TValue> $items
|
|
|
|
# * @param callable(TKey, TKey): int $callback
|
|
|
|
# * @return static'
|
|
- name: duplicates
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
default: 'null'
|
|
- name: strict
|
|
default: 'false'
|
|
comment: '# * Retrieve duplicate items from the collection.
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue): bool)|string|null $callback
|
|
|
|
# * @param bool $strict
|
|
|
|
# * @return static'
|
|
- name: duplicatesStrict
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
default: 'null'
|
|
comment: '# * Retrieve duplicate items from the collection using strict comparison.
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue): bool)|string|null $callback
|
|
|
|
# * @return static'
|
|
- name: duplicateComparator
|
|
visibility: protected
|
|
parameters:
|
|
- name: strict
|
|
comment: '# * Get the comparison function to detect duplicates.
|
|
|
|
# *
|
|
|
|
# * @param bool $strict
|
|
|
|
# * @return callable(TValue, TValue): bool'
|
|
- name: except
|
|
visibility: public
|
|
parameters:
|
|
- name: keys
|
|
comment: '# * Get all items except for those with the specified keys.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>|string $keys
|
|
|
|
# * @return static'
|
|
- name: filter
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
default: 'null'
|
|
comment: '# * Run a filter over each of the items.
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue, TKey): bool)|null $callback
|
|
|
|
# * @return static'
|
|
- name: first
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
default: 'null'
|
|
- name: default
|
|
default: 'null'
|
|
comment: '# * Get the first item from the collection passing the given truth test.
|
|
|
|
# *
|
|
|
|
# * @template TFirstDefault
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue, TKey): bool)|null $callback
|
|
|
|
# * @param TFirstDefault|(\Closure(): TFirstDefault) $default
|
|
|
|
# * @return TValue|TFirstDefault'
|
|
- name: flatten
|
|
visibility: public
|
|
parameters:
|
|
- name: depth
|
|
default: INF
|
|
comment: '# * Get a flattened array of the items in the collection.
|
|
|
|
# *
|
|
|
|
# * @param int $depth
|
|
|
|
# * @return static<int, mixed>'
|
|
- name: flip
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Flip the items in the collection.
|
|
|
|
# *
|
|
|
|
# * @return static<TValue, TKey>'
|
|
- name: forget
|
|
visibility: public
|
|
parameters:
|
|
- name: keys
|
|
comment: '# * Remove an item from the collection by key.
|
|
|
|
# *
|
|
|
|
# * \Illuminate\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key,
|
|
TKey>|TKey $keys
|
|
|
|
# *
|
|
|
|
# * @return $this'
|
|
- name: get
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
- name: default
|
|
default: 'null'
|
|
comment: '# * Get an item from the collection by key.
|
|
|
|
# *
|
|
|
|
# * @template TGetDefault
|
|
|
|
# *
|
|
|
|
# * @param TKey $key
|
|
|
|
# * @param TGetDefault|(\Closure(): TGetDefault) $default
|
|
|
|
# * @return TValue|TGetDefault'
|
|
- name: getOrPut
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
- name: value
|
|
comment: '# * Get an item from the collection by key or add it to collection if
|
|
it does not exist.
|
|
|
|
# *
|
|
|
|
# * @template TGetOrPutValue
|
|
|
|
# *
|
|
|
|
# * @param mixed $key
|
|
|
|
# * @param TGetOrPutValue|(\Closure(): TGetOrPutValue) $value
|
|
|
|
# * @return TValue|TGetOrPutValue'
|
|
- name: groupBy
|
|
visibility: public
|
|
parameters:
|
|
- name: groupBy
|
|
- name: preserveKeys
|
|
default: 'false'
|
|
comment: '# * Group an associative array by a field or using a callback.
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue, TKey): array-key)|array|string $groupBy
|
|
|
|
# * @param bool $preserveKeys
|
|
|
|
# * @return static<array-key, static<array-key, TValue>>'
|
|
- name: keyBy
|
|
visibility: public
|
|
parameters:
|
|
- name: keyBy
|
|
comment: '# * Key an associative array by a field or using a callback.
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue, TKey): array-key)|array|string $keyBy
|
|
|
|
# * @return static<array-key, TValue>'
|
|
- name: has
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
comment: '# * Determine if an item exists in the collection by key.
|
|
|
|
# *
|
|
|
|
# * @param TKey|array<array-key, TKey> $key
|
|
|
|
# * @return bool'
|
|
- name: hasAny
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
comment: '# * Determine if any of the keys exist in the collection.
|
|
|
|
# *
|
|
|
|
# * @param mixed $key
|
|
|
|
# * @return bool'
|
|
- name: implode
|
|
visibility: public
|
|
parameters:
|
|
- name: value
|
|
- name: glue
|
|
default: 'null'
|
|
comment: '# * Concatenate values of a given key as a string.
|
|
|
|
# *
|
|
|
|
# * @param callable|string $value
|
|
|
|
# * @param string|null $glue
|
|
|
|
# * @return string'
|
|
- name: intersect
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
comment: '# * Intersect the collection with the given items.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey,
|
|
TValue> $items
|
|
|
|
# * @return static'
|
|
- name: intersectUsing
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
- name: callback
|
|
comment: '# * Intersect the collection with the given items, using the callback.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key,
|
|
TValue> $items
|
|
|
|
# * @param callable(TValue, TValue): int $callback
|
|
|
|
# * @return static'
|
|
- name: intersectAssoc
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
comment: '# * Intersect the collection with the given items with additional index
|
|
check.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey,
|
|
TValue> $items
|
|
|
|
# * @return static'
|
|
- name: intersectAssocUsing
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
- name: callback
|
|
comment: '# * Intersect the collection with the given items with additional index
|
|
check, using the callback.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key,
|
|
TValue> $items
|
|
|
|
# * @param callable(TValue, TValue): int $callback
|
|
|
|
# * @return static'
|
|
- name: intersectByKeys
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
comment: '# * Intersect the collection with the given items by key.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey,
|
|
TValue> $items
|
|
|
|
# * @return static'
|
|
- name: isEmpty
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Determine if the collection is empty or not.
|
|
|
|
# *
|
|
|
|
# * @phpstan-assert-if-true null $this->first()
|
|
|
|
# *
|
|
|
|
# * @phpstan-assert-if-false !null $this->first()
|
|
|
|
# *
|
|
|
|
# * @return bool'
|
|
- name: containsOneItem
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Determine if the collection contains a single item.
|
|
|
|
# *
|
|
|
|
# * @return bool'
|
|
- name: join
|
|
visibility: public
|
|
parameters:
|
|
- name: glue
|
|
- name: finalGlue
|
|
default: ''''''
|
|
comment: '# * Join all items from the collection using a string. The final items
|
|
can use a separate glue string.
|
|
|
|
# *
|
|
|
|
# * @param string $glue
|
|
|
|
# * @param string $finalGlue
|
|
|
|
# * @return string'
|
|
- name: keys
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Get the keys of the collection items.
|
|
|
|
# *
|
|
|
|
# * @return static<int, TKey>'
|
|
- name: last
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
default: 'null'
|
|
- name: default
|
|
default: 'null'
|
|
comment: '# * Get the last item from the collection.
|
|
|
|
# *
|
|
|
|
# * @template TLastDefault
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue, TKey): bool)|null $callback
|
|
|
|
# * @param TLastDefault|(\Closure(): TLastDefault) $default
|
|
|
|
# * @return TValue|TLastDefault'
|
|
- name: pluck
|
|
visibility: public
|
|
parameters:
|
|
- name: value
|
|
- name: key
|
|
default: 'null'
|
|
comment: '# * Get the values of a given key.
|
|
|
|
# *
|
|
|
|
# * @param string|int|array<array-key, string>|null $value
|
|
|
|
# * @param string|null $key
|
|
|
|
# * @return static<array-key, mixed>'
|
|
- name: map
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
comment: '# * Run a map over each of the items.
|
|
|
|
# *
|
|
|
|
# * @template TMapValue
|
|
|
|
# *
|
|
|
|
# * @param callable(TValue, TKey): TMapValue $callback
|
|
|
|
# * @return static<TKey, TMapValue>'
|
|
- name: mapToDictionary
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
comment: '# * Run a dictionary map over the items.
|
|
|
|
# *
|
|
|
|
# * The callback should return an associative array with a single key/value pair.
|
|
|
|
# *
|
|
|
|
# * @template TMapToDictionaryKey of array-key
|
|
|
|
# * @template TMapToDictionaryValue
|
|
|
|
# *
|
|
|
|
# * @param callable(TValue, TKey): array<TMapToDictionaryKey, TMapToDictionaryValue> $callback
|
|
|
|
# * @return static<TMapToDictionaryKey, array<int, TMapToDictionaryValue>>'
|
|
- name: mapWithKeys
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
comment: '# * Run an associative map over each of the items.
|
|
|
|
# *
|
|
|
|
# * The callback should return an associative array with a single key/value pair.
|
|
|
|
# *
|
|
|
|
# * @template TMapWithKeysKey of array-key
|
|
|
|
# * @template TMapWithKeysValue
|
|
|
|
# *
|
|
|
|
# * @param callable(TValue, TKey): array<TMapWithKeysKey, TMapWithKeysValue> $callback
|
|
|
|
# * @return static<TMapWithKeysKey, TMapWithKeysValue>'
|
|
- name: merge
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
comment: '# * Merge the collection with the given items.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey,
|
|
TValue> $items
|
|
|
|
# * @return static'
|
|
- name: mergeRecursive
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
comment: '# * Recursively merge the collection with the given items.
|
|
|
|
# *
|
|
|
|
# * @template TMergeRecursiveValue
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TKey, TMergeRecursiveValue>|iterable<TKey,
|
|
TMergeRecursiveValue> $items
|
|
|
|
# * @return static<TKey, TValue|TMergeRecursiveValue>'
|
|
- name: multiply
|
|
visibility: public
|
|
parameters:
|
|
- name: multiplier
|
|
comment: '# * Multiply the items in the collection by the multiplier.
|
|
|
|
# *
|
|
|
|
# * @param int $multiplier
|
|
|
|
# * @return static'
|
|
- name: combine
|
|
visibility: public
|
|
parameters:
|
|
- name: values
|
|
comment: '# * Create a collection by using this collection for keys and another
|
|
for its values.
|
|
|
|
# *
|
|
|
|
# * @template TCombineValue
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<array-key, TCombineValue>|iterable<array-key,
|
|
TCombineValue> $values
|
|
|
|
# * @return static<TValue, TCombineValue>'
|
|
- name: union
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
comment: '# * Union the collection with the given items.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey,
|
|
TValue> $items
|
|
|
|
# * @return static'
|
|
- name: nth
|
|
visibility: public
|
|
parameters:
|
|
- name: step
|
|
- name: offset
|
|
default: '0'
|
|
comment: '# * Create a new collection consisting of every n-th element.
|
|
|
|
# *
|
|
|
|
# * @param int $step
|
|
|
|
# * @param int $offset
|
|
|
|
# * @return static'
|
|
- name: only
|
|
visibility: public
|
|
parameters:
|
|
- name: keys
|
|
comment: '# * Get the items with the specified keys.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>|string|null $keys
|
|
|
|
# * @return static'
|
|
- name: select
|
|
visibility: public
|
|
parameters:
|
|
- name: keys
|
|
comment: '# * Select specific values from the items within the collection.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>|string|null $keys
|
|
|
|
# * @return static'
|
|
- name: pop
|
|
visibility: public
|
|
parameters:
|
|
- name: count
|
|
default: '1'
|
|
comment: '# * Get and remove the last N items from the collection.
|
|
|
|
# *
|
|
|
|
# * @param int $count
|
|
|
|
# * @return static<int, TValue>|TValue|null'
|
|
- name: prepend
|
|
visibility: public
|
|
parameters:
|
|
- name: value
|
|
- name: key
|
|
default: 'null'
|
|
comment: '# * Push an item onto the beginning of the collection.
|
|
|
|
# *
|
|
|
|
# * @param TValue $value
|
|
|
|
# * @param TKey $key
|
|
|
|
# * @return $this'
|
|
- name: push
|
|
visibility: public
|
|
parameters:
|
|
- name: '...$values'
|
|
comment: '# * Push one or more items onto the end of the collection.
|
|
|
|
# *
|
|
|
|
# * @param TValue ...$values
|
|
|
|
# * @return $this'
|
|
- name: unshift
|
|
visibility: public
|
|
parameters:
|
|
- name: '...$values'
|
|
comment: '# * Prepend one or more items to the beginning of the collection.
|
|
|
|
# *
|
|
|
|
# * @param TValue ...$values
|
|
|
|
# * @return $this'
|
|
- name: concat
|
|
visibility: public
|
|
parameters:
|
|
- name: source
|
|
comment: '# * Push all of the given items onto the collection.
|
|
|
|
# *
|
|
|
|
# * @template TConcatKey of array-key
|
|
|
|
# * @template TConcatValue
|
|
|
|
# *
|
|
|
|
# * @param iterable<TConcatKey, TConcatValue> $source
|
|
|
|
# * @return static<TKey|TConcatKey, TValue|TConcatValue>'
|
|
- name: pull
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
- name: default
|
|
default: 'null'
|
|
comment: '# * Get and remove an item from the collection.
|
|
|
|
# *
|
|
|
|
# * @template TPullDefault
|
|
|
|
# *
|
|
|
|
# * @param TKey $key
|
|
|
|
# * @param TPullDefault|(\Closure(): TPullDefault) $default
|
|
|
|
# * @return TValue|TPullDefault'
|
|
- name: put
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
- name: value
|
|
comment: '# * Put an item in the collection by key.
|
|
|
|
# *
|
|
|
|
# * @param TKey $key
|
|
|
|
# * @param TValue $value
|
|
|
|
# * @return $this'
|
|
- name: random
|
|
visibility: public
|
|
parameters:
|
|
- name: number
|
|
default: 'null'
|
|
- name: preserveKeys
|
|
default: 'false'
|
|
comment: '# * Get one or a specified number of items randomly from the collection.
|
|
|
|
# *
|
|
|
|
# * @param (callable(self<TKey, TValue>): int)|int|null $number
|
|
|
|
# * @param bool $preserveKeys
|
|
|
|
# * @return static<int, TValue>|TValue
|
|
|
|
# *
|
|
|
|
# * @throws \InvalidArgumentException'
|
|
- name: replace
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
comment: '# * Replace the collection items with the given items.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey,
|
|
TValue> $items
|
|
|
|
# * @return static'
|
|
- name: replaceRecursive
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
comment: '# * Recursively replace the collection items with the given items.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey,
|
|
TValue> $items
|
|
|
|
# * @return static'
|
|
- name: reverse
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Reverse items order.
|
|
|
|
# *
|
|
|
|
# * @return static'
|
|
- name: search
|
|
visibility: public
|
|
parameters:
|
|
- name: value
|
|
- name: strict
|
|
default: 'false'
|
|
comment: '# * Search the collection for a given value and return the corresponding
|
|
key if successful.
|
|
|
|
# *
|
|
|
|
# * @param TValue|(callable(TValue,TKey): bool) $value
|
|
|
|
# * @param bool $strict
|
|
|
|
# * @return TKey|false'
|
|
- name: before
|
|
visibility: public
|
|
parameters:
|
|
- name: value
|
|
- name: strict
|
|
default: 'false'
|
|
comment: '# * Get the item before the given item.
|
|
|
|
# *
|
|
|
|
# * @param TValue|(callable(TValue,TKey): bool) $value
|
|
|
|
# * @param bool $strict
|
|
|
|
# * @return TValue|null'
|
|
- name: after
|
|
visibility: public
|
|
parameters:
|
|
- name: value
|
|
- name: strict
|
|
default: 'false'
|
|
comment: '# * Get the item after the given item.
|
|
|
|
# *
|
|
|
|
# * @param TValue|(callable(TValue,TKey): bool) $value
|
|
|
|
# * @param bool $strict
|
|
|
|
# * @return TValue|null'
|
|
- name: shift
|
|
visibility: public
|
|
parameters:
|
|
- name: count
|
|
default: '1'
|
|
comment: '# * Get and remove the first N items from the collection.
|
|
|
|
# *
|
|
|
|
# * @param int $count
|
|
|
|
# * @return static<int, TValue>|TValue|null
|
|
|
|
# *
|
|
|
|
# * @throws \InvalidArgumentException'
|
|
- name: shuffle
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Shuffle the items in the collection.
|
|
|
|
# *
|
|
|
|
# * @return static'
|
|
- name: sliding
|
|
visibility: public
|
|
parameters:
|
|
- name: size
|
|
default: '2'
|
|
- name: step
|
|
default: '1'
|
|
comment: '# * Create chunks representing a "sliding window" view of the items in
|
|
the collection.
|
|
|
|
# *
|
|
|
|
# * @param int $size
|
|
|
|
# * @param int $step
|
|
|
|
# * @return static<int, static>'
|
|
- name: skip
|
|
visibility: public
|
|
parameters:
|
|
- name: count
|
|
comment: '# * Skip the first {$count} items.
|
|
|
|
# *
|
|
|
|
# * @param int $count
|
|
|
|
# * @return static'
|
|
- name: skipUntil
|
|
visibility: public
|
|
parameters:
|
|
- name: value
|
|
comment: '# * Skip items in the collection until the given condition is met.
|
|
|
|
# *
|
|
|
|
# * @param TValue|callable(TValue,TKey): bool $value
|
|
|
|
# * @return static'
|
|
- name: skipWhile
|
|
visibility: public
|
|
parameters:
|
|
- name: value
|
|
comment: '# * Skip items in the collection while the given condition is met.
|
|
|
|
# *
|
|
|
|
# * @param TValue|callable(TValue,TKey): bool $value
|
|
|
|
# * @return static'
|
|
- name: slice
|
|
visibility: public
|
|
parameters:
|
|
- name: offset
|
|
- name: length
|
|
default: 'null'
|
|
comment: '# * Slice the underlying collection array.
|
|
|
|
# *
|
|
|
|
# * @param int $offset
|
|
|
|
# * @param int|null $length
|
|
|
|
# * @return static'
|
|
- name: split
|
|
visibility: public
|
|
parameters:
|
|
- name: numberOfGroups
|
|
comment: '# * Split a collection into a certain number of groups.
|
|
|
|
# *
|
|
|
|
# * @param int $numberOfGroups
|
|
|
|
# * @return static<int, static>'
|
|
- name: splitIn
|
|
visibility: public
|
|
parameters:
|
|
- name: numberOfGroups
|
|
comment: '# * Split a collection into a certain number of groups, and fill the first
|
|
groups completely.
|
|
|
|
# *
|
|
|
|
# * @param int $numberOfGroups
|
|
|
|
# * @return static<int, static>'
|
|
- name: sole
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
default: 'null'
|
|
- name: operator
|
|
default: 'null'
|
|
- name: value
|
|
default: 'null'
|
|
comment: '# * Get the first item in the collection, but only if exactly one item
|
|
exists. Otherwise, throw an exception.
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue, TKey): bool)|string $key
|
|
|
|
# * @param mixed $operator
|
|
|
|
# * @param mixed $value
|
|
|
|
# * @return TValue
|
|
|
|
# *
|
|
|
|
# * @throws \Illuminate\Support\ItemNotFoundException
|
|
|
|
# * @throws \Illuminate\Support\MultipleItemsFoundException'
|
|
- name: firstOrFail
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
default: 'null'
|
|
- name: operator
|
|
default: 'null'
|
|
- name: value
|
|
default: 'null'
|
|
comment: '# * Get the first item in the collection but throw an exception if no
|
|
matching items exist.
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue, TKey): bool)|string $key
|
|
|
|
# * @param mixed $operator
|
|
|
|
# * @param mixed $value
|
|
|
|
# * @return TValue
|
|
|
|
# *
|
|
|
|
# * @throws \Illuminate\Support\ItemNotFoundException'
|
|
- name: chunk
|
|
visibility: public
|
|
parameters:
|
|
- name: size
|
|
comment: '# * Chunk the collection into chunks of the given size.
|
|
|
|
# *
|
|
|
|
# * @param int $size
|
|
|
|
# * @return static<int, static>'
|
|
- name: chunkWhile
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
comment: '# * Chunk the collection into chunks with a callback.
|
|
|
|
# *
|
|
|
|
# * @param callable(TValue, TKey, static<int, TValue>): bool $callback
|
|
|
|
# * @return static<int, static<int, TValue>>'
|
|
- name: sort
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
default: 'null'
|
|
comment: '# * Sort through each item with a callback.
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue, TValue): int)|null|int $callback
|
|
|
|
# * @return static'
|
|
- name: sortDesc
|
|
visibility: public
|
|
parameters:
|
|
- name: options
|
|
default: SORT_REGULAR
|
|
comment: '# * Sort items in descending order.
|
|
|
|
# *
|
|
|
|
# * @param int $options
|
|
|
|
# * @return static'
|
|
- name: sortBy
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
- name: options
|
|
default: SORT_REGULAR
|
|
- name: descending
|
|
default: 'false'
|
|
comment: '# * Sort the collection using the given callback.
|
|
|
|
# *
|
|
|
|
# * @param array<array-key, (callable(TValue, TValue): mixed)|(callable(TValue,
|
|
TKey): mixed)|string|array{string, string}>|(callable(TValue, TKey): mixed)|string $callback
|
|
|
|
# * @param int $options
|
|
|
|
# * @param bool $descending
|
|
|
|
# * @return static'
|
|
- name: sortByMany
|
|
visibility: protected
|
|
parameters:
|
|
- name: comparisons
|
|
default: '[]'
|
|
- name: options
|
|
default: SORT_REGULAR
|
|
comment: '# * Sort the collection using multiple comparisons.
|
|
|
|
# *
|
|
|
|
# * @param array<array-key, (callable(TValue, TValue): mixed)|(callable(TValue,
|
|
TKey): mixed)|string|array{string, string}> $comparisons
|
|
|
|
# * @param int $options
|
|
|
|
# * @return static'
|
|
- name: sortByDesc
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
- name: options
|
|
default: SORT_REGULAR
|
|
comment: '# * Sort the collection in descending order using the given callback.
|
|
|
|
# *
|
|
|
|
# * @param array<array-key, (callable(TValue, TValue): mixed)|(callable(TValue,
|
|
TKey): mixed)|string|array{string, string}>|(callable(TValue, TKey): mixed)|string $callback
|
|
|
|
# * @param int $options
|
|
|
|
# * @return static'
|
|
- name: sortKeys
|
|
visibility: public
|
|
parameters:
|
|
- name: options
|
|
default: SORT_REGULAR
|
|
- name: descending
|
|
default: 'false'
|
|
comment: '# * Sort the collection keys.
|
|
|
|
# *
|
|
|
|
# * @param int $options
|
|
|
|
# * @param bool $descending
|
|
|
|
# * @return static'
|
|
- name: sortKeysDesc
|
|
visibility: public
|
|
parameters:
|
|
- name: options
|
|
default: SORT_REGULAR
|
|
comment: '# * Sort the collection keys in descending order.
|
|
|
|
# *
|
|
|
|
# * @param int $options
|
|
|
|
# * @return static'
|
|
- name: sortKeysUsing
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
comment: '# * Sort the collection keys using a callback.
|
|
|
|
# *
|
|
|
|
# * @param callable(TKey, TKey): int $callback
|
|
|
|
# * @return static'
|
|
- name: splice
|
|
visibility: public
|
|
parameters:
|
|
- name: offset
|
|
- name: length
|
|
default: 'null'
|
|
- name: replacement
|
|
default: '[]'
|
|
comment: '# * Splice a portion of the underlying collection array.
|
|
|
|
# *
|
|
|
|
# * @param int $offset
|
|
|
|
# * @param int|null $length
|
|
|
|
# * @param array<array-key, TValue> $replacement
|
|
|
|
# * @return static'
|
|
- name: take
|
|
visibility: public
|
|
parameters:
|
|
- name: limit
|
|
comment: '# * Take the first or last {$limit} items.
|
|
|
|
# *
|
|
|
|
# * @param int $limit
|
|
|
|
# * @return static'
|
|
- name: takeUntil
|
|
visibility: public
|
|
parameters:
|
|
- name: value
|
|
comment: '# * Take items in the collection until the given condition is met.
|
|
|
|
# *
|
|
|
|
# * @param TValue|callable(TValue,TKey): bool $value
|
|
|
|
# * @return static'
|
|
- name: takeWhile
|
|
visibility: public
|
|
parameters:
|
|
- name: value
|
|
comment: '# * Take items in the collection while the given condition is met.
|
|
|
|
# *
|
|
|
|
# * @param TValue|callable(TValue,TKey): bool $value
|
|
|
|
# * @return static'
|
|
- name: transform
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
comment: '# * Transform each item in the collection using a callback.
|
|
|
|
# *
|
|
|
|
# * @param callable(TValue, TKey): TValue $callback
|
|
|
|
# * @return $this'
|
|
- name: dot
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Flatten a multi-dimensional associative array with dots.
|
|
|
|
# *
|
|
|
|
# * @return static'
|
|
- name: undot
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Convert a flatten "dot" notation array into an expanded array.
|
|
|
|
# *
|
|
|
|
# * @return static'
|
|
- name: unique
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
default: 'null'
|
|
- name: strict
|
|
default: 'false'
|
|
comment: '# * Return only unique items from the collection array.
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue, TKey): mixed)|string|null $key
|
|
|
|
# * @param bool $strict
|
|
|
|
# * @return static'
|
|
- name: values
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Reset the keys on the underlying array.
|
|
|
|
# *
|
|
|
|
# * @return static<int, TValue>'
|
|
- name: zip
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
comment: '# * Zip the collection together with one or more arrays.
|
|
|
|
# *
|
|
|
|
# * e.g. new Collection([1, 2, 3])->zip([4, 5, 6]);
|
|
|
|
# * => [[1, 4], [2, 5], [3, 6]]
|
|
|
|
# *
|
|
|
|
# * @template TZipValue
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<array-key, TZipValue>|iterable<array-key,
|
|
TZipValue> ...$items
|
|
|
|
# * @return static<int, static<int, TValue|TZipValue>>'
|
|
- name: pad
|
|
visibility: public
|
|
parameters:
|
|
- name: size
|
|
- name: value
|
|
comment: '# * Pad collection to the specified length with a value.
|
|
|
|
# *
|
|
|
|
# * @template TPadValue
|
|
|
|
# *
|
|
|
|
# * @param int $size
|
|
|
|
# * @param TPadValue $value
|
|
|
|
# * @return static<int, TValue|TPadValue>'
|
|
- name: getIterator
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Get an iterator for the items.
|
|
|
|
# *
|
|
|
|
# * @return \ArrayIterator<TKey, TValue>'
|
|
- name: count
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Count the number of items in the collection.
|
|
|
|
# *
|
|
|
|
# * @return int'
|
|
- name: countBy
|
|
visibility: public
|
|
parameters:
|
|
- name: countBy
|
|
default: 'null'
|
|
comment: '# * Count the number of items in the collection by a field or using a
|
|
callback.
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue, TKey): array-key)|string|null $countBy
|
|
|
|
# * @return static<array-key, int>'
|
|
- name: add
|
|
visibility: public
|
|
parameters:
|
|
- name: item
|
|
comment: '# * Add an item to the collection.
|
|
|
|
# *
|
|
|
|
# * @param TValue $item
|
|
|
|
# * @return $this'
|
|
- name: toBase
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Get a base Support collection instance from this collection.
|
|
|
|
# *
|
|
|
|
# * @return \Illuminate\Support\Collection<TKey, TValue>'
|
|
- name: offsetExists
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
comment: '# * Determine if an item exists at an offset.
|
|
|
|
# *
|
|
|
|
# * @param TKey $key
|
|
|
|
# * @return bool'
|
|
- name: offsetGet
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
comment: '# * Get an item at a given offset.
|
|
|
|
# *
|
|
|
|
# * @param TKey $key
|
|
|
|
# * @return TValue'
|
|
- name: offsetSet
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
- name: value
|
|
comment: '# * Set the item at a given offset.
|
|
|
|
# *
|
|
|
|
# * @param TKey|null $key
|
|
|
|
# * @param TValue $value
|
|
|
|
# * @return void'
|
|
- name: offsetUnset
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
comment: '# * Unset the item at a given offset.
|
|
|
|
# *
|
|
|
|
# * @param TKey $key
|
|
|
|
# * @return void'
|
|
traits:
|
|
- ArrayAccess
|
|
- ArrayIterator
|
|
- Illuminate\Contracts\Support\CanBeEscapedWhenCastToString
|
|
- Illuminate\Support\Traits\EnumeratesValues
|
|
- Illuminate\Support\Traits\Macroable
|
|
- InvalidArgumentException
|
|
- stdClass
|
|
- Traversable
|
|
- EnumeratesValues
|
|
interfaces:
|
|
- \ArrayAccess
|
|
- \Illuminate\Support\Enumerable
|
|
- ArrayAccess
|