api/laravel/Collections/Arr.yaml
2024-09-26 02:03:21 -07:00

708 lines
13 KiB
YAML

name: Arr
class_comment: null
dependencies:
- name: ArgumentCountError
type: class
source: ArgumentCountError
- name: ArrayAccess
type: class
source: ArrayAccess
- name: Macroable
type: class
source: Illuminate\Support\Traits\Macroable
- name: InvalidArgumentException
type: class
source: InvalidArgumentException
- name: Randomizer
type: class
source: Random\Randomizer
- name: Macroable
type: class
source: Macroable
properties: []
methods:
- name: accessible
visibility: public
parameters:
- name: value
comment: '# * Determine whether the given value is array accessible.
# *
# * @param mixed $value
# * @return bool'
- name: add
visibility: public
parameters:
- name: array
- name: key
- name: value
comment: '# * Add an element to an array using "dot" notation if it doesn''t exist.
# *
# * @param array $array
# * @param string|int|float $key
# * @param mixed $value
# * @return array'
- name: collapse
visibility: public
parameters:
- name: array
comment: '# * Collapse an array of arrays into a single array.
# *
# * @param iterable $array
# * @return array'
- name: crossJoin
visibility: public
parameters:
- name: '...$arrays'
comment: '# * Cross join the given arrays, returning all possible permutations.
# *
# * @param iterable ...$arrays
# * @return array'
- name: divide
visibility: public
parameters:
- name: array
comment: '# * Divide an array into two arrays. One with keys and the other with
values.
# *
# * @param array $array
# * @return array'
- name: dot
visibility: public
parameters:
- name: array
- name: prepend
default: ''''''
comment: '# * Flatten a multi-dimensional associative array with dots.
# *
# * @param iterable $array
# * @param string $prepend
# * @return array'
- name: undot
visibility: public
parameters:
- name: array
comment: '# * Convert a flatten "dot" notation array into an expanded array.
# *
# * @param iterable $array
# * @return array'
- name: except
visibility: public
parameters:
- name: array
- name: keys
comment: '# * Get all of the given array except for a specified array of keys.
# *
# * @param array $array
# * @param array|string|int|float $keys
# * @return array'
- name: exists
visibility: public
parameters:
- name: array
- name: key
comment: '# * Determine if the given key exists in the provided array.
# *
# * @param \ArrayAccess|array $array
# * @param string|int $key
# * @return bool'
- name: first
visibility: public
parameters:
- name: array
- name: callback
default: 'null'
- name: default
default: 'null'
comment: '# * Return the first element in an array passing a given truth test.
# *
# * @template TKey
# * @template TValue
# * @template TFirstDefault
# *
# * @param iterable<TKey, TValue> $array
# * @param (callable(TValue, TKey): bool)|null $callback
# * @param TFirstDefault|(\Closure(): TFirstDefault) $default
# * @return TValue|TFirstDefault'
- name: last
visibility: public
parameters:
- name: array
- name: callback
default: 'null'
- name: default
default: 'null'
comment: '# * Return the last element in an array passing a given truth test.
# *
# * @param array $array
# * @param callable|null $callback
# * @param mixed $default
# * @return mixed'
- name: take
visibility: public
parameters:
- name: array
- name: limit
comment: '# * Take the first or last {$limit} items from an array.
# *
# * @param array $array
# * @param int $limit
# * @return array'
- name: flatten
visibility: public
parameters:
- name: array
- name: depth
default: INF
comment: '# * Flatten a multi-dimensional array into a single level.
# *
# * @param iterable $array
# * @param int $depth
# * @return array'
- name: forget
visibility: public
parameters:
- name: '&$array'
- name: keys
comment: '# * Remove one or many array items from a given array using "dot" notation.
# *
# * @param array $array
# * @param array|string|int|float $keys
# * @return void'
- name: get
visibility: public
parameters:
- name: array
- name: key
- name: default
default: 'null'
comment: '# * Get an item from an array using "dot" notation.
# *
# * @param \ArrayAccess|array $array
# * @param string|int|null $key
# * @param mixed $default
# * @return mixed'
- name: has
visibility: public
parameters:
- name: array
- name: keys
comment: '# * Check if an item or items exist in an array using "dot" notation.
# *
# * @param \ArrayAccess|array $array
# * @param string|array $keys
# * @return bool'
- name: hasAny
visibility: public
parameters:
- name: array
- name: keys
comment: '# * Determine if any of the keys exist in an array using "dot" notation.
# *
# * @param \ArrayAccess|array $array
# * @param string|array $keys
# * @return bool'
- name: isAssoc
visibility: public
parameters:
- name: array
comment: '# * Determines if an array is associative.
# *
# * An array is "associative" if it doesn''t have sequential numerical keys beginning
with zero.
# *
# * @param array $array
# * @return bool'
- name: isList
visibility: public
parameters:
- name: array
comment: '# * Determines if an array is a list.
# *
# * An array is a "list" if all array keys are sequential integers starting from
0 with no gaps in between.
# *
# * @param array $array
# * @return bool'
- name: join
visibility: public
parameters:
- name: array
- name: glue
- name: finalGlue
default: ''''''
comment: '# * Join all items using a string. The final items can use a separate
glue string.
# *
# * @param array $array
# * @param string $glue
# * @param string $finalGlue
# * @return string'
- name: keyBy
visibility: public
parameters:
- name: array
- name: keyBy
comment: '# * Key an associative array by a field or using a callback.
# *
# * @param array $array
# * @param callable|array|string $keyBy
# * @return array'
- name: prependKeysWith
visibility: public
parameters:
- name: array
- name: prependWith
comment: '# * Prepend the key names of an associative array.
# *
# * @param array $array
# * @param string $prependWith
# * @return array'
- name: only
visibility: public
parameters:
- name: array
- name: keys
comment: '# * Get a subset of the items from the given array.
# *
# * @param array $array
# * @param array|string $keys
# * @return array'
- name: select
visibility: public
parameters:
- name: array
- name: keys
comment: '# * Select an array of values from an array.
# *
# * @param array $array
# * @param array|string $keys
# * @return array'
- name: pluck
visibility: public
parameters:
- name: array
- name: value
- name: key
default: 'null'
comment: '# * Pluck an array of values from an array.
# *
# * @param iterable $array
# * @param string|array|int|null $value
# * @param string|array|null $key
# * @return array'
- name: explodePluckParameters
visibility: protected
parameters:
- name: value
- name: key
comment: '# * Explode the "value" and "key" arguments passed to "pluck".
# *
# * @param string|array $value
# * @param string|array|null $key
# * @return array'
- name: map
visibility: public
parameters:
- name: array
- name: callback
comment: '# * Run a map over each of the items in the array.
# *
# * @param array $array
# * @param callable $callback
# * @return array'
- name: mapWithKeys
visibility: public
parameters:
- name: array
- 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 TKey
# * @template TValue
# * @template TMapWithKeysKey of array-key
# * @template TMapWithKeysValue
# *
# * @param array<TKey, TValue> $array
# * @param callable(TValue, TKey): array<TMapWithKeysKey, TMapWithKeysValue> $callback
# * @return array'
- name: mapSpread
visibility: public
parameters:
- name: array
- name: callback
comment: '# * Run a map over each nested chunk of items.
# *
# * @template TKey
# * @template TValue
# *
# * @param array<TKey, array> $array
# * @param callable(mixed...): TValue $callback
# * @return array<TKey, TValue>'
- name: prepend
visibility: public
parameters:
- name: array
- name: value
- name: key
default: 'null'
comment: '# * Push an item onto the beginning of an array.
# *
# * @param array $array
# * @param mixed $value
# * @param mixed $key
# * @return array'
- name: pull
visibility: public
parameters:
- name: '&$array'
- name: key
- name: default
default: 'null'
comment: '# * Get a value from the array, and remove it.
# *
# * @param array $array
# * @param string|int $key
# * @param mixed $default
# * @return mixed'
- name: query
visibility: public
parameters:
- name: array
comment: '# * Convert the array into a query string.
# *
# * @param array $array
# * @return string'
- name: random
visibility: public
parameters:
- name: array
- name: number
default: 'null'
- name: preserveKeys
default: 'false'
comment: '# * Get one or a specified number of random values from an array.
# *
# * @param array $array
# * @param int|null $number
# * @param bool $preserveKeys
# * @return mixed
# *
# * @throws \InvalidArgumentException'
- name: set
visibility: public
parameters:
- name: '&$array'
- name: key
- name: value
comment: '# * Set an array item to a given value using "dot" notation.
# *
# * If no key is given to the method, the entire array will be replaced.
# *
# * @param array $array
# * @param string|int|null $key
# * @param mixed $value
# * @return array'
- name: shuffle
visibility: public
parameters:
- name: array
comment: '# * Shuffle the given array and return the result.
# *
# * @param array $array
# * @return array'
- name: sort
visibility: public
parameters:
- name: array
- name: callback
default: 'null'
comment: '# * Sort the array using the given callback or "dot" notation.
# *
# * @param array $array
# * @param callable|array|string|null $callback
# * @return array'
- name: sortDesc
visibility: public
parameters:
- name: array
- name: callback
default: 'null'
comment: '# * Sort the array in descending order using the given callback or "dot"
notation.
# *
# * @param array $array
# * @param callable|array|string|null $callback
# * @return array'
- name: sortRecursive
visibility: public
parameters:
- name: array
- name: options
default: SORT_REGULAR
- name: descending
default: 'false'
comment: '# * Recursively sort an array by keys and values.
# *
# * @param array $array
# * @param int $options
# * @param bool $descending
# * @return array'
- name: sortRecursiveDesc
visibility: public
parameters:
- name: array
- name: options
default: SORT_REGULAR
comment: '# * Recursively sort an array by keys and values in descending order.
# *
# * @param array $array
# * @param int $options
# * @return array'
- name: toCssClasses
visibility: public
parameters:
- name: array
comment: '# * Conditionally compile classes from an array into a CSS class list.
# *
# * @param array $array
# * @return string'
- name: toCssStyles
visibility: public
parameters:
- name: array
comment: '# * Conditionally compile styles from an array into a style list.
# *
# * @param array $array
# * @return string'
- name: where
visibility: public
parameters:
- name: array
- name: callback
comment: '# * Filter the array using the given callback.
# *
# * @param array $array
# * @param callable $callback
# * @return array'
- name: whereNotNull
visibility: public
parameters:
- name: array
comment: '# * Filter items where the value is not null.
# *
# * @param array $array
# * @return array'
- name: wrap
visibility: public
parameters:
- name: value
comment: '# * If the given value is not an array and not null, wrap it in one.
# *
# * @param mixed $value
# * @return array'
traits:
- ArgumentCountError
- ArrayAccess
- Illuminate\Support\Traits\Macroable
- InvalidArgumentException
- Random\Randomizer
- Macroable
interfaces: []