platform/api/laravel/Collections/Enumerable.yaml

2076 lines
42 KiB
YAML
Raw Normal View History

2024-09-02 17:44:11 +00:00
name: Enumerable
class_comment: null
dependencies:
- name: CachingIterator
type: class
source: CachingIterator
- name: Countable
type: class
source: Countable
- name: Arrayable
type: class
source: Illuminate\Contracts\Support\Arrayable
- name: Jsonable
type: class
source: Illuminate\Contracts\Support\Jsonable
- name: IteratorAggregate
type: class
source: IteratorAggregate
- name: JsonSerializable
type: class
source: JsonSerializable
- name: Traversable
type: class
source: Traversable
properties: []
methods:
- name: make
visibility: public
parameters:
- name: items
default: '[]'
comment: '# * @template TKey of array-key
# *
# * @template-covariant TValue
# *
# * @extends \Illuminate\Contracts\Support\Arrayable<TKey, TValue>
# * @extends \IteratorAggregate<TKey, TValue>
# */
# interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
JsonSerializable
# {
# /**
# * Create a new collection instance if the value isn''t one already.
# *
# * @template TMakeKey of array-key
# * @template TMakeValue
# *
# * @param \Illuminate\Contracts\Support\Arrayable<TMakeKey, TMakeValue>|iterable<TMakeKey,
TMakeValue>|null $items
# * @return static<TMakeKey, TMakeValue>'
- name: times
visibility: public
parameters:
- name: number
- name: callback
default: 'null'
comment: '# * Create a new instance by invoking the callback a given amount of times.
# *
# * @param int $number
# * @param callable|null $callback
# * @return static'
- 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'
- name: wrap
visibility: public
parameters:
- name: value
comment: '# * Wrap the given value in a collection if applicable.
# *
# * @template TWrapValue
# *
# * @param iterable<array-key, TWrapValue>|TWrapValue $value
# * @return static<array-key, TWrapValue>'
- name: unwrap
visibility: public
parameters:
- name: value
comment: '# * Get the underlying items from the given collection if applicable.
# *
# * @template TUnwrapKey of array-key
# * @template TUnwrapValue
# *
# * @param array<TUnwrapKey, TUnwrapValue>|static<TUnwrapKey, TUnwrapValue> $value
# * @return array<TUnwrapKey, TUnwrapValue>'
- name: empty
visibility: public
parameters: []
comment: '# * Create a new instance with no items.
# *
# * @return static'
- name: all
visibility: public
parameters: []
comment: '# * Get all items in the enumerable.
# *
# * @return array'
- name: average
visibility: public
parameters:
- name: callback
default: 'null'
comment: '# * Alias for the "avg" method.
# *
# * @param (callable(TValue): float|int)|string|null $callback
# * @return float|int|null'
- 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 items into a single enumerable.
# *
# * @return static<int, mixed>'
- name: some
visibility: public
parameters:
- name: key
- name: operator
default: 'null'
- name: value
default: 'null'
comment: '# * Alias for the "contains" method.
# *
# * @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: avg
visibility: public
parameters:
- name: callback
default: 'null'
comment: '# * Get the average value of a given key.
# *
# * @param (callable(TValue): float|int)|string|null $callback
# * @return float|int|null'
- name: contains
visibility: public
parameters:
- name: key
- name: operator
default: 'null'
- name: value
default: 'null'
comment: '# * Determine if an item exists in the enumerable.
# *
# * @param (callable(TValue, TKey): bool)|TValue|string $key
# * @param mixed $operator
# * @param mixed $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: dd
visibility: public
parameters:
- name: '...$args'
comment: '# * Dump the collection and end the script.
# *
# * @param mixed ...$args
# * @return never'
- name: dump
visibility: public
parameters:
- name: '...$args'
comment: '# * Dump the collection.
# *
# * @param mixed ...$args
# * @return $this'
- name: diff
visibility: public
parameters:
- name: items
comment: '# * Get the items 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 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 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 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 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 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.
# *
# * @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 using strict comparison.
# *
# * @param (callable(TValue): bool)|string|null $callback
# * @return static'
- name: each
visibility: public
parameters:
- name: callback
comment: '# * Execute a callback over each item.
# *
# * @param callable(TValue, TKey): mixed $callback
# * @return $this'
- name: eachSpread
visibility: public
parameters:
- name: callback
comment: '# * Execute a callback over each nested chunk of items.
# *
# * @param callable $callback
# * @return static'
- name: every
visibility: public
parameters:
- name: key
- name: operator
default: 'null'
- name: value
default: 'null'
comment: '# * Determine if all items pass the given truth test.
# *
# * @param (callable(TValue, TKey): bool)|TValue|string $key
# * @param mixed $operator
# * @param mixed $value
# * @return 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> $keys
# * @return static'
- name: filter
visibility: public
parameters:
- name: callback
default: 'null'
comment: '# * Run a filter over each of the items.
# *
# * @param (callable(TValue): bool)|null $callback
# * @return static'
- name: when
visibility: public
parameters:
- name: value
- name: callback
default: 'null'
- name: default
default: 'null'
comment: '# * Apply the callback if the given "value" is (or resolves to) truthy.
# *
# * @template TWhenReturnType as null
# *
# * @param bool $value
# * @param (callable($this): TWhenReturnType)|null $callback
# * @param (callable($this): TWhenReturnType)|null $default
# * @return $this|TWhenReturnType'
- name: whenEmpty
visibility: public
parameters:
- name: callback
- name: default
default: 'null'
comment: '# * Apply the callback if the collection is empty.
# *
# * @template TWhenEmptyReturnType
# *
# * @param (callable($this): TWhenEmptyReturnType) $callback
# * @param (callable($this): TWhenEmptyReturnType)|null $default
# * @return $this|TWhenEmptyReturnType'
- name: whenNotEmpty
visibility: public
parameters:
- name: callback
- name: default
default: 'null'
comment: '# * Apply the callback if the collection is not empty.
# *
# * @template TWhenNotEmptyReturnType
# *
# * @param callable($this): TWhenNotEmptyReturnType $callback
# * @param (callable($this): TWhenNotEmptyReturnType)|null $default
# * @return $this|TWhenNotEmptyReturnType'
- name: unless
visibility: public
parameters:
- name: value
- name: callback
- name: default
default: 'null'
comment: '# * Apply the callback if the given "value" is (or resolves to) truthy.
# *
# * @template TUnlessReturnType
# *
# * @param bool $value
# * @param (callable($this): TUnlessReturnType) $callback
# * @param (callable($this): TUnlessReturnType)|null $default
# * @return $this|TUnlessReturnType'
- name: unlessEmpty
visibility: public
parameters:
- name: callback
- name: default
default: 'null'
comment: '# * Apply the callback unless the collection is empty.
# *
# * @template TUnlessEmptyReturnType
# *
# * @param callable($this): TUnlessEmptyReturnType $callback
# * @param (callable($this): TUnlessEmptyReturnType)|null $default
# * @return $this|TUnlessEmptyReturnType'
- name: unlessNotEmpty
visibility: public
parameters:
- name: callback
- name: default
default: 'null'
comment: '# * Apply the callback unless the collection is not empty.
# *
# * @template TUnlessNotEmptyReturnType
# *
# * @param callable($this): TUnlessNotEmptyReturnType $callback
# * @param (callable($this): TUnlessNotEmptyReturnType)|null $default
# * @return $this|TUnlessNotEmptyReturnType'
- name: where
visibility: public
parameters:
- name: key
- name: operator
default: 'null'
- name: value
default: 'null'
comment: '# * Filter items by the given key value pair.
# *
# * @param string $key
# * @param mixed $operator
# * @param mixed $value
# * @return static'
- name: whereNull
visibility: public
parameters:
- name: key
default: 'null'
comment: '# * Filter items where the value for the given key is null.
# *
# * @param string|null $key
# * @return static'
- name: whereNotNull
visibility: public
parameters:
- name: key
default: 'null'
comment: '# * Filter items where the value for the given key is not null.
# *
# * @param string|null $key
# * @return static'
- name: whereStrict
visibility: public
parameters:
- name: key
- name: value
comment: '# * Filter items by the given key value pair using strict comparison.
# *
# * @param string $key
# * @param mixed $value
# * @return static'
- name: whereIn
visibility: public
parameters:
- name: key
- name: values
- name: strict
default: 'false'
comment: '# * Filter items by the given key value pair.
# *
# * @param string $key
# * @param \Illuminate\Contracts\Support\Arrayable|iterable $values
# * @param bool $strict
# * @return static'
- name: whereInStrict
visibility: public
parameters:
- name: key
- name: values
comment: '# * Filter items by the given key value pair using strict comparison.
# *
# * @param string $key
# * @param \Illuminate\Contracts\Support\Arrayable|iterable $values
# * @return static'
- name: whereBetween
visibility: public
parameters:
- name: key
- name: values
comment: '# * Filter items such that the value of the given key is between the given
values.
# *
# * @param string $key
# * @param \Illuminate\Contracts\Support\Arrayable|iterable $values
# * @return static'
- name: whereNotBetween
visibility: public
parameters:
- name: key
- name: values
comment: '# * Filter items such that the value of the given key is not between the
given values.
# *
# * @param string $key
# * @param \Illuminate\Contracts\Support\Arrayable|iterable $values
# * @return static'
- name: whereNotIn
visibility: public
parameters:
- name: key
- name: values
- name: strict
default: 'false'
comment: '# * Filter items by the given key value pair.
# *
# * @param string $key
# * @param \Illuminate\Contracts\Support\Arrayable|iterable $values
# * @param bool $strict
# * @return static'
- name: whereNotInStrict
visibility: public
parameters:
- name: key
- name: values
comment: '# * Filter items by the given key value pair using strict comparison.
# *
# * @param string $key
# * @param \Illuminate\Contracts\Support\Arrayable|iterable $values
# * @return static'
- name: whereInstanceOf
visibility: public
parameters:
- name: type
comment: '# * Filter the items, removing any items that don''t match the given type(s).
# *
# * @template TWhereInstanceOf
# *
# * @param class-string<TWhereInstanceOf>|array<array-key, class-string<TWhereInstanceOf>> $type
# * @return static<TKey, TWhereInstanceOf>'
- name: first
visibility: public
parameters:
- name: callback
default: 'null'
- name: default
default: 'null'
comment: '# * Get the first item from the enumerable passing the given truth test.
# *
# * @template TFirstDefault
# *
# * @param (callable(TValue,TKey): bool)|null $callback
# * @param TFirstDefault|(\Closure(): TFirstDefault) $default
# * @return TValue|TFirstDefault'
- name: firstWhere
visibility: public
parameters:
- name: key
- name: operator
default: 'null'
- name: value
default: 'null'
comment: '# * Get the first item by the given key value pair.
# *
# * @param string $key
# * @param mixed $operator
# * @param mixed $value
# * @return TValue|null'
- 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'
- name: flip
visibility: public
parameters: []
comment: '# * Flip the values with their keys.
# *
# * @return static<TValue, TKey>'
- 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: 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.
# *
# * @return bool'
- name: isNotEmpty
visibility: public
parameters: []
comment: '# * Determine if the collection is not empty.
# *
# * @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: 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: mapSpread
visibility: public
parameters:
- name: callback
comment: '# * Run a map over each nested chunk of items.
# *
# * @param callable $callback
# * @return static'
- 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: mapToGroups
visibility: public
parameters:
- name: callback
comment: '# * Run a grouping map over the items.
# *
# * The callback should return an associative array with a single key/value pair.
# *
# * @template TMapToGroupsKey of array-key
# * @template TMapToGroupsValue
# *
# * @param callable(TValue, TKey): array<TMapToGroupsKey, TMapToGroupsValue> $callback
# * @return static<TMapToGroupsKey, static<int, TMapToGroupsValue>>'
- 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: flatMap
visibility: public
parameters:
- name: callback
comment: '# * Map a collection and flatten the result by a single level.
# *
# * @template TFlatMapKey of array-key
# * @template TFlatMapValue
# *
# * @param callable(TValue, TKey): (\Illuminate\Support\Collection<TFlatMapKey,
TFlatMapValue>|array<TFlatMapKey, TFlatMapValue>) $callback
# * @return static<TFlatMapKey, TFlatMapValue>'
- name: mapInto
visibility: public
parameters:
- name: class
comment: '# * Map the values into a new class.
# *
# * @template TMapIntoValue
# *
# * @param class-string<TMapIntoValue> $class
# * @return static<TKey, TMapIntoValue>'
- 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: 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: min
visibility: public
parameters:
- name: callback
default: 'null'
comment: '# * Get the min value of a given key.
# *
# * @param (callable(TValue):mixed)|string|null $callback
# * @return mixed'
- name: max
visibility: public
parameters:
- name: callback
default: 'null'
comment: '# * Get the max value of a given key.
# *
# * @param (callable(TValue):mixed)|string|null $callback
# * @return mixed'
- 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 $keys
# * @return static'
- name: forPage
visibility: public
parameters:
- name: page
- name: perPage
comment: '# * "Paginate" the collection by slicing it into a smaller collection.
# *
# * @param int $page
# * @param int $perPage
# * @return static'
- name: partition
visibility: public
parameters:
- name: key
- name: operator
default: 'null'
- name: value
default: 'null'
comment: '# * Partition the collection into two arrays using the given callback
or key.
# *
# * @param (callable(TValue, TKey): bool)|TValue|string $key
# * @param mixed $operator
# * @param mixed $value
# * @return static<int<0, 1>, static<TKey, TValue>>'
- 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: random
visibility: public
parameters:
- name: number
default: 'null'
comment: '# * Get one or a specified number of items randomly from the collection.
# *
# * @param int|null $number
# * @return static<int, TValue>|TValue
# *
# * @throws \InvalidArgumentException'
- name: reduce
visibility: public
parameters:
- name: callback
- name: initial
default: 'null'
comment: '# * Reduce the collection to a single value.
# *
# * @template TReduceInitial
# * @template TReduceReturnType
# *
# * @param callable(TReduceInitial|TReduceReturnType, TValue, TKey): TReduceReturnType $callback
# * @param TReduceInitial $initial
# * @return TReduceReturnType'
- name: reduceSpread
visibility: public
parameters:
- name: callback
- name: '...$initial'
comment: '# * Reduce the collection to multiple aggregate values.
# *
# * @param callable $callback
# * @param mixed ...$initial
# * @return array
# *
# * @throws \UnexpectedValueException'
- 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|bool'
- 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: 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: '# * Get a slice of items from the enumerable.
# *
# * @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: 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: 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: 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: 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: sum
visibility: public
parameters:
- name: callback
default: 'null'
comment: '# * Get the sum of the given values.
# *
# * @param (callable(TValue): mixed)|string|null $callback
# * @return mixed'
- 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: tap
visibility: public
parameters:
- name: callback
comment: '# * Pass the collection to the given callback and then return it.
# *
# * @param callable(TValue): mixed $callback
# * @return $this'
- name: pipe
visibility: public
parameters:
- name: callback
comment: '# * Pass the enumerable to the given callback and return the result.
# *
# * @template TPipeReturnType
# *
# * @param callable($this): TPipeReturnType $callback
# * @return TPipeReturnType'
- name: pipeInto
visibility: public
parameters:
- name: class
comment: '# * Pass the collection into a new class.
# *
# * @template TPipeIntoValue
# *
# * @param class-string<TPipeIntoValue> $class
# * @return TPipeIntoValue'
- name: pipeThrough
visibility: public
parameters:
- name: pipes
comment: '# * Pass the collection through a series of callable pipes and return
the result.
# *
# * @param array<callable> $pipes
# * @return mixed'
- name: pluck
visibility: public
parameters:
- name: value
- name: key
default: 'null'
comment: '# * Get the values of a given key.
# *
# * @param string|array<array-key, string> $value
# * @param string|null $key
# * @return static<int, mixed>'
- name: reject
visibility: public
parameters:
- name: callback
default: 'true'
comment: '# * Create a collection of all elements that do not pass a given truth
test.
# *
# * @param (callable(TValue, TKey): bool)|bool|TValue $callback
# * @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: uniqueStrict
visibility: public
parameters:
- name: key
default: 'null'
comment: '# * Return only unique items from the collection array using strict comparison.
# *
# * @param (callable(TValue, TKey): mixed)|string|null $key
# * @return static'
- name: values
visibility: public
parameters: []
comment: '# * Reset the keys on the underlying array.
# *
# * @return static<int, TValue>'
- 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 the values iterator.
# *
# * @return \Traversable<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: 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: collect
visibility: public
parameters: []
comment: '# * Collect the values into a collection.
# *
# * @return \Illuminate\Support\Collection<TKey, TValue>'
- name: toArray
visibility: public
parameters: []
comment: '# * Get the collection of items as a plain array.
# *
# * @return array<TKey, mixed>'
- name: jsonSerialize
visibility: public
parameters: []
comment: '# * Convert the object into something JSON serializable.
# *
# * @return mixed'
- name: toJson
visibility: public
parameters:
- name: options
default: '0'
comment: '# * Get the collection of items as JSON.
# *
# * @param int $options
# * @return string'
- name: getCachingIterator
visibility: public
parameters:
- name: flags
default: CachingIterator::CALL_TOSTRING
comment: '# * Get a CachingIterator instance.
# *
# * @param int $flags
# * @return \CachingIterator'
- name: __toString
visibility: public
parameters: []
comment: '# * Convert the collection to its string representation.
# *
# * @return string'
- name: escapeWhenCastingToString
visibility: public
parameters:
- name: escape
default: 'true'
comment: '# * Indicate that the model''s string representation should be escaped
when __toString is invoked.
# *
# * @param bool $escape
# * @return $this'
- name: proxy
visibility: public
parameters:
- name: method
comment: '# * Add a method to the list of proxied methods.
# *
# * @param string $method
# * @return void'
- name: __get
visibility: public
parameters:
- name: key
comment: '# * Dynamically access collection proxies.
# *
# * @param string $key
# * @return mixed
# *
# * @throws \Exception'
traits:
- CachingIterator
- Countable
- Illuminate\Contracts\Support\Arrayable
- Illuminate\Contracts\Support\Jsonable
- IteratorAggregate
- JsonSerializable
- Traversable
interfaces: []