1425 lines
33 KiB
YAML
1425 lines
33 KiB
YAML
name: LazyCollection
|
|
class_comment: '# * @template TKey of array-key
|
|
|
|
# *
|
|
|
|
# * @template-covariant TValue
|
|
|
|
# *
|
|
|
|
# * @implements \Illuminate\Support\Enumerable<TKey, TValue>'
|
|
dependencies:
|
|
- name: ArrayIterator
|
|
type: class
|
|
source: ArrayIterator
|
|
- name: Closure
|
|
type: class
|
|
source: Closure
|
|
- name: DateTimeInterface
|
|
type: class
|
|
source: DateTimeInterface
|
|
- name: Generator
|
|
type: class
|
|
source: Generator
|
|
- 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: IteratorAggregate
|
|
type: class
|
|
source: IteratorAggregate
|
|
- name: stdClass
|
|
type: class
|
|
source: stdClass
|
|
- name: Traversable
|
|
type: class
|
|
source: Traversable
|
|
properties:
|
|
- name: source
|
|
visibility: public
|
|
comment: "# * @template TKey of array-key\n# *\n# * @template-covariant TValue\n\
|
|
# *\n# * @implements \\Illuminate\\Support\\Enumerable<TKey, TValue>\n# */\n#\
|
|
\ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable\n#\
|
|
\ {\n# /**\n# * @use \\Illuminate\\Support\\Traits\\EnumeratesValues<TKey, TValue>\n\
|
|
# */\n# use EnumeratesValues, Macroable;\n# \n# /**\n# * The source from which\
|
|
\ to generate items.\n# *\n# * @var (Closure(): \\Generator<TKey, TValue, mixed,\
|
|
\ void>)|static|array<TKey, TValue>"
|
|
methods:
|
|
- name: __construct
|
|
visibility: public
|
|
parameters:
|
|
- name: source
|
|
default: 'null'
|
|
comment: "# * @template TKey of array-key\n# *\n# * @template-covariant TValue\n\
|
|
# *\n# * @implements \\Illuminate\\Support\\Enumerable<TKey, TValue>\n# */\n#\
|
|
\ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable\n#\
|
|
\ {\n# /**\n# * @use \\Illuminate\\Support\\Traits\\EnumeratesValues<TKey, TValue>\n\
|
|
# */\n# use EnumeratesValues, Macroable;\n# \n# /**\n# * The source from which\
|
|
\ to generate items.\n# *\n# * @var (Closure(): \\Generator<TKey, TValue, mixed,\
|
|
\ void>)|static|array<TKey, TValue>\n# */\n# public $source;\n# \n# /**\n# * Create\
|
|
\ a new lazy collection instance.\n# *\n# * @param \\Illuminate\\Contracts\\\
|
|
Support\\Arrayable<TKey, TValue>|iterable<TKey, TValue>|(Closure(): \\Generator<TKey,\
|
|
\ TValue, mixed, void>)|self<TKey, TValue>|array<TKey, TValue>|null $source\n\
|
|
# * @return void"
|
|
- name: make
|
|
visibility: public
|
|
parameters:
|
|
- name: items
|
|
default: '[]'
|
|
comment: '# * 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>|(Closure(): \Generator<TMakeKey, TMakeValue, mixed, void>)|self<TMakeKey,
|
|
TMakeValue>|array<TMakeKey, TMakeValue>|null $items
|
|
|
|
# * @return static<TMakeKey, TMakeValue>'
|
|
- 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 items in the enumerable.
|
|
|
|
# *
|
|
|
|
# * @return array<TKey, TValue>'
|
|
- name: eager
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Eager load all items into a new lazy collection backed by an array.
|
|
|
|
# *
|
|
|
|
# * @return static'
|
|
- name: remember
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Cache values as they''re enumerated.
|
|
|
|
# *
|
|
|
|
# * @return static'
|
|
- 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<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 enumerable.
|
|
|
|
# *
|
|
|
|
# * @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: "# @var callable $key */\n# return $this->first($key, $placeholder) !==\
|
|
\ $placeholder;\n# }\n# \n# if (func_num_args() === 1) {\n# $needle = $key;\n\
|
|
# \n# foreach ($this as $value) {\n# if ($value == $needle) {\n# return true;\n\
|
|
# }\n# }\n# \n# return false;\n# }\n# \n# return $this->contains($this->operatorForWhere(...func_get_args()));\n\
|
|
# }\n# \n# /**\n# * Determine if an item exists, using strict comparison.\n# *\n\
|
|
# * @param (callable(TValue): bool)|TValue|array-key $key\n# * @param TValue|null\
|
|
\ $value\n# * @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 enumerable.
|
|
|
|
# *
|
|
|
|
# * @param mixed $key
|
|
|
|
# * @param mixed $operator
|
|
|
|
# * @param mixed $value
|
|
|
|
# * @return bool'
|
|
- name: crossJoin
|
|
visibility: public
|
|
parameters:
|
|
- name: '...$arrays'
|
|
comment: '# * Cross join the given iterables, returning all possible permutations.
|
|
|
|
# *
|
|
|
|
# * @template TCrossJoinKey
|
|
|
|
# * @template TCrossJoinValue
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Support\Arrayable<TCrossJoinKey, TCrossJoinValue>|iterable<TCrossJoinKey,
|
|
TCrossJoinValue> ...$arrays
|
|
|
|
# * @return static<int, array<int, TValue|TCrossJoinValue>>'
|
|
- 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: 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: 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, 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 enumerable passing the given truth test.
|
|
|
|
# *
|
|
|
|
# * @template TFirstDefault
|
|
|
|
# *
|
|
|
|
# * @param (callable(TValue): bool)|null $callback
|
|
|
|
# * @param TFirstDefault|(\Closure(): TFirstDefault) $default
|
|
|
|
# * @return TValue|TFirstDefault'
|
|
- name: flatten
|
|
visibility: public
|
|
parameters:
|
|
- name: depth
|
|
default: INF
|
|
comment: '# * Get a flattened list 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: get
|
|
visibility: public
|
|
parameters:
|
|
- name: key
|
|
- name: default
|
|
default: 'null'
|
|
comment: '# * Get an item by key.
|
|
|
|
# *
|
|
|
|
# * @template TGetDefault
|
|
|
|
# *
|
|
|
|
# * @param TKey|null $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 mixed $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 items are empty or not.
|
|
|
|
# *
|
|
|
|
# * @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|array<array-key, string> $value
|
|
|
|
# * @param string|null $key
|
|
|
|
# * @return static<int, 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 \IteratorAggregate<array-key, TCombineValue>|array<array-key, TCombineValue>|(callable():
|
|
\Generator<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 $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 $keys
|
|
|
|
# * @return static'
|
|
- 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: 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: "# @var (callable(TValue,TKey): bool) $predicate */\n# $predicate = $this->useAsCallable($value)\n\
|
|
# ? $value\n# : function ($item) use ($value, $strict) {\n# return $strict ? $item\
|
|
\ === $value : $item == $value;\n# };\n# \n# foreach ($this as $key => $item)\
|
|
\ {\n# if ($predicate($item, $key)) {\n# return $key;\n# }\n# }\n# \n# return\
|
|
\ false;\n# }\n# \n# /**\n# * Get the item before the given item.\n# *\n# * @param\
|
|
\ TValue|(callable(TValue,TKey): bool) $value\n# * @param bool $strict\n#\
|
|
\ * @return TValue|null"
|
|
- name: after
|
|
visibility: public
|
|
parameters:
|
|
- name: value
|
|
- name: strict
|
|
default: 'false'
|
|
comment: "# @var (callable(TValue,TKey): bool) $predicate */\n# $predicate = $this->useAsCallable($value)\n\
|
|
# ? $value\n# : function ($item) use ($value, $strict) {\n# return $strict ? $item\
|
|
\ === $value : $item == $value;\n# };\n# \n# foreach ($this as $key => $item)\
|
|
\ {\n# if ($predicate($item, $key)) {\n# return $previous;\n# }\n# \n# $previous\
|
|
\ = $item;\n# }\n# \n# return null;\n# }\n# \n# /**\n# * Get the item after the\
|
|
\ given item.\n# *\n# * @param TValue|(callable(TValue,TKey): bool) $value\n\
|
|
# * @param bool $strict\n# * @return TValue|null"
|
|
- name: shuffle
|
|
visibility: public
|
|
parameters: []
|
|
comment: "# @var (callable(TValue,TKey): bool) $predicate */\n# $predicate = $this->useAsCallable($value)\n\
|
|
# ? $value\n# : function ($item) use ($value, $strict) {\n# return $strict ? $item\
|
|
\ === $value : $item == $value;\n# };\n# \n# foreach ($this as $key => $item)\
|
|
\ {\n# if ($found) {\n# return $item;\n# }\n# \n# if ($predicate($item, $key))\
|
|
\ {\n# $found = true;\n# }\n# }\n# \n# return null;\n# }\n# \n# /**\n# * Shuffle\
|
|
\ the items in the collection.\n# *\n# * @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: 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: chunkWhile
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
comment: '# * Chunk the collection into chunks with a callback.
|
|
|
|
# *
|
|
|
|
# * @param callable(TValue, TKey, Collection<TKey, 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: 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: 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: takeUntilTimeout
|
|
visibility: public
|
|
parameters:
|
|
- name: timeout
|
|
comment: "# @var callable(TValue, TKey): bool $callback */\n# $callback = $this->useAsCallable($value)\
|
|
\ ? $value : $this->equality($value);\n# \n# return new static(function () use\
|
|
\ ($callback) {\n# foreach ($this as $key => $item) {\n# if ($callback($item,\
|
|
\ $key)) {\n# break;\n# }\n# \n# yield $key => $item;\n# }\n# });\n# }\n# \n#\
|
|
\ /**\n# * Take items in the collection until a given point in time.\n# *\n# *\
|
|
\ @param \\DateTimeInterface $timeout\n# * @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: tapEach
|
|
visibility: public
|
|
parameters:
|
|
- name: callback
|
|
comment: "# @var callable(TValue, TKey): bool $callback */\n# $callback = $this->useAsCallable($value)\
|
|
\ ? $value : $this->equality($value);\n# \n# return $this->takeUntil(fn ($item,\
|
|
\ $key) => ! $callback($item, $key));\n# }\n# \n# /**\n# * Pass each item in the\
|
|
\ collection to the given callback, lazily.\n# *\n# * @param callable(TValue,\
|
|
\ TKey): mixed $callback\n# * @return static"
|
|
- name: throttle
|
|
visibility: public
|
|
parameters:
|
|
- name: seconds
|
|
comment: '# * Throttle the values, releasing them at most once per the given seconds.
|
|
|
|
# *
|
|
|
|
# * @return static<TKey, TValue>'
|
|
- 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 LazyCollection([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 the values iterator.
|
|
|
|
# *
|
|
|
|
# * @return \Traversable<TKey, TValue>'
|
|
- name: count
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Count the number of items in the collection.
|
|
|
|
# *
|
|
|
|
# * @return int'
|
|
- name: makeIterator
|
|
visibility: protected
|
|
parameters:
|
|
- name: source
|
|
comment: '# * Make an iterator from the given source.
|
|
|
|
# *
|
|
|
|
# * @template TIteratorKey of array-key
|
|
|
|
# * @template TIteratorValue
|
|
|
|
# *
|
|
|
|
# * @param \IteratorAggregate<TIteratorKey, TIteratorValue>|array<TIteratorKey,
|
|
TIteratorValue>|(callable(): \Generator<TIteratorKey, TIteratorValue>) $source
|
|
|
|
# * @return \Traversable<TIteratorKey, TIteratorValue>'
|
|
- name: explodePluckParameters
|
|
visibility: protected
|
|
parameters:
|
|
- name: value
|
|
- name: key
|
|
comment: '# * Explode the "value" and "key" arguments passed to "pluck".
|
|
|
|
# *
|
|
|
|
# * @param string|string[] $value
|
|
|
|
# * @param string|string[]|null $key
|
|
|
|
# * @return array{string[],string[]|null}'
|
|
- name: passthru
|
|
visibility: protected
|
|
parameters:
|
|
- name: method
|
|
- name: params
|
|
comment: '# * Pass this lazy collection through a method on the collection class.
|
|
|
|
# *
|
|
|
|
# * @param string $method
|
|
|
|
# * @param array<mixed> $params
|
|
|
|
# * @return static'
|
|
- name: now
|
|
visibility: protected
|
|
parameters: []
|
|
comment: '# * Get the current time.
|
|
|
|
# *
|
|
|
|
# * @return int'
|
|
- name: preciseNow
|
|
visibility: protected
|
|
parameters: []
|
|
comment: '# * Get the precise current time.
|
|
|
|
# *
|
|
|
|
# * @return float'
|
|
- name: usleep
|
|
visibility: protected
|
|
parameters:
|
|
- name: microseconds
|
|
comment: '# * Sleep for the given amount of microseconds.
|
|
|
|
# *
|
|
|
|
# * @return void'
|
|
traits:
|
|
- ArrayIterator
|
|
- Closure
|
|
- DateTimeInterface
|
|
- Generator
|
|
- Illuminate\Contracts\Support\CanBeEscapedWhenCastToString
|
|
- Illuminate\Support\Traits\EnumeratesValues
|
|
- Illuminate\Support\Traits\Macroable
|
|
- InvalidArgumentException
|
|
- IteratorAggregate
|
|
- stdClass
|
|
- Traversable
|
|
- EnumeratesValues
|
|
interfaces:
|
|
- \Illuminate\Support\Enumerable
|
|
- CanBeEscapedWhenCastToString
|