mirror of
https://github.com/itflow-org/itflow
synced 2026-08-18 05:25:12 +00:00
Allow PHP-8.2 and up Compatibility instead of just PHP-8.4
This commit is contained in:
170
plugins/vendor/illuminate/collections/Arr.php
vendored
170
plugins/vendor/illuminate/collections/Arr.php
vendored
@@ -33,7 +33,19 @@ class Arr
|
||||
* Determine whether the given value is arrayable.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
* @return ($value is array
|
||||
* ? true
|
||||
* : ($value is \Illuminate\Contracts\Support\Arrayable
|
||||
* ? true
|
||||
* : ($value is \Traversable
|
||||
* ? true
|
||||
* : ($value is \Illuminate\Contracts\Support\Jsonable
|
||||
* ? true
|
||||
* : ($value is \JsonSerializable ? true : false)
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public static function arrayable($value)
|
||||
{
|
||||
@@ -63,6 +75,8 @@ class Arr
|
||||
|
||||
/**
|
||||
* Get an array item from an array using "dot" notation.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function array(ArrayAccess|array $array, string|int|null $key, ?array $default = null): array
|
||||
{
|
||||
@@ -79,6 +93,8 @@ class Arr
|
||||
|
||||
/**
|
||||
* Get a boolean item from an array using "dot" notation.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function boolean(ArrayAccess|array $array, string|int|null $key, ?bool $default = null): bool
|
||||
{
|
||||
@@ -117,8 +133,10 @@ class Arr
|
||||
/**
|
||||
* Cross join the given arrays, returning all possible permutations.
|
||||
*
|
||||
* @param iterable ...$arrays
|
||||
* @return array
|
||||
* @template TValue
|
||||
*
|
||||
* @param iterable<TValue> ...$arrays
|
||||
* @return array<int, array<array-key, TValue>>
|
||||
*/
|
||||
public static function crossJoin(...$arrays)
|
||||
{
|
||||
@@ -144,8 +162,11 @@ class Arr
|
||||
/**
|
||||
* Divide an array into two arrays. One with keys and the other with values.
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
* @template TKey of array-key
|
||||
* @template TValue
|
||||
*
|
||||
* @param array<TKey, TValue> $array
|
||||
* @return array{TKey[], TValue[]}
|
||||
*/
|
||||
public static function divide($array)
|
||||
{
|
||||
@@ -157,25 +178,29 @@ class Arr
|
||||
*
|
||||
* @param iterable $array
|
||||
* @param string $prepend
|
||||
* @param int $depth
|
||||
* @return array
|
||||
*/
|
||||
public static function dot($array, $prepend = '')
|
||||
public static function dot($array, $prepend = '', $depth = INF)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
$flatten = function ($data, $prefix) use (&$results, &$flatten): void {
|
||||
$flatten = function ($data, $prefix, $currentDepth) use (&$results, &$flatten, $depth): void {
|
||||
foreach ($data as $key => $value) {
|
||||
$newKey = $prefix.$key;
|
||||
|
||||
if (is_array($value) && ! empty($value)) {
|
||||
$flatten($value, $newKey.'.');
|
||||
if (is_array($value) && ! empty($value) && $currentDepth < $depth) {
|
||||
$flatten($value, $newKey.'.', $currentDepth + 1);
|
||||
} else {
|
||||
$results[$newKey] = $value;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$flatten($array, $prepend);
|
||||
$flatten($array, $prepend, 0);
|
||||
|
||||
// Destroy self-referencing closure to avoid memory leak...
|
||||
$flatten = null;
|
||||
|
||||
return $results;
|
||||
}
|
||||
@@ -211,6 +236,23 @@ class Arr
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the given array except for a specified array of values.
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $values
|
||||
* @param bool $strict
|
||||
* @return array
|
||||
*/
|
||||
public static function exceptValues($array, $values, $strict = false)
|
||||
{
|
||||
$values = (array) $values;
|
||||
|
||||
return array_filter($array, function ($value) use ($values, $strict) {
|
||||
return ! in_array($value, $values, $strict);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given key exists in the provided array.
|
||||
*
|
||||
@@ -228,7 +270,7 @@ class Arr
|
||||
return $array->offsetExists($key);
|
||||
}
|
||||
|
||||
if (is_float($key)) {
|
||||
if (is_float($key) || is_null($key)) {
|
||||
$key = (string) $key;
|
||||
}
|
||||
|
||||
@@ -236,7 +278,7 @@ class Arr
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first element in an array passing a given truth test.
|
||||
* Return the first element in an iterable passing a given truth test.
|
||||
*
|
||||
* @template TKey
|
||||
* @template TValue
|
||||
@@ -265,6 +307,8 @@ class Arr
|
||||
return value($default);
|
||||
}
|
||||
|
||||
$array = static::from($array);
|
||||
|
||||
$key = array_find_key($array, $callback);
|
||||
|
||||
return $key !== null ? $array[$key] : value($default);
|
||||
@@ -339,6 +383,8 @@ class Arr
|
||||
|
||||
/**
|
||||
* Get a float item from an array using "dot" notation.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function float(ArrayAccess|array $array, string|int|null $key, ?float $default = null): float
|
||||
{
|
||||
@@ -446,7 +492,7 @@ class Arr
|
||||
}
|
||||
|
||||
if (! str_contains($key, '.')) {
|
||||
return $array[$key] ?? value($default);
|
||||
return value($default);
|
||||
}
|
||||
|
||||
foreach (explode('.', $key) as $segment) {
|
||||
@@ -576,6 +622,8 @@ class Arr
|
||||
|
||||
/**
|
||||
* Get an integer item from an array using "dot" notation.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function integer(ArrayAccess|array $array, string|int|null $key, ?int $default = null): int
|
||||
{
|
||||
@@ -596,7 +644,7 @@ class Arr
|
||||
* An array is "associative" if it doesn't have sequential numerical keys beginning with zero.
|
||||
*
|
||||
* @param array $array
|
||||
* @return bool
|
||||
* @return ($array is list ? false : true)
|
||||
*/
|
||||
public static function isAssoc(array $array)
|
||||
{
|
||||
@@ -609,7 +657,7 @@ class Arr
|
||||
* 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
|
||||
* @return ($array is list ? true : false)
|
||||
*/
|
||||
public static function isList($array)
|
||||
{
|
||||
@@ -646,7 +694,7 @@ class Arr
|
||||
/**
|
||||
* Key an associative array by a field or using a callback.
|
||||
*
|
||||
* @param array $array
|
||||
* @param iterable $array
|
||||
* @param callable|array|string $keyBy
|
||||
* @return array
|
||||
*/
|
||||
@@ -679,6 +727,23 @@ class Arr
|
||||
return array_intersect_key($array, array_flip((array) $keys));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a subset of the items from the given array by value.
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $values
|
||||
* @param bool $strict
|
||||
* @return array
|
||||
*/
|
||||
public static function onlyValues($array, $values, $strict = false)
|
||||
{
|
||||
$values = (array) $values;
|
||||
|
||||
return array_filter($array, function ($value) use ($values, $strict) {
|
||||
return in_array($value, $values, $strict);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Select an array of values from an array.
|
||||
*
|
||||
@@ -748,7 +813,7 @@ class Arr
|
||||
/**
|
||||
* Explode the "value" and "key" arguments passed to "pluck".
|
||||
*
|
||||
* @param string|array|Closure $value
|
||||
* @param Closure|array|string $value
|
||||
* @param string|array|Closure|null $key
|
||||
* @return array
|
||||
*/
|
||||
@@ -1022,9 +1087,12 @@ class Arr
|
||||
/**
|
||||
* Sort the array using the given callback or "dot" notation.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable|array|string|null $callback
|
||||
* @return array
|
||||
* @template TKey of array-key
|
||||
* @template TValue
|
||||
*
|
||||
* @param iterable<TKey, TValue> $array
|
||||
* @param callable|string|null|array<int, (callable(TValue, TValue): -1|0|1)|array{string, 'asc'|'desc'}> $callback
|
||||
* @return array<TKey, TValue>
|
||||
*/
|
||||
public static function sort($array, $callback = null)
|
||||
{
|
||||
@@ -1034,9 +1102,12 @@ class Arr
|
||||
/**
|
||||
* Sort the array in descending order using the given callback or "dot" notation.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable|array|string|null $callback
|
||||
* @return array
|
||||
* @template TKey of array-key
|
||||
* @template TValue
|
||||
*
|
||||
* @param iterable<TKey, TValue> $array
|
||||
* @param callable|string|null|array<int, (callable(TValue, TValue): -1|0|1)|array{string, 'asc'|'desc'}> $callback
|
||||
* @return array<TKey, TValue>
|
||||
*/
|
||||
public static function sortDesc($array, $callback = null)
|
||||
{
|
||||
@@ -1046,10 +1117,13 @@ class Arr
|
||||
/**
|
||||
* Recursively sort an array by keys and values.
|
||||
*
|
||||
* @param array $array
|
||||
* @param int $options
|
||||
* @template TKey of array-key
|
||||
* @template TValue
|
||||
*
|
||||
* @param array<TKey, TValue> $array
|
||||
* @param int-mask-of<SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_LOCALE_STRING|SORT_NATURAL|SORT_FLAG_CASE> $options
|
||||
* @param bool $descending
|
||||
* @return array
|
||||
* @return array<TKey, TValue>
|
||||
*/
|
||||
public static function sortRecursive($array, $options = SORT_REGULAR, $descending = false)
|
||||
{
|
||||
@@ -1075,9 +1149,12 @@ class Arr
|
||||
/**
|
||||
* Recursively sort an array by keys and values in descending order.
|
||||
*
|
||||
* @param array $array
|
||||
* @param int $options
|
||||
* @return array
|
||||
* @template TKey of array-key
|
||||
* @template TValue
|
||||
*
|
||||
* @param array<TKey, TValue> $array
|
||||
* @param int-mask-of<SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_LOCALE_STRING|SORT_NATURAL|SORT_FLAG_CASE> $options
|
||||
* @return array<TKey, TValue>
|
||||
*/
|
||||
public static function sortRecursiveDesc($array, $options = SORT_REGULAR)
|
||||
{
|
||||
@@ -1086,6 +1163,8 @@ class Arr
|
||||
|
||||
/**
|
||||
* Get a string item from an array using "dot" notation.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function string(ArrayAccess|array $array, string|int|null $key, ?string $default = null): string
|
||||
{
|
||||
@@ -1103,8 +1182,8 @@ class Arr
|
||||
/**
|
||||
* Conditionally compile classes from an array into a CSS class list.
|
||||
*
|
||||
* @param array|string $array
|
||||
* @return string
|
||||
* @param array<string, bool>|array<int, string|int>|string $array
|
||||
* @return ($array is array<string, false> ? '' : ($array is '' ? '' : ($array is array{} ? '' : non-empty-string)))
|
||||
*/
|
||||
public static function toCssClasses($array)
|
||||
{
|
||||
@@ -1126,8 +1205,8 @@ class Arr
|
||||
/**
|
||||
* Conditionally compile styles from an array into a style list.
|
||||
*
|
||||
* @param array|string $array
|
||||
* @return string
|
||||
* @param array<string, bool>|array<int, string|int>|string $array
|
||||
* @return ($array is array<string, false> ? '' : ($array is '' ? '' : ($array is array{} ? '' : non-empty-string)))
|
||||
*/
|
||||
public static function toCssStyles($array)
|
||||
{
|
||||
@@ -1149,9 +1228,12 @@ class Arr
|
||||
/**
|
||||
* Filter the array using the given callback.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @return array
|
||||
* @template TKey of array-key
|
||||
* @template TValue
|
||||
*
|
||||
* @param array<TKey, TValue> $array
|
||||
* @param callable(TValue, TKey): bool $callback
|
||||
* @return array<TKey, TValue>
|
||||
*/
|
||||
public static function where($array, callable $callback)
|
||||
{
|
||||
@@ -1161,9 +1243,12 @@ class Arr
|
||||
/**
|
||||
* Filter the array using the negation of the given callback.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @return array
|
||||
* @template TKey of array-key
|
||||
* @template TValue
|
||||
*
|
||||
* @param array<TKey, TValue> $array
|
||||
* @param callable(TValue, TKey): bool $callback
|
||||
* @return array<TKey, TValue>
|
||||
*/
|
||||
public static function reject($array, callable $callback)
|
||||
{
|
||||
@@ -1210,8 +1295,11 @@ class Arr
|
||||
/**
|
||||
* If the given value is not an array and not null, wrap it in one.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
* @template TKey of array-key = array-key
|
||||
* @template TValue
|
||||
*
|
||||
* @param array<TKey, TValue>|TValue|null $value
|
||||
* @return ($value is null ? array{} : ($value is array ? array<TKey, TValue> : array{TValue}))
|
||||
*/
|
||||
public static function wrap($value)
|
||||
{
|
||||
|
||||
129
plugins/vendor/illuminate/collections/Collection.php
vendored
129
plugins/vendor/illuminate/collections/Collection.php
vendored
@@ -95,7 +95,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
return;
|
||||
}
|
||||
|
||||
$middle = (int) ($count / 2);
|
||||
$middle = intdiv($count, 2);
|
||||
|
||||
if ($count % 2) {
|
||||
return $values->get($middle);
|
||||
@@ -473,12 +473,14 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
*
|
||||
* @template TGetDefault
|
||||
*
|
||||
* @param TKey $key
|
||||
* @param TKey|null $key
|
||||
* @param TGetDefault|(\Closure(): TGetDefault) $default
|
||||
* @return TValue|TGetDefault
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
$key ??= '';
|
||||
|
||||
if (array_key_exists($key, $this->items)) {
|
||||
return $this->items[$key];
|
||||
}
|
||||
@@ -497,8 +499,8 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
*/
|
||||
public function getOrPut($key, $value)
|
||||
{
|
||||
if (array_key_exists($key, $this->items)) {
|
||||
return $this->items[$key];
|
||||
if (array_key_exists($key ?? '', $this->items)) {
|
||||
return $this->items[$key ?? ''];
|
||||
}
|
||||
|
||||
$this->offsetSet($key, $value = value($value));
|
||||
@@ -509,11 +511,16 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
/**
|
||||
* Group an associative array by a field or using a callback.
|
||||
*
|
||||
* @template TGroupKey of array-key
|
||||
* @template TGroupKey of array-key|\UnitEnum|\Stringable
|
||||
*
|
||||
* @param (callable(TValue, TKey): TGroupKey)|array|string $groupBy
|
||||
* @param bool $preserveKeys
|
||||
* @return static<($groupBy is string ? array-key : ($groupBy is array ? array-key : TGroupKey)), static<($preserveKeys is true ? TKey : int), ($groupBy is array ? mixed : TValue)>>
|
||||
* @return static<
|
||||
* ($groupBy is (array|string)
|
||||
* ? array-key
|
||||
* : (TGroupKey is \UnitEnum ? array-key : (TGroupKey is \Stringable ? string : TGroupKey))),
|
||||
* static<($preserveKeys is true ? TKey : int), ($groupBy is array ? mixed : TValue)>
|
||||
* >
|
||||
*/
|
||||
public function groupBy($groupBy, $preserveKeys = false)
|
||||
{
|
||||
@@ -538,7 +545,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
$groupKey = match (true) {
|
||||
is_bool($groupKey) => (int) $groupKey,
|
||||
$groupKey instanceof \UnitEnum => enum_value($groupKey),
|
||||
$groupKey instanceof \Stringable => (string) $groupKey,
|
||||
$groupKey instanceof \Stringable, is_null($groupKey) => (string) $groupKey,
|
||||
default => $groupKey,
|
||||
};
|
||||
|
||||
@@ -562,10 +569,10 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
/**
|
||||
* Key an associative array by a field or using a callback.
|
||||
*
|
||||
* @template TNewKey of array-key
|
||||
* @template TNewKey of array-key|\UnitEnum
|
||||
*
|
||||
* @param (callable(TValue, TKey): TNewKey)|array|string $keyBy
|
||||
* @return static<($keyBy is string ? array-key : ($keyBy is array ? array-key : TNewKey)), TValue>
|
||||
* @return static<($keyBy is (array|string) ? array-key : (TNewKey is \UnitEnum ? array-key : TNewKey)), TValue>
|
||||
*/
|
||||
public function keyBy($keyBy)
|
||||
{
|
||||
@@ -600,7 +607,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
{
|
||||
$keys = is_array($key) ? $key : func_get_args();
|
||||
|
||||
return array_all($keys, fn ($key) => array_key_exists($key, $this->items));
|
||||
return array_all($keys, fn ($key) => array_key_exists($key ?? '', $this->items));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -617,7 +624,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
|
||||
$keys = is_array($key) ? $key : func_get_args();
|
||||
|
||||
return array_any($keys, fn ($key) => array_key_exists($key, $this->items));
|
||||
return array_any($keys, fn ($key) => array_key_exists($key ?? '', $this->items));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -722,14 +729,25 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
*
|
||||
* @param (callable(TValue, TKey): bool)|null $callback
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated 12.49.0 Use the `hasSole()` method instead.
|
||||
*/
|
||||
public function containsOneItem(?callable $callback = null): bool
|
||||
{
|
||||
if ($callback) {
|
||||
return $this->filter($callback)->count() === 1;
|
||||
}
|
||||
return $this->hasSole($callback);
|
||||
}
|
||||
|
||||
return $this->count() === 1;
|
||||
/**
|
||||
* Determine if the collection contains multiple items.
|
||||
*
|
||||
* @param (callable(TValue, TKey): bool)|null $callback
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated 12.50.0 Use the `hasMany()` method instead.
|
||||
*/
|
||||
public function containsManyItems(?callable $callback = null): bool
|
||||
{
|
||||
return $this->hasMany($callback);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -737,7 +755,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
*
|
||||
* @param string $glue
|
||||
* @param string $finalGlue
|
||||
* @return string
|
||||
* @return TValue|string
|
||||
*/
|
||||
public function join($glue, $finalGlue = '')
|
||||
{
|
||||
@@ -789,8 +807,8 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
/**
|
||||
* Get the values of a given key.
|
||||
*
|
||||
* @param string|int|array<array-key, string>|null $value
|
||||
* @param string|null $key
|
||||
* @param \Closure|string|int|array<array-key, string>|null $value
|
||||
* @param \Closure|string|null $key
|
||||
* @return static<array-key, mixed>
|
||||
*/
|
||||
public function pluck($value, $key = null)
|
||||
@@ -862,8 +880,10 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
/**
|
||||
* Merge the collection with the given items.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items
|
||||
* @return static
|
||||
* @template TMergeValue
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\Arrayable<TKey, TMergeValue>|iterable<TKey, TMergeValue> $items
|
||||
* @return static<TKey, TValue|TMergeValue>
|
||||
*/
|
||||
public function merge($items)
|
||||
{
|
||||
@@ -929,10 +949,16 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
*
|
||||
* @param int $step
|
||||
* @param int $offset
|
||||
* @return static
|
||||
* @return ($step is positive-int ? static : never)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function nth($step, $offset = 0)
|
||||
{
|
||||
if ($step < 1) {
|
||||
throw new InvalidArgumentException('Step value must be at least 1.');
|
||||
}
|
||||
|
||||
$new = [];
|
||||
|
||||
$position = 0;
|
||||
@@ -1030,7 +1056,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
*/
|
||||
public function prepend($value, $key = null)
|
||||
{
|
||||
$this->items = Arr::prepend($this->items, ...func_get_args());
|
||||
$this->items = Arr::prepend($this->items, ...(func_num_args() > 1 ? func_get_args() : [$value]));
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -1279,12 +1305,20 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
/**
|
||||
* Create chunks representing a "sliding window" view of the items in the collection.
|
||||
*
|
||||
* @param int $size
|
||||
* @param int $step
|
||||
* @param positive-int $size
|
||||
* @param positive-int $step
|
||||
* @return static<int, static>
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function sliding($size = 2, $step = 1)
|
||||
{
|
||||
if ($size < 1) {
|
||||
throw new InvalidArgumentException('Size value must be at least 1.');
|
||||
} elseif ($step < 1) {
|
||||
throw new InvalidArgumentException('Step value must be at least 1.');
|
||||
}
|
||||
|
||||
$chunks = floor(($this->count() - $size) / $step) + 1;
|
||||
|
||||
return static::times($chunks, fn ($number) => $this->slice(($number - 1) * $step, $size));
|
||||
@@ -1339,10 +1373,16 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
* Split a collection into a certain number of groups.
|
||||
*
|
||||
* @param int $numberOfGroups
|
||||
* @return static<int, static>
|
||||
* @return ($numberOfGroups is positive-int ? static<int, static> : never)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function split($numberOfGroups)
|
||||
{
|
||||
if ($numberOfGroups < 1) {
|
||||
throw new InvalidArgumentException('Number of groups must be at least 1.');
|
||||
}
|
||||
|
||||
if ($this->isEmpty()) {
|
||||
return new static;
|
||||
}
|
||||
@@ -1376,17 +1416,23 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
* Split a collection into a certain number of groups, and fill the first groups completely.
|
||||
*
|
||||
* @param int $numberOfGroups
|
||||
* @return static<int, static>
|
||||
* @return ($numberOfGroups is positive-int ? static<int, static> : never)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function splitIn($numberOfGroups)
|
||||
{
|
||||
if ($numberOfGroups < 1) {
|
||||
throw new InvalidArgumentException('Number of groups must be at least 1.');
|
||||
}
|
||||
|
||||
return $this->chunk((int) ceil($this->count() / $numberOfGroups));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 (callable(TValue, TKey): bool)|string|null $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return TValue
|
||||
@@ -1415,6 +1461,26 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
return $items->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the collection contains a single item, optionally matching the given criteria.
|
||||
*
|
||||
* @param (callable(TValue, TKey): bool)|string|null $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function hasSole($key = null, $operator = null, $value = null): bool
|
||||
{
|
||||
$filter = func_num_args() > 1
|
||||
? $this->operatorForWhere(...func_get_args())
|
||||
: $key;
|
||||
|
||||
return $this
|
||||
->unless($filter == null)
|
||||
->filter($filter)
|
||||
->count() === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first item in the collection but throw an exception if no matching items exist.
|
||||
*
|
||||
@@ -1584,7 +1650,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
}
|
||||
} else {
|
||||
$result = match ($options) {
|
||||
SORT_NUMERIC => intval($values[0]) <=> intval($values[1]),
|
||||
SORT_NUMERIC => (int) $values[0] <=> (int) $values[1],
|
||||
SORT_STRING => strcmp($values[0], $values[1]),
|
||||
SORT_NATURAL => strnatcmp((string) $values[0], (string) $values[1]),
|
||||
SORT_LOCALE_STRING => strcoll($values[0], $values[1]),
|
||||
@@ -1742,11 +1808,12 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
/**
|
||||
* Flatten a multi-dimensional associative array with dots.
|
||||
*
|
||||
* @param int $depth
|
||||
* @return static
|
||||
*/
|
||||
public function dot()
|
||||
public function dot($depth = INF)
|
||||
{
|
||||
return new static(Arr::dot($this->all()));
|
||||
return new static(Arr::dot($this->all(), '', $depth));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1852,7 +1919,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
/**
|
||||
* Count the number of items in the collection by a field or using a callback.
|
||||
*
|
||||
* @param (callable(TValue, TKey): array-key|\UnitEnum)|string|null $countBy
|
||||
* @param (callable(TValue, TKey): (array-key|\UnitEnum))|string|null $countBy
|
||||
* @return static<array-key, int>
|
||||
*/
|
||||
public function countBy($countBy = null)
|
||||
|
||||
@@ -625,6 +625,13 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
*/
|
||||
public function containsOneItem();
|
||||
|
||||
/**
|
||||
* Determine if the collection contains multiple items.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function containsManyItems();
|
||||
|
||||
/**
|
||||
* Join all items from the collection using a string. The final items can use a separate glue string.
|
||||
*
|
||||
@@ -733,8 +740,10 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
/**
|
||||
* Merge the collection with the given items.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items
|
||||
* @return static
|
||||
* @template TMergeValue
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\Arrayable<TKey, TMergeValue>|iterable<TKey, TMergeValue> $items
|
||||
* @return static<TKey, TValue|TMergeValue>
|
||||
*/
|
||||
public function merge($items);
|
||||
|
||||
@@ -985,7 +994,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
/**
|
||||
* Get the first item in the collection but throw an exception if no matching items exist.
|
||||
*
|
||||
* @param (callable(TValue, TKey): bool)|string $key
|
||||
* @param (callable(TValue, TKey): bool)|string|null $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return TValue
|
||||
|
||||
@@ -77,7 +77,9 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
* @param int $from
|
||||
* @param int $to
|
||||
* @param int $step
|
||||
* @return static<int, int>
|
||||
* @return ($step is zero ? never : static<int, int>)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function range($from, $to, $step = 1)
|
||||
{
|
||||
@@ -303,23 +305,18 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* 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>>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function crossJoin(...$arrays)
|
||||
{
|
||||
return $this->passthru('crossJoin', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of items in the collection by a field or using a callback.
|
||||
*
|
||||
* @param (callable(TValue, TKey): array-key|\UnitEnum)|string|null $countBy
|
||||
* @param (callable(TValue, TKey): (array-key|\UnitEnum))|string|null $countBy
|
||||
* @return static<array-key, int>
|
||||
*/
|
||||
public function countBy($countBy = null)
|
||||
@@ -346,110 +343,84 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<TKey, TValue>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function diff($items)
|
||||
{
|
||||
return $this->passthru('diff', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function diffUsing($items, callable $callback)
|
||||
{
|
||||
return $this->passthru('diffUsing', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function diffAssoc($items)
|
||||
{
|
||||
return $this->passthru('diffAssoc', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function diffAssocUsing($items, callable $callback)
|
||||
{
|
||||
return $this->passthru('diffAssocUsing', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the items whose keys are not present in the given items.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\Arrayable<TKey, mixed>|iterable<TKey, mixed> $items
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function diffKeys($items)
|
||||
{
|
||||
return $this->passthru('diffKeys', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the items whose keys are not present in the given items, using the callback.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\Arrayable<TKey, mixed>|iterable<TKey, mixed> $items
|
||||
* @param callable(TKey, TKey): int $callback
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function diffKeysUsing($items, callable $callback)
|
||||
{
|
||||
return $this->passthru('diffKeysUsing', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve duplicate items.
|
||||
*
|
||||
* @template TMapValue
|
||||
*
|
||||
* @param (callable(TValue): TMapValue)|string|null $callback
|
||||
* @param bool $strict
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function duplicates($callback = null, $strict = false)
|
||||
{
|
||||
return $this->passthru('duplicates', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve duplicate items using strict comparison.
|
||||
*
|
||||
* @template TMapValue
|
||||
*
|
||||
* @param (callable(TValue): TMapValue)|string|null $callback
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function duplicatesStrict($callback = null)
|
||||
{
|
||||
return $this->passthru('duplicatesStrict', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all items except for those with the specified keys.
|
||||
*
|
||||
* @param \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey> $keys
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function except($keys)
|
||||
{
|
||||
return $this->passthru('except', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -565,26 +536,31 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* Group an associative array by a field or using a callback.
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @template TGroupKey of array-key
|
||||
* @template TGroupKey of array-key|\UnitEnum|\Stringable
|
||||
*
|
||||
* @param (callable(TValue, TKey): TGroupKey)|array|string $groupBy
|
||||
* @param bool $preserveKeys
|
||||
* @return static<($groupBy is string ? array-key : ($groupBy is array ? array-key : TGroupKey)), static<($preserveKeys is true ? TKey : int), ($groupBy is array ? mixed : TValue)>>
|
||||
* @return static<
|
||||
* ($groupBy is (array|string)
|
||||
* ? array-key
|
||||
* : (TGroupKey is \UnitEnum ? array-key : (TGroupKey is \Stringable ? string : TGroupKey))),
|
||||
* static<($preserveKeys is true ? TKey : int), ($groupBy is array ? mixed : TValue)>
|
||||
* >
|
||||
*/
|
||||
#[\Override]
|
||||
public function groupBy($groupBy, $preserveKeys = false)
|
||||
{
|
||||
return $this->passthru('groupBy', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Key an associative array by a field or using a callback.
|
||||
*
|
||||
* @template TNewKey of array-key
|
||||
* @template TNewKey of array-key|\UnitEnum
|
||||
*
|
||||
* @param (callable(TValue, TKey): TNewKey)|array|string $keyBy
|
||||
* @return static<($keyBy is string ? array-key : ($keyBy is array ? array-key : TNewKey)), TValue>
|
||||
* @return static<($keyBy is (array|string) ? array-key : (TNewKey is \UnitEnum ? array-key : TNewKey)), TValue>
|
||||
*/
|
||||
public function keyBy($keyBy)
|
||||
{
|
||||
@@ -655,60 +631,48 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* Intersect the collection with the given items.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function intersect($items)
|
||||
{
|
||||
return $this->passthru('intersect', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function intersectUsing($items, callable $callback)
|
||||
{
|
||||
return $this->passthru('intersectUsing', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Intersect the collection with the given items with additional index check.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function intersectAssoc($items)
|
||||
{
|
||||
return $this->passthru('intersectAssoc', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function intersectAssocUsing($items, callable $callback)
|
||||
{
|
||||
return $this->passthru('intersectAssocUsing', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Intersect the collection with the given items by key.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\Arrayable<TKey, mixed>|iterable<TKey, mixed> $items
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function intersectByKeys($items)
|
||||
{
|
||||
return $this->passthru('intersectByKeys', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -724,11 +688,26 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
/**
|
||||
* Determine if the collection contains a single item.
|
||||
*
|
||||
* @param (callable(TValue, TKey): bool)|null $callback
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated 12.49.0 Use the `hasSole()` method instead.
|
||||
*/
|
||||
public function containsOneItem()
|
||||
public function containsOneItem(?callable $callback = null): bool
|
||||
{
|
||||
return $this->take(2)->count() === 1;
|
||||
return $this->hasSole($callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the collection contains multiple items.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated 12.50.0 Use the `hasMany()` method instead.
|
||||
*/
|
||||
public function containsManyItems(): bool
|
||||
{
|
||||
return $this->hasMany();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -831,19 +810,12 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* 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>>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function mapToDictionary(callable $callback)
|
||||
{
|
||||
return $this->passthru('mapToDictionary', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -867,27 +839,21 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge the collection with the given items.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function merge($items)
|
||||
{
|
||||
return $this->passthru('merge', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function mergeRecursive($items)
|
||||
{
|
||||
return $this->passthru('mergeRecursive', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -898,7 +864,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
*/
|
||||
public function multiply(int $multiplier)
|
||||
{
|
||||
return $this->passthru('multiply', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -935,14 +901,12 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* Union the collection with the given items.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function union($items)
|
||||
{
|
||||
return $this->passthru('union', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -950,10 +914,16 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
*
|
||||
* @param int $step
|
||||
* @param int $offset
|
||||
* @return static
|
||||
* @return ($step is positive-int ? static : never)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function nth($step, $offset = 0)
|
||||
{
|
||||
if ($step < 1) {
|
||||
throw new InvalidArgumentException('Step value must be at least 1.');
|
||||
}
|
||||
|
||||
return new static(function () use ($step, $offset) {
|
||||
$position = 0;
|
||||
|
||||
@@ -1058,11 +1028,12 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
* Get one or a specified number of items randomly from the collection.
|
||||
*
|
||||
* @param int|null $number
|
||||
* @param bool $preserveKeys
|
||||
* @return static<int, TValue>|TValue
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function random($number = null)
|
||||
public function random($number = null, $preserveKeys = false)
|
||||
{
|
||||
$result = $this->collect()->random(...func_get_args());
|
||||
|
||||
@@ -1097,24 +1068,21 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively replace the collection items with the given items.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function replaceRecursive($items)
|
||||
{
|
||||
return $this->passthru('replaceRecursive', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse items order.
|
||||
*
|
||||
* @return static<TKey, TValue>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function reverse()
|
||||
{
|
||||
return $this->passthru('reverse', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1203,24 +1171,31 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuffle the items in the collection.
|
||||
*
|
||||
* @return static<TKey, TValue>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function shuffle()
|
||||
{
|
||||
return $this->passthru('shuffle', []);
|
||||
return $this->passthru(__FUNCTION__, []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create chunks representing a "sliding window" view of the items in the collection.
|
||||
*
|
||||
* @param int $size
|
||||
* @param int $step
|
||||
* @param positive-int $size
|
||||
* @param positive-int $step
|
||||
* @return static<int, static>
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function sliding($size = 2, $step = 1)
|
||||
{
|
||||
if ($size < 1) {
|
||||
throw new InvalidArgumentException('Size value must be at least 1.');
|
||||
} elseif ($step < 1) {
|
||||
throw new InvalidArgumentException('Step value must be at least 1.');
|
||||
}
|
||||
|
||||
return new static(function () use ($size, $step) {
|
||||
$iterator = $this->getIterator();
|
||||
|
||||
@@ -1313,16 +1288,13 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a slice of items from the enumerable.
|
||||
*
|
||||
* @param int $offset
|
||||
* @param int|null $length
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function slice($offset, $length = null)
|
||||
{
|
||||
if ($offset < 0 || $length < 0) {
|
||||
return $this->passthru('slice', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
$instance = $this->skip($offset);
|
||||
@@ -1331,20 +1303,24 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* Split a collection into a certain number of groups.
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @param int $numberOfGroups
|
||||
* @return static<int, static>
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
#[\Override]
|
||||
public function split($numberOfGroups)
|
||||
{
|
||||
return $this->passthru('split', func_get_args());
|
||||
if ($numberOfGroups < 1) {
|
||||
throw new InvalidArgumentException('Number of groups must be at least 1.');
|
||||
}
|
||||
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 (callable(TValue, TKey): bool)|string|null $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return TValue
|
||||
@@ -1366,10 +1342,31 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
->sole();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the collection contains a single item or a single item matching the given criteria.
|
||||
*
|
||||
* @param (callable(TValue, TKey): bool)|string|null $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function hasSole($key = null, $operator = null, $value = null): bool
|
||||
{
|
||||
$filter = func_num_args() > 1
|
||||
? $this->operatorForWhere(...func_get_args())
|
||||
: $key;
|
||||
|
||||
return $this
|
||||
->unless($filter == null)
|
||||
->filter($filter)
|
||||
->take(2)
|
||||
->count() === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first item in the collection but throw an exception if no matching items exist.
|
||||
*
|
||||
* @param (callable(TValue, TKey): bool)|string $key
|
||||
* @param (callable(TValue, TKey): bool)|string|null $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return TValue
|
||||
@@ -1439,10 +1436,16 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
* Split a collection into a certain number of groups, and fill the first groups completely.
|
||||
*
|
||||
* @param int $numberOfGroups
|
||||
* @return static<int, static>
|
||||
* @return ($numberOfGroups is positive-int ? static<int, static> : never)
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function splitIn($numberOfGroups)
|
||||
{
|
||||
if ($numberOfGroups < 1) {
|
||||
throw new InvalidArgumentException('Number of groups must be at least 1.');
|
||||
}
|
||||
|
||||
return $this->chunk((int) ceil($this->count() / $numberOfGroups));
|
||||
}
|
||||
|
||||
@@ -1484,84 +1487,66 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort through each item with a callback.
|
||||
*
|
||||
* @param (callable(TValue, TValue): int)|null|int $callback
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function sort($callback = null)
|
||||
{
|
||||
return $this->passthru('sort', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort items in descending order.
|
||||
*
|
||||
* @param int $options
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function sortDesc($options = SORT_REGULAR)
|
||||
{
|
||||
return $this->passthru('sortDesc', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function sortBy($callback, $options = SORT_REGULAR, $descending = false)
|
||||
{
|
||||
return $this->passthru('sortBy', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function sortByDesc($callback, $options = SORT_REGULAR)
|
||||
{
|
||||
return $this->passthru('sortByDesc', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the collection keys.
|
||||
*
|
||||
* @param int $options
|
||||
* @param bool $descending
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function sortKeys($options = SORT_REGULAR, $descending = false)
|
||||
{
|
||||
return $this->passthru('sortKeys', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the collection keys in descending order.
|
||||
*
|
||||
* @param int $options
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function sortKeysDesc($options = SORT_REGULAR)
|
||||
{
|
||||
return $this->passthru('sortKeysDesc', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the collection keys using a callback.
|
||||
*
|
||||
* @param callable(TKey, TKey): int $callback
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function sortKeysUsing(callable $callback)
|
||||
{
|
||||
return $this->passthru('sortKeysUsing', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1630,17 +1615,22 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* Take items in the collection until a given point in time.
|
||||
* Take items in the collection until a given point in time, with an optional callback on timeout.
|
||||
*
|
||||
* @param \DateTimeInterface $timeout
|
||||
* @param callable(TValue|null, TKey|null): mixed|null $callback
|
||||
* @return static<TKey, TValue>
|
||||
*/
|
||||
public function takeUntilTimeout(DateTimeInterface $timeout)
|
||||
public function takeUntilTimeout(DateTimeInterface $timeout, ?callable $callback = null)
|
||||
{
|
||||
$timeout = $timeout->getTimestamp();
|
||||
|
||||
return new static(function () use ($timeout) {
|
||||
return new static(function () use ($timeout, $callback) {
|
||||
if ($this->now() >= $timeout) {
|
||||
if ($callback) {
|
||||
$callback(null, null);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1648,6 +1638,10 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
yield $key => $value;
|
||||
|
||||
if ($this->now() >= $timeout) {
|
||||
if ($callback) {
|
||||
$callback($value, $key);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1710,21 +1704,21 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
/**
|
||||
* Flatten a multi-dimensional associative array with dots.
|
||||
*
|
||||
* @param int $depth
|
||||
* @return static
|
||||
*/
|
||||
public function dot()
|
||||
public function dot($depth = INF)
|
||||
{
|
||||
return $this->passthru('dot', []);
|
||||
return $this->passthru(__FUNCTION__, [$depth]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a flatten "dot" notation array into an expanded array.
|
||||
*
|
||||
* @return static
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function undot()
|
||||
{
|
||||
return $this->passthru('undot', []);
|
||||
return $this->passthru(__FUNCTION__, []);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1830,18 +1824,13 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
}
|
||||
|
||||
/**
|
||||
* Pad collection to the specified length with a value.
|
||||
*
|
||||
* @template TPadValue
|
||||
*
|
||||
* @param int $size
|
||||
* @param TPadValue $value
|
||||
* @return static<int, TValue|TPadValue>
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[\Override]
|
||||
public function pad($size, $value)
|
||||
{
|
||||
if ($size < 0) {
|
||||
return $this->passthru('pad', func_get_args());
|
||||
return $this->passthru(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
return new static(function () use ($size, $value) {
|
||||
|
||||
@@ -33,6 +33,8 @@ use function Illuminate\Support\enum_value;
|
||||
* @property-read HigherOrderCollectionProxy<TKey, TValue> $first
|
||||
* @property-read HigherOrderCollectionProxy<TKey, TValue> $flatMap
|
||||
* @property-read HigherOrderCollectionProxy<TKey, TValue> $groupBy
|
||||
* @property-read HigherOrderCollectionProxy<TKey, TValue> $hasMany
|
||||
* @property-read HigherOrderCollectionProxy<TKey, TValue> $hasSole
|
||||
* @property-read HigherOrderCollectionProxy<TKey, TValue> $keyBy
|
||||
* @property-read HigherOrderCollectionProxy<TKey, TValue> $last
|
||||
* @property-read HigherOrderCollectionProxy<TKey, TValue> $map
|
||||
@@ -81,6 +83,8 @@ trait EnumeratesValues
|
||||
'first',
|
||||
'flatMap',
|
||||
'groupBy',
|
||||
'hasMany',
|
||||
'hasSole',
|
||||
'keyBy',
|
||||
'last',
|
||||
'map',
|
||||
@@ -329,6 +333,27 @@ trait EnumeratesValues
|
||||
return $this->first($this->operatorForWhere(...func_get_args()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the collection contains multiple items, optionally matching the given criteria.
|
||||
*
|
||||
* @param (callable(TValue, TKey): bool)|string|null $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function hasMany($key = null, $operator = null, $value = null): bool
|
||||
{
|
||||
$filter = func_num_args() > 1
|
||||
? $this->operatorForWhere(...func_get_args())
|
||||
: $key;
|
||||
|
||||
return $this
|
||||
->unless($filter == null)
|
||||
->filter($filter)
|
||||
->take(2)
|
||||
->count() === 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a single key's value from the first matching item in the collection.
|
||||
*
|
||||
@@ -340,11 +365,11 @@ trait EnumeratesValues
|
||||
*/
|
||||
public function value($key, $default = null)
|
||||
{
|
||||
if ($value = $this->firstWhere($key)) {
|
||||
return data_get($value, $key, $default);
|
||||
}
|
||||
$value = $this->first(function ($target) use ($key) {
|
||||
return data_has($target, $key);
|
||||
});
|
||||
|
||||
return value($default);
|
||||
return data_get($value, $key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -961,15 +986,12 @@ trait EnumeratesValues
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return array_map(function ($value) {
|
||||
if ($value instanceof JsonSerializable) {
|
||||
return $value->jsonSerialize();
|
||||
} elseif ($value instanceof Jsonable) {
|
||||
return json_decode($value->toJson(), true);
|
||||
} elseif ($value instanceof Arrayable) {
|
||||
return $value->toArray();
|
||||
}
|
||||
|
||||
return $value;
|
||||
return match (true) {
|
||||
$value instanceof JsonSerializable => $value->jsonSerialize(),
|
||||
$value instanceof Jsonable => json_decode($value->toJson(), true),
|
||||
$value instanceof Arrayable => $value->toArray(),
|
||||
default => $value,
|
||||
};
|
||||
}, $this->all());
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
|
||||
namespace Illuminate\Support\Traits;
|
||||
|
||||
use Illuminate\Database\Eloquent\Attributes\UseResource;
|
||||
use Illuminate\Database\Eloquent\Attributes\UseResourceCollection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
use LogicException;
|
||||
use ReflectionClass;
|
||||
|
||||
trait TransformsToResourceCollection
|
||||
{
|
||||
@@ -47,6 +50,18 @@ trait TransformsToResourceCollection
|
||||
|
||||
throw_unless(method_exists($className, 'guessResourceName'), LogicException::class, sprintf('Expected class %s to implement guessResourceName method. Make sure the model uses the TransformsToResource trait.', $className));
|
||||
|
||||
$useResourceCollection = $this->resolveResourceCollectionFromAttribute($className);
|
||||
|
||||
if ($useResourceCollection !== null && class_exists($useResourceCollection)) {
|
||||
return new $useResourceCollection($this);
|
||||
}
|
||||
|
||||
$useResource = $this->resolveResourceFromAttribute($className);
|
||||
|
||||
if ($useResource !== null && class_exists($useResource)) {
|
||||
return $useResource::collection($this);
|
||||
}
|
||||
|
||||
$resourceClasses = $className::guessResourceName();
|
||||
|
||||
foreach ($resourceClasses as $resourceClass) {
|
||||
@@ -65,4 +80,42 @@ trait TransformsToResourceCollection
|
||||
|
||||
throw new LogicException(sprintf('Failed to find resource class for model [%s].', $className));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the resource class from the class attribute.
|
||||
*
|
||||
* @param class-string<\Illuminate\Http\Resources\Json\JsonResource> $class
|
||||
* @return class-string<*>|null
|
||||
*/
|
||||
protected function resolveResourceFromAttribute(string $class): ?string
|
||||
{
|
||||
if (! class_exists($class)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$attributes = (new ReflectionClass($class))->getAttributes(UseResource::class);
|
||||
|
||||
return $attributes !== []
|
||||
? $attributes[0]->newInstance()->class
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the resource collection class from the class attribute.
|
||||
*
|
||||
* @param class-string<\Illuminate\Http\Resources\Json\ResourceCollection> $class
|
||||
* @return class-string<*>|null
|
||||
*/
|
||||
protected function resolveResourceCollectionFromAttribute(string $class): ?string
|
||||
{
|
||||
if (! class_exists($class)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$attributes = (new ReflectionClass($class))->getAttributes(UseResourceCollection::class);
|
||||
|
||||
return $attributes !== []
|
||||
? $attributes[0]->newInstance()->class
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"illuminate/conditionable": "^12.0",
|
||||
"illuminate/contracts": "^12.0",
|
||||
"illuminate/macroable": "^12.0",
|
||||
"symfony/polyfill-php83": "^1.33",
|
||||
"symfony/polyfill-php84": "^1.33",
|
||||
"symfony/polyfill-php85": "^1.33"
|
||||
},
|
||||
|
||||
@@ -34,6 +34,36 @@ if (! function_exists('data_fill')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('data_has')) {
|
||||
/**
|
||||
* Determine if a key / property exists on an array or object using "dot" notation.
|
||||
*
|
||||
* @param mixed $target
|
||||
* @param string|array|int|null $key
|
||||
* @return bool
|
||||
*/
|
||||
function data_has($target, $key): bool
|
||||
{
|
||||
if (is_null($key) || $key === []) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$key = is_array($key) ? $key : explode('.', $key);
|
||||
|
||||
foreach ($key as $segment) {
|
||||
if (Arr::accessible($target) && Arr::exists($target, $segment)) {
|
||||
$target = $target[$segment];
|
||||
} elseif (is_object($target) && property_exists($target, $segment)) {
|
||||
$target = $target->{$segment};
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('data_get')) {
|
||||
/**
|
||||
* Get an item from an array or object using "dot" notation.
|
||||
@@ -241,10 +271,14 @@ if (! function_exists('when')) {
|
||||
/**
|
||||
* Return a value if the given condition is true.
|
||||
*
|
||||
* @template TValue
|
||||
* @template TArgs
|
||||
* @template TDefault
|
||||
*
|
||||
* @param mixed $condition
|
||||
* @param \Closure|mixed $value
|
||||
* @param \Closure|mixed $default
|
||||
* @return mixed
|
||||
* @param TValue|\Closure(TArgs): TValue $value
|
||||
* @param TDefault|\Closure(): TDefault $default
|
||||
* @return ($condition is true|positive-int|non-falsy-string|non-empty-array ? TValue : ($condition is callable ? TValue|TDefault : TDefault))
|
||||
*/
|
||||
function when($condition, $value, $default = null)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ interface Gate
|
||||
/**
|
||||
* Determine if a given ability has been defined.
|
||||
*
|
||||
* @param string $ability
|
||||
* @param \UnitEnum|string $ability
|
||||
* @return bool
|
||||
*/
|
||||
public function has($ability);
|
||||
|
||||
@@ -16,7 +16,7 @@ interface ContextualBindingBuilder
|
||||
* Define the implementation for the contextual binding.
|
||||
*
|
||||
* @param \Closure|string|array $implementation
|
||||
* @return void
|
||||
* @return $this
|
||||
*/
|
||||
public function give($implementation);
|
||||
|
||||
@@ -24,7 +24,7 @@ interface ContextualBindingBuilder
|
||||
* Define tagged services to be used as the implementation for the contextual binding.
|
||||
*
|
||||
* @param string $tag
|
||||
* @return void
|
||||
* @return $this
|
||||
*/
|
||||
public function giveTagged($tag);
|
||||
|
||||
@@ -33,7 +33,7 @@ interface ContextualBindingBuilder
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return void
|
||||
* @return $this
|
||||
*/
|
||||
public function giveConfig($key, $default = null);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ interface Factory
|
||||
public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null);
|
||||
|
||||
/**
|
||||
* Create a cookie that lasts "forever" (five years).
|
||||
* Create a cookie that lasts "forever" (400 days).
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
|
||||
@@ -9,7 +9,7 @@ interface SupportsPartialRelations
|
||||
*
|
||||
* @param string|null $column
|
||||
* @param string|\Closure|null $aggregate
|
||||
* @param string $relation
|
||||
* @param string|null $relation
|
||||
* @return $this
|
||||
*/
|
||||
public function ofMany($column = 'id', $aggregate = 'MAX', $relation = null);
|
||||
|
||||
@@ -2,12 +2,19 @@
|
||||
|
||||
namespace Illuminate\Contracts\Database;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
|
||||
class ModelIdentifier
|
||||
{
|
||||
/**
|
||||
* Use the Relation morphMap for a Model's name when serializing.
|
||||
*/
|
||||
protected static bool $useMorphMap = false;
|
||||
|
||||
/**
|
||||
* The class name of the model.
|
||||
*
|
||||
* @var class-string<\Illuminate\Database\Eloquent\Model>
|
||||
* @var class-string<\Illuminate\Database\Eloquent\Model>|string|null
|
||||
*/
|
||||
public $class;
|
||||
|
||||
@@ -44,15 +51,19 @@ class ModelIdentifier
|
||||
/**
|
||||
* Create a new model identifier.
|
||||
*
|
||||
* @param class-string<\Illuminate\Database\Eloquent\Model> $class
|
||||
* @param class-string<\Illuminate\Database\Eloquent\Model>|null $class
|
||||
* @param mixed $id
|
||||
* @param array $relations
|
||||
* @param mixed $connection
|
||||
*/
|
||||
public function __construct($class, $id, array $relations, $connection)
|
||||
{
|
||||
$this->id = $id;
|
||||
if ($class !== null && self::$useMorphMap) {
|
||||
$class = Relation::getMorphAlias($class);
|
||||
}
|
||||
|
||||
$this->class = $class;
|
||||
$this->id = $id;
|
||||
$this->relations = $relations;
|
||||
$this->connection = $connection;
|
||||
}
|
||||
@@ -69,4 +80,26 @@ class ModelIdentifier
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fully-qualified class name of the Model.
|
||||
*
|
||||
* @return class-string<\Illuminate\Database\Eloquent\Model>|null
|
||||
*/
|
||||
public function getClass(): ?string
|
||||
{
|
||||
if (self::$useMorphMap && $this->class !== null) {
|
||||
return Relation::getMorphedModel($this->class) ?? $this->class;
|
||||
}
|
||||
|
||||
return $this->class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate whether to use the relational morph-map when serializing Models.
|
||||
*/
|
||||
public static function useMorphMap(bool $useMorphMap = true): void
|
||||
{
|
||||
static::$useMorphMap = $useMorphMap;
|
||||
}
|
||||
}
|
||||
|
||||
59
plugins/vendor/illuminate/contracts/JsonSchema/JsonSchema.php
vendored
Normal file
59
plugins/vendor/illuminate/contracts/JsonSchema/JsonSchema.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Contracts\JsonSchema;
|
||||
|
||||
use Closure;
|
||||
|
||||
interface JsonSchema
|
||||
{
|
||||
/**
|
||||
* Create a new object schema instance.
|
||||
*
|
||||
* @param (Closure(JsonSchema): array<string, \Illuminate\JsonSchema\Types\Type>)|array<string, \Illuminate\JsonSchema\Types\Type> $properties
|
||||
* @return \Illuminate\JsonSchema\Types\ObjectType
|
||||
*/
|
||||
public function object(Closure|array $properties = []);
|
||||
|
||||
/**
|
||||
* Create a new array property instance.
|
||||
*
|
||||
* @return \Illuminate\JsonSchema\Types\ArrayType
|
||||
*/
|
||||
public function array();
|
||||
|
||||
/**
|
||||
* Create a new string property instance.
|
||||
*
|
||||
* @return \Illuminate\JsonSchema\Types\StringType
|
||||
*/
|
||||
public function string();
|
||||
|
||||
/**
|
||||
* Create a new integer property instance.
|
||||
*
|
||||
* @return \Illuminate\JsonSchema\Types\IntegerType
|
||||
*/
|
||||
public function integer();
|
||||
|
||||
/**
|
||||
* Create a new number property instance.
|
||||
*
|
||||
* @return \Illuminate\JsonSchema\Types\NumberType
|
||||
*/
|
||||
public function number();
|
||||
|
||||
/**
|
||||
* Create a new boolean property instance.
|
||||
*
|
||||
* @return \Illuminate\JsonSchema\Types\BooleanType
|
||||
*/
|
||||
public function boolean();
|
||||
|
||||
/**
|
||||
* Create a new multi-type union instance.
|
||||
*
|
||||
* @param array<int, string> $types
|
||||
* @return \Illuminate\JsonSchema\Types\UnionType
|
||||
*/
|
||||
public function union(array $types);
|
||||
}
|
||||
@@ -61,4 +61,12 @@ interface InvokedProcess
|
||||
* @return \Illuminate\Process\ProcessResult
|
||||
*/
|
||||
public function wait(?callable $output = null);
|
||||
|
||||
/**
|
||||
* Wait until the given callback returns true.
|
||||
*
|
||||
* @param callable|null $output
|
||||
* @return \Illuminate\Process\ProcessResult
|
||||
*/
|
||||
public function waitUntil(?callable $output = null);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ use BadMethodCallException;
|
||||
use Closure;
|
||||
use ReflectionClass;
|
||||
use ReflectionMethod;
|
||||
use RuntimeException;
|
||||
use Throwable;
|
||||
|
||||
trait Macroable
|
||||
{
|
||||
@@ -120,7 +122,11 @@ trait Macroable
|
||||
$macro = static::$macros[$method];
|
||||
|
||||
if ($macro instanceof Closure) {
|
||||
$macro = $macro->bindTo($this, static::class);
|
||||
try {
|
||||
$macro = $macro->bindTo($this, static::class) ?? throw new RuntimeException;
|
||||
} catch (Throwable) {
|
||||
$macro = $macro->bindTo(null, static::class);
|
||||
}
|
||||
}
|
||||
|
||||
return $macro(...$parameters);
|
||||
|
||||
@@ -498,6 +498,7 @@ abstract class AbstractCursorPaginator implements Htmlable, Stringable
|
||||
* Resolve the current cursor or return the default value.
|
||||
*
|
||||
* @param string $cursorName
|
||||
* @param \Illuminate\Pagination\Cursor|null $default
|
||||
* @return \Illuminate\Pagination\Cursor|null
|
||||
*/
|
||||
public static function resolveCurrentCursor($cursorName = 'cursor', $default = null)
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
@if ($paginator->hasPages())
|
||||
<nav role="navigation" aria-label="{!! __('Pagination Navigation') !!}" class="flex justify-between">
|
||||
{{-- Previous Page Link --}}
|
||||
<nav role="navigation" aria-label="{{ __('Pagination Navigation') }}" class="flex gap-2 items-center justify-between">
|
||||
|
||||
@if ($paginator->onFirstPage())
|
||||
<span class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 rounded-md dark:text-gray-600 dark:bg-gray-800 dark:border-gray-600">
|
||||
<span class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-600 bg-white border border-gray-300 cursor-not-allowed leading-5 rounded-md dark:text-gray-300 dark:bg-gray-700 dark:border-gray-600">
|
||||
{!! __('pagination.previous') !!}
|
||||
</span>
|
||||
@else
|
||||
<a href="{{ $paginator->previousPageUrl() }}" rel="prev" class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-500 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300">
|
||||
<a href="{{ $paginator->previousPageUrl() }}" rel="prev" class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-700 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-800 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-200 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-900 dark:hover:text-gray-200">
|
||||
{!! __('pagination.previous') !!}
|
||||
</a>
|
||||
@endif
|
||||
|
||||
{{-- Next Page Link --}}
|
||||
@if ($paginator->hasMorePages())
|
||||
<a href="{{ $paginator->nextPageUrl() }}" rel="next" class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-500 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300">
|
||||
<a href="{{ $paginator->nextPageUrl() }}" rel="next" class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-700 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-800 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-200 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-900 dark:hover:text-gray-200">
|
||||
{!! __('pagination.next') !!}
|
||||
</a>
|
||||
@else
|
||||
<span class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 rounded-md dark:text-gray-600 dark:bg-gray-800 dark:border-gray-600">
|
||||
<span class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-600 bg-white border border-gray-300 cursor-not-allowed leading-5 rounded-md dark:text-gray-300 dark:bg-gray-700 dark:border-gray-600">
|
||||
{!! __('pagination.next') !!}
|
||||
</span>
|
||||
@endif
|
||||
|
||||
</nav>
|
||||
@endif
|
||||
|
||||
@@ -1,30 +1,34 @@
|
||||
@if ($paginator->hasPages())
|
||||
<nav role="navigation" aria-label="{{ __('Pagination Navigation') }}" class="flex items-center justify-between">
|
||||
<div class="flex justify-between flex-1 sm:hidden">
|
||||
<nav role="navigation" aria-label="{{ __('Pagination Navigation') }}">
|
||||
|
||||
<div class="flex gap-2 items-center justify-between sm:hidden">
|
||||
|
||||
@if ($paginator->onFirstPage())
|
||||
<span class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 rounded-md dark:text-gray-600 dark:bg-gray-800 dark:border-gray-600">
|
||||
<span class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-600 bg-white border border-gray-300 cursor-not-allowed leading-5 rounded-md dark:text-gray-300 dark:bg-gray-700 dark:border-gray-600">
|
||||
{!! __('pagination.previous') !!}
|
||||
</span>
|
||||
@else
|
||||
<a href="{{ $paginator->previousPageUrl() }}" class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-500 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300">
|
||||
<a href="{{ $paginator->previousPageUrl() }}" rel="prev" class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-700 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-800 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-200 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-900 dark:hover:text-gray-200">
|
||||
{!! __('pagination.previous') !!}
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if ($paginator->hasMorePages())
|
||||
<a href="{{ $paginator->nextPageUrl() }}" class="relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-500 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300">
|
||||
<a href="{{ $paginator->nextPageUrl() }}" rel="next" class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-700 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-800 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-200 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-900 dark:hover:text-gray-200">
|
||||
{!! __('pagination.next') !!}
|
||||
</a>
|
||||
@else
|
||||
<span class="relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 rounded-md dark:text-gray-600 dark:bg-gray-800 dark:border-gray-600">
|
||||
<span class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-600 bg-white border border-gray-300 cursor-not-allowed leading-5 rounded-md dark:text-gray-300 dark:bg-gray-700 dark:border-gray-600">
|
||||
{!! __('pagination.next') !!}
|
||||
</span>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
<div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between">
|
||||
<div class="hidden sm:flex-1 sm:flex sm:gap-2 sm:items-center sm:justify-between">
|
||||
|
||||
<div>
|
||||
<p class="text-sm text-gray-700 leading-5 dark:text-gray-400">
|
||||
<p class="text-sm text-gray-700 leading-5 dark:text-gray-600">
|
||||
{!! __('Showing') !!}
|
||||
@if ($paginator->firstItem())
|
||||
<span class="font-medium">{{ $paginator->firstItem() }}</span>
|
||||
@@ -40,18 +44,19 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="relative z-0 inline-flex rtl:flex-row-reverse shadow-sm rounded-md">
|
||||
<span class="inline-flex rtl:flex-row-reverse shadow-sm rounded-md">
|
||||
|
||||
{{-- Previous Page Link --}}
|
||||
@if ($paginator->onFirstPage())
|
||||
<span aria-disabled="true" aria-label="{{ __('pagination.previous') }}">
|
||||
<span class="relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default rounded-l-md leading-5 dark:bg-gray-800 dark:border-gray-600" aria-hidden="true">
|
||||
<span class="inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-not-allowed rounded-l-md leading-5 dark:bg-gray-700 dark:border-gray-600 dark:text-gray-400" aria-hidden="true">
|
||||
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
@else
|
||||
<a href="{{ $paginator->previousPageUrl() }}" rel="prev" class="relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-l-md leading-5 hover:text-gray-400 focus:z-10 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:active:bg-gray-700 dark:focus:border-blue-800" aria-label="{{ __('pagination.previous') }}">
|
||||
<a href="{{ $paginator->previousPageUrl() }}" rel="prev" class="inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-l-md leading-5 hover:text-gray-400 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:active:bg-gray-700 dark:focus:border-blue-800 dark:text-gray-300 dark:hover:bg-gray-900 dark:hover:text-gray-300" aria-label="{{ __('pagination.previous') }}">
|
||||
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
@@ -63,7 +68,7 @@
|
||||
{{-- "Three Dots" Separator --}}
|
||||
@if (is_string($element))
|
||||
<span aria-disabled="true">
|
||||
<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">{{ $element }}</span>
|
||||
<span class="inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300">{{ $element }}</span>
|
||||
</span>
|
||||
@endif
|
||||
|
||||
@@ -72,10 +77,10 @@
|
||||
@foreach ($element as $page => $url)
|
||||
@if ($page == $paginator->currentPage())
|
||||
<span aria-current="page">
|
||||
<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">{{ $page }}</span>
|
||||
<span class="inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-gray-200 border border-gray-300 cursor-default leading-5 dark:bg-gray-700 dark:border-gray-600 dark:text-gray-300">{{ $page }}</span>
|
||||
</span>
|
||||
@else
|
||||
<a href="{{ $url }}" class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 hover:text-gray-500 focus:z-10 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-400 dark:hover:text-gray-300 dark:active:bg-gray-700 dark:focus:border-blue-800" aria-label="{{ __('Go to page :page', ['page' => $page]) }}">
|
||||
<a href="{{ $url }}" class="inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 hover:text-gray-700 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:hover:text-gray-300 dark:active:bg-gray-700 dark:focus:border-blue-800 hover:bg-gray-100 dark:hover:bg-gray-900" aria-label="{{ __('Go to page :page', ['page' => $page]) }}">
|
||||
{{ $page }}
|
||||
</a>
|
||||
@endif
|
||||
@@ -85,14 +90,14 @@
|
||||
|
||||
{{-- Next Page Link --}}
|
||||
@if ($paginator->hasMorePages())
|
||||
<a href="{{ $paginator->nextPageUrl() }}" rel="next" class="relative inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-r-md leading-5 hover:text-gray-400 focus:z-10 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:active:bg-gray-700 dark:focus:border-blue-800" aria-label="{{ __('pagination.next') }}">
|
||||
<a href="{{ $paginator->nextPageUrl() }}" rel="next" class="inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-r-md leading-5 hover:text-gray-400 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:active:bg-gray-700 dark:focus:border-blue-800 dark:text-gray-300 dark:hover:bg-gray-900 dark:hover:text-gray-300" aria-label="{{ __('pagination.next') }}">
|
||||
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</a>
|
||||
@else
|
||||
<span aria-disabled="true" aria-label="{{ __('pagination.next') }}">
|
||||
<span class="relative inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default rounded-r-md leading-5 dark:bg-gray-800 dark:border-gray-600" aria-hidden="true">
|
||||
<span class="inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-not-allowed rounded-r-md leading-5 dark:bg-gray-700 dark:border-gray-600 dark:text-gray-400" aria-hidden="true">
|
||||
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
|
||||
21
plugins/vendor/illuminate/reflection/LICENSE.md
vendored
Normal file
21
plugins/vendor/illuminate/reflection/LICENSE.md
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Taylor Otwell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -64,6 +64,7 @@ class Reflector
|
||||
*
|
||||
* @param object|class-string $objectOrClass
|
||||
* @param class-string<TAttribute> $attribute
|
||||
* @param bool $ascend
|
||||
* @return TAttribute|null
|
||||
*/
|
||||
public static function getClassAttribute($objectOrClass, $attribute, $ascend = false)
|
||||
@@ -79,6 +80,7 @@ class Reflector
|
||||
*
|
||||
* @param TTarget|class-string<TTarget> $objectOrClass
|
||||
* @param class-string<TAttribute> $attribute
|
||||
* @param bool $includeParents
|
||||
* @return ($includeParents is true ? Collection<class-string<contravariant TTarget>, Collection<int, TAttribute>> : Collection<int, TAttribute>)
|
||||
*/
|
||||
public static function getClassAttributes($objectOrClass, $attribute, $includeParents = false)
|
||||
@@ -6,6 +6,8 @@ use Closure;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Reflector;
|
||||
use ReflectionFunction;
|
||||
use ReflectionIntersectionType;
|
||||
use ReflectionUnionType;
|
||||
use RuntimeException;
|
||||
|
||||
trait ReflectsClosures
|
||||
@@ -92,4 +94,33 @@ trait ReflectsClosures
|
||||
})
|
||||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class names / types of the return type of the given Closure.
|
||||
*
|
||||
* @param \Closure $closure
|
||||
* @return list<class-string>
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
protected function closureReturnTypes(Closure $closure)
|
||||
{
|
||||
$reflection = new ReflectionFunction($closure);
|
||||
|
||||
if ($reflection->getReturnType() === null ||
|
||||
$reflection->getReturnType() instanceof ReflectionIntersectionType) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$types = $reflection->getReturnType() instanceof ReflectionUnionType
|
||||
? $reflection->getReturnType()->getTypes()
|
||||
: [$reflection->getReturnType()];
|
||||
|
||||
return (new Collection($types))
|
||||
->reject(fn ($type) => $type->isBuiltin())
|
||||
->reject(fn ($type) => in_array($type->getName(), ['static', 'self']))
|
||||
->map(fn ($type) => $type->getName())
|
||||
->values()
|
||||
->all();
|
||||
}
|
||||
}
|
||||
38
plugins/vendor/illuminate/reflection/composer.json
vendored
Normal file
38
plugins/vendor/illuminate/reflection/composer.json
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "illuminate/reflection",
|
||||
"description": "The Illuminate Reflection package.",
|
||||
"license": "MIT",
|
||||
"homepage": "https://laravel.com",
|
||||
"support": {
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylor@laravel.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"illuminate/contracts": "^12.0",
|
||||
"illuminate/collections": "^12.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Illuminate\\Support\\": ""
|
||||
},
|
||||
"files": [
|
||||
"helpers.php"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "12.x-dev"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
97
plugins/vendor/illuminate/reflection/helpers.php
vendored
Normal file
97
plugins/vendor/illuminate/reflection/helpers.php
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Traits\ReflectsClosures;
|
||||
|
||||
if (! function_exists('lazy')) {
|
||||
/**
|
||||
* Create a lazy instance.
|
||||
*
|
||||
* @template TValue of object
|
||||
*
|
||||
* @param class-string<TValue>|(\Closure(TValue): mixed) $class
|
||||
* @param (\Closure(TValue): mixed)|int $callback
|
||||
* @param int $options
|
||||
* @param array<string, mixed> $eager
|
||||
* @return TValue
|
||||
*/
|
||||
function lazy($class, $callback = 0, $options = 0, $eager = [])
|
||||
{
|
||||
static $closureReflector;
|
||||
|
||||
$closureReflector ??= new class
|
||||
{
|
||||
use ReflectsClosures;
|
||||
|
||||
public function typeFromParameter($callback)
|
||||
{
|
||||
return $this->firstClosureParameterType($callback);
|
||||
}
|
||||
};
|
||||
|
||||
[$class, $callback, $options] = is_string($class)
|
||||
? [$class, $callback, $options]
|
||||
: [$closureReflector->typeFromParameter($class), $class, $callback ?: $options];
|
||||
|
||||
$reflectionClass = new ReflectionClass($class);
|
||||
|
||||
$instance = $reflectionClass->newLazyGhost(function ($instance) use ($callback) {
|
||||
$result = $callback($instance);
|
||||
|
||||
if (is_array($result)) {
|
||||
$instance->__construct(...$result);
|
||||
}
|
||||
}, $options);
|
||||
|
||||
foreach ($eager as $property => $value) {
|
||||
$reflectionClass->getProperty($property)->setRawValueWithoutLazyInitialization($instance, $value);
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('proxy')) {
|
||||
/**
|
||||
* Create a lazy proxy instance.
|
||||
*
|
||||
* @template TValue of object
|
||||
*
|
||||
* @param class-string<TValue>|(\Closure(TValue): TValue) $class
|
||||
* @param (\Closure(TValue): TValue)|int $callback
|
||||
* @param int $options
|
||||
* @param array<string, mixed> $eager
|
||||
* @return TValue
|
||||
*/
|
||||
function proxy($class, $callback = 0, $options = 0, $eager = [])
|
||||
{
|
||||
static $closureReflector;
|
||||
|
||||
$closureReflector = new class
|
||||
{
|
||||
use ReflectsClosures;
|
||||
|
||||
public function get($callback)
|
||||
{
|
||||
return $this->closureReturnTypes($callback)[0] ?? $this->firstClosureParameterType($callback);
|
||||
}
|
||||
};
|
||||
|
||||
[$class, $callback, $options] = is_string($class)
|
||||
? [$class, $callback, $options]
|
||||
: [$closureReflector->get($class), $class, $callback ?: $options];
|
||||
|
||||
$reflectionClass = new ReflectionClass($class);
|
||||
|
||||
$proxy = $reflectionClass->newLazyProxy(function () use ($callback, $eager, &$proxy) {
|
||||
$instance = $callback($proxy, $eager);
|
||||
|
||||
return $instance;
|
||||
}, $options);
|
||||
|
||||
foreach ($eager as $property => $value) {
|
||||
$reflectionClass->getProperty($property)->setRawValueWithoutLazyInitialization($proxy, $value);
|
||||
}
|
||||
|
||||
return $proxy;
|
||||
}
|
||||
}
|
||||
@@ -7,14 +7,14 @@ class AggregateServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* The provider class names.
|
||||
*
|
||||
* @var array
|
||||
* @var array<int, class-string<\Illuminate\Support\ServiceProvider>>
|
||||
*/
|
||||
protected $providers = [];
|
||||
|
||||
/**
|
||||
* An array of the service provider instances.
|
||||
*
|
||||
* @var array
|
||||
* @var array<int, \Illuminate\Support\ServiceProvider>
|
||||
*/
|
||||
protected $instances = [];
|
||||
|
||||
@@ -35,7 +35,7 @@ class AggregateServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
|
||||
class Benchmark
|
||||
{
|
||||
use Macroable;
|
||||
|
||||
/**
|
||||
* Measure a callable or array of callables over the given number of iterations.
|
||||
*
|
||||
|
||||
99
plugins/vendor/illuminate/support/BinaryCodec.php
vendored
Normal file
99
plugins/vendor/illuminate/support/BinaryCodec.php
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
use Symfony\Component\Uid\Ulid;
|
||||
|
||||
class BinaryCodec
|
||||
{
|
||||
/** @var array<string, array{encode: callable(UuidInterface|Ulid|string|null): ?string, decode: callable(?string): ?string}> */
|
||||
protected static array $customCodecs = [];
|
||||
|
||||
/**
|
||||
* Register a custom codec.
|
||||
*/
|
||||
public static function register(string $name, callable $encode, callable $decode): void
|
||||
{
|
||||
self::$customCodecs[$name] = [
|
||||
'encode' => $encode,
|
||||
'decode' => $decode,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a value to binary.
|
||||
*/
|
||||
public static function encode(UuidInterface|Ulid|string|null $value, string $format): ?string
|
||||
{
|
||||
if (blank($value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isset(self::$customCodecs[$format])) {
|
||||
return (self::$customCodecs[$format]['encode'])($value);
|
||||
}
|
||||
|
||||
return match ($format) {
|
||||
'uuid' => match (true) {
|
||||
$value instanceof UuidInterface => $value->getBytes(),
|
||||
self::isBinary($value) => $value,
|
||||
default => Uuid::fromString($value)->getBytes(),
|
||||
},
|
||||
'ulid' => match (true) {
|
||||
$value instanceof Ulid => $value->toBinary(),
|
||||
self::isBinary($value) => $value,
|
||||
default => Ulid::fromString($value)->toBinary(),
|
||||
},
|
||||
default => throw new InvalidArgumentException("Format [$format] is invalid."),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a binary value to string.
|
||||
*/
|
||||
public static function decode(?string $value, string $format): ?string
|
||||
{
|
||||
if (blank($value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isset(self::$customCodecs[$format])) {
|
||||
return (self::$customCodecs[$format]['decode'])($value);
|
||||
}
|
||||
|
||||
return match ($format) {
|
||||
'uuid' => (self::isBinary($value) ? Uuid::fromBytes($value) : Uuid::fromString($value))->toString(),
|
||||
'ulid' => (self::isBinary($value) ? Ulid::fromBinary($value) : Ulid::fromString($value))->toString(),
|
||||
default => throw new InvalidArgumentException("Format [$format] is invalid."),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all available format names.
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
public static function formats(): array
|
||||
{
|
||||
return array_unique([...['uuid', 'ulid'], ...array_keys(self::$customCodecs)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given value is binary data.
|
||||
*/
|
||||
public static function isBinary(mixed $value): bool
|
||||
{
|
||||
if (! is_string($value) || $value === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (str_contains($value, "\0")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return ! mb_check_encoding($value, 'UTF-8');
|
||||
}
|
||||
}
|
||||
38
plugins/vendor/illuminate/support/Carbon.php
vendored
38
plugins/vendor/illuminate/support/Carbon.php
vendored
@@ -33,4 +33,42 @@ class Carbon extends BaseCarbon
|
||||
|
||||
return static::createFromInterface($id->getDateTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current date / time plus a given amount of time.
|
||||
*/
|
||||
public function plus(
|
||||
int $years = 0,
|
||||
int $months = 0,
|
||||
int $weeks = 0,
|
||||
int $days = 0,
|
||||
int $hours = 0,
|
||||
int $minutes = 0,
|
||||
int $seconds = 0,
|
||||
int $microseconds = 0
|
||||
): static {
|
||||
return $this->add("
|
||||
$years years $months months $weeks weeks $days days
|
||||
$hours hours $minutes minutes $seconds seconds $microseconds microseconds
|
||||
");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current date / time minus a given amount of time.
|
||||
*/
|
||||
public function minus(
|
||||
int $years = 0,
|
||||
int $months = 0,
|
||||
int $weeks = 0,
|
||||
int $days = 0,
|
||||
int $hours = 0,
|
||||
int $minutes = 0,
|
||||
int $seconds = 0,
|
||||
int $microseconds = 0
|
||||
): static {
|
||||
return $this->sub("
|
||||
$years years $months months $weeks weeks $days days
|
||||
$hours hours $minutes minutes $seconds seconds $microseconds microseconds
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
13
plugins/vendor/illuminate/support/Env.php
vendored
13
plugins/vendor/illuminate/support/Env.php
vendored
@@ -5,7 +5,6 @@ namespace Illuminate\Support;
|
||||
use Closure;
|
||||
use Dotenv\Repository\Adapter\PutenvAdapter;
|
||||
use Dotenv\Repository\RepositoryBuilder;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use PhpOption\Option;
|
||||
use RuntimeException;
|
||||
@@ -126,8 +125,8 @@ class Env
|
||||
* @param bool $overwrite
|
||||
* @return void
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws FileNotFoundException
|
||||
* @throws \RuntimeException
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public static function writeVariables(array $variables, string $pathToFile, bool $overwrite = false): void
|
||||
{
|
||||
@@ -155,8 +154,8 @@ class Env
|
||||
* @param bool $overwrite
|
||||
* @return void
|
||||
*
|
||||
* @throws RuntimeException
|
||||
* @throws FileNotFoundException
|
||||
* @throws \RuntimeException
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public static function writeVariable(string $key, mixed $value, string $pathToFile, bool $overwrite = false): void
|
||||
{
|
||||
@@ -188,7 +187,7 @@ class Env
|
||||
$prefix = explode('_', $key)[0].'_';
|
||||
$lastPrefixIndex = -1;
|
||||
|
||||
$shouldQuote = preg_match('/^[a-zA-z0-9]+$/', $value) === 0;
|
||||
$shouldQuote = preg_match('/^[a-zA-Z0-9]+$/', $value) === 0;
|
||||
|
||||
$lineToAddVariations = [
|
||||
$key.'='.(is_string($value) ? self::prepareQuotedValue($value) : $value),
|
||||
@@ -285,7 +284,7 @@ class Env
|
||||
*/
|
||||
protected static function prepareQuotedValue(string $input)
|
||||
{
|
||||
return strpos($input, '"') !== false
|
||||
return str_contains($input, '"')
|
||||
? "'".self::addSlashesExceptFor($input, ['"'])."'"
|
||||
: '"'.self::addSlashesExceptFor($input, ["'"]).'"';
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ use RuntimeException;
|
||||
* @method static \Symfony\Component\HttpFoundation\Response|null basic(string $field = 'email', array $extraConditions = [])
|
||||
* @method static \Symfony\Component\HttpFoundation\Response|null onceBasic(string $field = 'email', array $extraConditions = [])
|
||||
* @method static bool attemptWhen(array $credentials = [], array|callable|null $callbacks = null, bool $remember = false)
|
||||
* @method static string hashPasswordForCookie(string $passwordHash)
|
||||
* @method static void logoutCurrentDevice()
|
||||
* @method static \Illuminate\Contracts\Auth\Authenticatable|null logoutOtherDevices(string $password)
|
||||
* @method static void attempting(mixed $callback)
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static void include(string $path, string|null $alias = null)
|
||||
* @method static void aliasInclude(string $path, string|null $alias = null)
|
||||
* @method static void bindDirective(string $name, callable $handler)
|
||||
* @method static void directive(string $name, callable $handler, bool $bind = false)
|
||||
* @method static void directive(string $name, \Closure|callable $handler, bool $bind = false)
|
||||
* @method static array getCustomDirectives()
|
||||
* @method static \Illuminate\View\Compilers\BladeCompiler prepareStringsForCompilationUsing(callable $callback)
|
||||
* @method static void precompiler(callable $precompiler)
|
||||
|
||||
@@ -24,7 +24,7 @@ use Illuminate\Support\Testing\Fakes\BusFake;
|
||||
* @method static \Illuminate\Bus\Dispatcher withoutDispatchingAfterResponses()
|
||||
* @method static \Illuminate\Support\Testing\Fakes\BusFake except(array|string $jobsToDispatch)
|
||||
* @method static void assertDispatched(string|\Closure $command, callable|int|null $callback = null)
|
||||
* @method static void assertDispatchedOnce(string|\Closure $command, int $times = null)
|
||||
* @method static void assertDispatchedOnce(string|\Closure $command)
|
||||
* @method static void assertDispatchedTimes(string|\Closure $command, int $times = 1)
|
||||
* @method static void assertNotDispatched(string|\Closure $command, callable|null $callback = null)
|
||||
* @method static void assertNothingDispatched()
|
||||
@@ -38,7 +38,7 @@ use Illuminate\Support\Testing\Fakes\BusFake;
|
||||
* @method static void assertNothingChained()
|
||||
* @method static void assertDispatchedWithoutChain(string|\Closure $command, callable|null $callback = null)
|
||||
* @method static \Illuminate\Support\Testing\Fakes\ChainedBatchTruthTest chainedBatch(\Closure $callback)
|
||||
* @method static void assertBatched(callable $callback)
|
||||
* @method static void assertBatched(array|callable $callback)
|
||||
* @method static void assertBatchCount(int $count)
|
||||
* @method static void assertNothingBatched()
|
||||
* @method static void assertNothingPlaced()
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Mockery;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Contracts\Cache\Repository store(string|null $name = null)
|
||||
* @method static \Illuminate\Contracts\Cache\Repository driver(string|null $driver = null)
|
||||
@@ -16,26 +18,33 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static void purge(string|null $name = null)
|
||||
* @method static \Illuminate\Cache\CacheManager extend(string $driver, \Closure $callback)
|
||||
* @method static \Illuminate\Cache\CacheManager setApplication(\Illuminate\Contracts\Foundation\Application $app)
|
||||
* @method static bool has(array|string $key)
|
||||
* @method static bool missing(string $key)
|
||||
* @method static mixed get(array|string $key, mixed $default = null)
|
||||
* @method static bool has(\UnitEnum|array|string $key)
|
||||
* @method static bool missing(\UnitEnum|string $key)
|
||||
* @method static mixed get(\UnitEnum|array|string $key, mixed $default = null)
|
||||
* @method static array many(array $keys)
|
||||
* @method static iterable getMultiple(iterable $keys, mixed $default = null)
|
||||
* @method static mixed pull(array|string $key, mixed $default = null)
|
||||
* @method static bool put(array|string $key, mixed $value, \DateTimeInterface|\DateInterval|int|null $ttl = null)
|
||||
* @method static bool set(string $key, mixed $value, null|int|\DateInterval $ttl = null)
|
||||
* @method static mixed pull(\UnitEnum|array|string $key, mixed $default = null)
|
||||
* @method static string string(\UnitEnum|string $key, \Closure|string|null $default = null)
|
||||
* @method static int integer(\UnitEnum|string $key, \Closure|int|null $default = null)
|
||||
* @method static float float(\UnitEnum|string $key, \Closure|float|null $default = null)
|
||||
* @method static bool boolean(\UnitEnum|string $key, \Closure|bool|null $default = null)
|
||||
* @method static array array(\UnitEnum|string $key, \Closure|array|null $default = null)
|
||||
* @method static bool put(\UnitEnum|array|string $key, mixed $value, \DateTimeInterface|\DateInterval|int|null $ttl = null)
|
||||
* @method static bool set(\UnitEnum|array|string $key, mixed $value, \DateTimeInterface|\DateInterval|int|null $ttl = null)
|
||||
* @method static bool putMany(array $values, \DateTimeInterface|\DateInterval|int|null $ttl = null)
|
||||
* @method static bool setMultiple(iterable $values, null|int|\DateInterval $ttl = null)
|
||||
* @method static bool add(string $key, mixed $value, \DateTimeInterface|\DateInterval|int|null $ttl = null)
|
||||
* @method static int|bool increment(string $key, mixed $value = 1)
|
||||
* @method static int|bool decrement(string $key, mixed $value = 1)
|
||||
* @method static bool forever(string $key, mixed $value)
|
||||
* @method static mixed remember(string $key, \Closure|\DateTimeInterface|\DateInterval|int|null $ttl, \Closure $callback)
|
||||
* @method static mixed sear(string $key, \Closure $callback)
|
||||
* @method static mixed rememberForever(string $key, \Closure $callback)
|
||||
* @method static mixed flexible(string $key, array $ttl, callable $callback, array|null $lock = null, bool $alwaysDefer = false)
|
||||
* @method static bool forget(string $key)
|
||||
* @method static bool delete(string $key)
|
||||
* @method static bool add(\UnitEnum|array|string $key, mixed $value, \DateTimeInterface|\DateInterval|int|null $ttl = null)
|
||||
* @method static int|bool increment(\UnitEnum|string $key, mixed $value = 1)
|
||||
* @method static int|bool decrement(\UnitEnum|string $key, mixed $value = 1)
|
||||
* @method static bool forever(\UnitEnum|string $key, mixed $value)
|
||||
* @method static mixed remember(\UnitEnum|string $key, \Closure|\DateTimeInterface|\DateInterval|int|null $ttl, \Closure $callback)
|
||||
* @method static mixed sear(\UnitEnum|string $key, \Closure $callback)
|
||||
* @method static mixed rememberForever(\UnitEnum|string $key, \Closure $callback)
|
||||
* @method static mixed flexible(\UnitEnum|string $key, array $ttl, callable $callback, array|null $lock = null, bool $alwaysDefer = false)
|
||||
* @method static mixed withoutOverlapping(\UnitEnum|string $key, callable $callback, int $lockFor = 0, int $waitFor = 10, string|null $owner = null)
|
||||
* @method static \Illuminate\Cache\Limiters\ConcurrencyLimiterBuilder funnel(\UnitEnum|string $name)
|
||||
* @method static bool forget(\UnitEnum|array|string $key)
|
||||
* @method static bool delete(\UnitEnum|array|string $key)
|
||||
* @method static bool deleteMultiple(iterable $keys)
|
||||
* @method static bool clear()
|
||||
* @method static \Illuminate\Cache\TaggedCache tags(mixed $names)
|
||||
@@ -71,4 +80,27 @@ class Cache extends Facade
|
||||
{
|
||||
return 'cache';
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the facade into a Mockery spy.
|
||||
*
|
||||
* @return \Mockery\MockInterface
|
||||
*/
|
||||
public static function spy()
|
||||
{
|
||||
if (! static::isMock()) {
|
||||
$class = static::getMockableClass();
|
||||
$instance = static::getFacadeRoot();
|
||||
|
||||
if ($class && $instance) {
|
||||
return tap(Mockery::spy($instance)->makePartial(), function ($spy) {
|
||||
static::swap($spy);
|
||||
});
|
||||
}
|
||||
|
||||
return tap($class ? Mockery::spy($class) : Mockery::spy(), function ($spy) {
|
||||
static::swap($spy);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ use Illuminate\Concurrency\ConcurrencyManager;
|
||||
|
||||
/**
|
||||
* @method static mixed driver(string|null $name = null)
|
||||
* @method static \Illuminate\Concurrency\ProcessDriver createProcessDriver(array $config)
|
||||
* @method static \Illuminate\Concurrency\ForkDriver createForkDriver(array $config)
|
||||
* @method static \Illuminate\Concurrency\SyncDriver createSyncDriver(array $config)
|
||||
* @method static \Illuminate\Concurrency\ProcessDriver createProcessDriver()
|
||||
* @method static \Illuminate\Concurrency\ForkDriver createForkDriver()
|
||||
* @method static \Illuminate\Concurrency\SyncDriver createSyncDriver()
|
||||
* @method static string getDefaultInstance()
|
||||
* @method static void setDefaultInstance(string $name)
|
||||
* @method static array getInstanceConfig(string $name)
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static string encryptString(string $value)
|
||||
* @method static mixed decrypt(string $payload, bool $unserialize = true)
|
||||
* @method static string decryptString(string $payload)
|
||||
* @method static bool appearsEncrypted(mixed $value)
|
||||
* @method static string getKey()
|
||||
* @method static array getAllKeys()
|
||||
* @method static array getPreviousKeys()
|
||||
|
||||
@@ -76,6 +76,7 @@ use Illuminate\Database\Console\WipeCommand;
|
||||
* @method static \PDO|\Closure|null getRawReadPdo()
|
||||
* @method static \Illuminate\Database\Connection setPdo(\PDO|\Closure|null $pdo)
|
||||
* @method static \Illuminate\Database\Connection setReadPdo(\PDO|\Closure|null $pdo)
|
||||
* @method static \Illuminate\Database\Connection setReadPdoConfig(array $config)
|
||||
* @method static string|null getName()
|
||||
* @method static string|null getNameWithReadWriteType()
|
||||
* @method static mixed getConfig(string|null $option = null)
|
||||
@@ -87,7 +88,7 @@ use Illuminate\Database\Console\WipeCommand;
|
||||
* @method static \Illuminate\Database\Connection setSchemaGrammar(\Illuminate\Database\Schema\Grammars\Grammar $grammar)
|
||||
* @method static \Illuminate\Database\Query\Processors\Processor getPostProcessor()
|
||||
* @method static \Illuminate\Database\Connection setPostProcessor(\Illuminate\Database\Query\Processors\Processor $processor)
|
||||
* @method static \Illuminate\Contracts\Events\Dispatcher getEventDispatcher()
|
||||
* @method static \Illuminate\Contracts\Events\Dispatcher|null getEventDispatcher()
|
||||
* @method static \Illuminate\Database\Connection setEventDispatcher(\Illuminate\Contracts\Events\Dispatcher $events)
|
||||
* @method static void unsetEventDispatcher()
|
||||
* @method static \Illuminate\Database\Connection setTransactionManager(\Illuminate\Database\DatabaseTransactionsManager $manager)
|
||||
@@ -114,6 +115,7 @@ use Illuminate\Database\Console\WipeCommand;
|
||||
* @method static void rollBack(int|null $toLevel = null)
|
||||
* @method static int transactionLevel()
|
||||
* @method static void afterCommit(callable $callback)
|
||||
* @method static void afterRollBack(callable $callback)
|
||||
*
|
||||
* @see \Illuminate\Database\DatabaseManager
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@ use Illuminate\Support\Testing\Fakes\EventFake;
|
||||
* @method static void push(string $event, object|array $payload = [])
|
||||
* @method static void flush(string $event)
|
||||
* @method static void subscribe(object|string $subscriber)
|
||||
* @method static mixed until(string|object $event, mixed $payload = [])
|
||||
* @method static array|null until(string|object $event, mixed $payload = [])
|
||||
* @method static array|null dispatch(string|object $event, mixed $payload = [], bool $halt = false)
|
||||
* @method static array getListeners(string $eventName)
|
||||
* @method static \Closure makeListener(\Closure|string|array $listener, bool $wildcard = false)
|
||||
@@ -21,7 +21,7 @@ use Illuminate\Support\Testing\Fakes\EventFake;
|
||||
* @method static void forgetPushed()
|
||||
* @method static \Illuminate\Events\Dispatcher setQueueResolver(callable $resolver)
|
||||
* @method static \Illuminate\Events\Dispatcher setTransactionManagerResolver(callable $resolver)
|
||||
* @method static mixed defer(callable $callback, array|null $events = null)
|
||||
* @method static mixed defer(callable $callback, string[]|null $events = null)
|
||||
* @method static array getRawListeners()
|
||||
* @method static void macro(string $name, object|callable $macro)
|
||||
* @method static void mixin(object $mixin, bool $replace = true)
|
||||
@@ -30,7 +30,7 @@ use Illuminate\Support\Testing\Fakes\EventFake;
|
||||
* @method static \Illuminate\Support\Testing\Fakes\EventFake except(array|string $eventsToDispatch)
|
||||
* @method static void assertListening(string $expectedEvent, string|array $expectedListener)
|
||||
* @method static void assertDispatched(string|\Closure $event, callable|int|null $callback = null)
|
||||
* @method static void assertDispatchedOnce(string $event, int $times = null)
|
||||
* @method static void assertDispatchedOnce(string $event)
|
||||
* @method static void assertDispatchedTimes(string $event, int $times = 1)
|
||||
* @method static void assertNotDispatched(string|\Closure $event, callable|null $callback = null)
|
||||
* @method static void assertNothingDispatched()
|
||||
|
||||
@@ -247,12 +247,12 @@ abstract class Facade
|
||||
/**
|
||||
* Clear a resolved facade instance.
|
||||
*
|
||||
* @param string $name
|
||||
* @param ?string $name
|
||||
* @return void
|
||||
*/
|
||||
public static function clearResolvedInstance($name)
|
||||
public static function clearResolvedInstance($name = null)
|
||||
{
|
||||
unset(static::$resolvedInstance[$name]);
|
||||
unset(static::$resolvedInstance[$name ?? static::getFacadeAccessor()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static string dirname(string $path)
|
||||
* @method static string extension(string $path)
|
||||
* @method static string|null guessExtension(string $path)
|
||||
* @method static string type(string $path)
|
||||
* @method static string|false type(string $path)
|
||||
* @method static string|false mimeType(string $path)
|
||||
* @method static int size(string $path)
|
||||
* @method static int lastModified(string $path)
|
||||
@@ -39,9 +39,10 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static bool hasSameHash(string $firstFile, string $secondFile)
|
||||
* @method static bool isFile(string $file)
|
||||
* @method static array glob(string $pattern, int $flags = 0)
|
||||
* @method static \Symfony\Component\Finder\SplFileInfo[] files(string $directory, bool $hidden = false)
|
||||
* @method static \Symfony\Component\Finder\SplFileInfo[] files(string $directory, bool $hidden = false, array|string|int $depth = 0)
|
||||
* @method static \Symfony\Component\Finder\SplFileInfo[] allFiles(string $directory, bool $hidden = false)
|
||||
* @method static array directories(string $directory)
|
||||
* @method static array directories(string $directory, array|string|int $depth = 0)
|
||||
* @method static array allDirectories(string $directory)
|
||||
* @method static void ensureDirectoryExists(string $path, int $mode = 0755, bool $recursive = true)
|
||||
* @method static bool makeDirectory(string $path, int $mode = 0755, bool $recursive = false, bool $force = false)
|
||||
* @method static bool moveDirectory(string $from, string $to, bool $overwrite = false)
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Illuminate\Support\Facades;
|
||||
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
|
||||
|
||||
/**
|
||||
* @method static bool has(string|array $ability)
|
||||
* @method static bool has(\UnitEnum|array|string $ability)
|
||||
* @method static \Illuminate\Auth\Access\Response allowIf(\Illuminate\Auth\Access\Response|\Closure|bool $condition, string|null $message = null, string|null $code = null)
|
||||
* @method static \Illuminate\Auth\Access\Response denyIf(\Illuminate\Auth\Access\Response|\Closure|bool $condition, string|null $message = null, string|null $code = null)
|
||||
* @method static \Illuminate\Auth\Access\Gate define(\UnitEnum|string $ability, callable|array|string $callback)
|
||||
|
||||
@@ -65,20 +65,23 @@ use Illuminate\Http\Client\Factory;
|
||||
* @method static \Illuminate\Http\Client\PendingRequest withMiddleware(callable $middleware)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest withRequestMiddleware(callable $middleware)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest withResponseMiddleware(callable $middleware)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest withAttributes(array $attributes)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest beforeSending(callable $callback)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest afterResponse(callable|null $callback)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest throw(callable|null $callback = null)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest throwIf(callable|bool $condition)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest throwUnless(callable|bool $condition)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest dump()
|
||||
* @method static \Illuminate\Http\Client\PendingRequest dd()
|
||||
* @method static \Illuminate\Http\Client\Response get(string $url, array|string|null $query = null)
|
||||
* @method static \Illuminate\Http\Client\Response head(string $url, array|string|null $query = null)
|
||||
* @method static \Illuminate\Http\Client\Response post(string $url, array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable $data = [])
|
||||
* @method static \Illuminate\Http\Client\Response patch(string $url, array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable $data = [])
|
||||
* @method static \Illuminate\Http\Client\Response put(string $url, array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable $data = [])
|
||||
* @method static \Illuminate\Http\Client\Response delete(string $url, array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable $data = [])
|
||||
* @method static array pool(callable $callback)
|
||||
* @method static \Illuminate\Http\Client\Response send(string $method, string $url, array $options = [])
|
||||
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface get(string $url, array|string|null $query = null)
|
||||
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface head(string $url, array|string|null $query = null)
|
||||
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface post(string $url, array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable $data = [])
|
||||
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface patch(string $url, array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable $data = [])
|
||||
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface put(string $url, array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable $data = [])
|
||||
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface delete(string $url, array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable $data = [])
|
||||
* @method static array pool(callable $callback, int|null $concurrency = null)
|
||||
* @method static \Illuminate\Http\Client\Batch batch(callable $callback)
|
||||
* @method static \Illuminate\Http\Client\Response|\Illuminate\Http\Client\Promises\LazyPromise send(string $method, string $url, array $options = [])
|
||||
* @method static \GuzzleHttp\Client buildClient()
|
||||
* @method static \GuzzleHttp\Client createClient(\GuzzleHttp\HandlerStack $handlerStack)
|
||||
* @method static \GuzzleHttp\HandlerStack buildHandlerStack()
|
||||
@@ -86,7 +89,7 @@ use Illuminate\Http\Client\Factory;
|
||||
* @method static \Closure buildBeforeSendingHandler()
|
||||
* @method static \Closure buildRecorderHandler()
|
||||
* @method static \Closure buildStubHandler()
|
||||
* @method static \GuzzleHttp\Psr7\RequestInterface runBeforeSendingCallbacks(\GuzzleHttp\Psr7\RequestInterface $request, array $options)
|
||||
* @method static \Psr\Http\Message\RequestInterface runBeforeSendingCallbacks(\Psr\Http\Message\RequestInterface $request, array $options)
|
||||
* @method static array mergeOptions(array ...$options)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest stub(callable $callback)
|
||||
* @method static bool isAllowedRequestUrl(string $url)
|
||||
@@ -117,7 +120,7 @@ class Http extends Facade
|
||||
/**
|
||||
* Register a stub callable that will intercept requests and be able to return stub responses.
|
||||
*
|
||||
* @param \Closure|array $callback
|
||||
* @param \Closure|array|null $callback
|
||||
* @return \Illuminate\Http\Client\Factory
|
||||
*/
|
||||
public static function fake($callback = null)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static \Illuminate\Log\Logger withContext(array $context = [])
|
||||
* @method static void listen(\Closure $callback)
|
||||
* @method static \Psr\Log\LoggerInterface getLogger()
|
||||
* @method static \Illuminate\Contracts\Events\Dispatcher getEventDispatcher()
|
||||
* @method static \Illuminate\Contracts\Events\Dispatcher|null getEventDispatcher()
|
||||
* @method static void setEventDispatcher(\Illuminate\Contracts\Events\Dispatcher $dispatcher)
|
||||
* @method static \Illuminate\Log\Logger|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
|
||||
* @method static \Illuminate\Log\Logger|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
|
||||
|
||||
@@ -29,7 +29,7 @@ use Illuminate\Support\Testing\Fakes\MailFake;
|
||||
* @method static string render(string|array $view, array $data = [])
|
||||
* @method static \Illuminate\Mail\SentMessage|null send(\Illuminate\Contracts\Mail\Mailable|string|array $view, array $data = [], \Closure|string|null $callback = null)
|
||||
* @method static \Illuminate\Mail\SentMessage|null sendNow(\Illuminate\Contracts\Mail\Mailable|string|array $mailable, array $data = [], \Closure|string|null $callback = null)
|
||||
* @method static mixed queue(\Illuminate\Contracts\Mail\Mailable|string|array $view, \BackedEnum|string|null $queue = null)
|
||||
* @method static mixed queue(\Illuminate\Contracts\Mail\Mailable $view, \BackedEnum|string|null $queue = null)
|
||||
* @method static mixed onQueue(\BackedEnum|string|null $queue, \Illuminate\Contracts\Mail\Mailable $view)
|
||||
* @method static mixed queueOn(string $queue, \Illuminate\Contracts\Mail\Mailable $view)
|
||||
* @method static mixed later(\DateTimeInterface|\DateInterval|int $delay, \Illuminate\Contracts\Mail\Mailable $view, string|null $queue = null)
|
||||
@@ -43,6 +43,7 @@ use Illuminate\Support\Testing\Fakes\MailFake;
|
||||
* @method static bool hasMacro(string $name)
|
||||
* @method static void flushMacros()
|
||||
* @method static void assertSent(string|\Closure $mailable, callable|array|string|int|null $callback = null)
|
||||
* @method static void assertSentTimes(string $mailable, int $times = 1)
|
||||
* @method static void assertNotOutgoing(string|\Closure $mailable, callable|null $callback = null)
|
||||
* @method static void assertNotSent(string|\Closure $mailable, callable|array|string|null $callback = null)
|
||||
* @method static void assertNothingOutgoing()
|
||||
|
||||
@@ -4,6 +4,17 @@ namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Foundation\MaintenanceModeManager;
|
||||
|
||||
/**
|
||||
* @method static string getDefaultDriver()
|
||||
* @method static mixed driver(string|null $driver = null)
|
||||
* @method static \Illuminate\Foundation\MaintenanceModeManager extend(string $driver, \Closure $callback)
|
||||
* @method static array getDrivers()
|
||||
* @method static \Illuminate\Contracts\Container\Container getContainer()
|
||||
* @method static \Illuminate\Foundation\MaintenanceModeManager setContainer(\Illuminate\Contracts\Container\Container $container)
|
||||
* @method static \Illuminate\Foundation\MaintenanceModeManager forgetDrivers()
|
||||
*
|
||||
* @see \Illuminate\Foundation\MaintenanceModeManager
|
||||
*/
|
||||
class MaintenanceMode extends Facade
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,10 @@ use Illuminate\Support\Testing\Fakes\NotificationFake;
|
||||
* @method static \Illuminate\Contracts\Container\Container getContainer()
|
||||
* @method static \Illuminate\Notifications\ChannelManager setContainer(\Illuminate\Contracts\Container\Container $container)
|
||||
* @method static \Illuminate\Notifications\ChannelManager forgetDrivers()
|
||||
* @method static void macro(string $name, object|callable $macro)
|
||||
* @method static void mixin(object $mixin, bool $replace = true)
|
||||
* @method static bool hasMacro(string $name)
|
||||
* @method static void flushMacros()
|
||||
* @method static void assertSentOnDemand(string|\Closure $notification, callable|null $callback = null)
|
||||
* @method static void assertSentTo(mixed $notifiable, string|\Closure $notification, callable|null $callback = null)
|
||||
* @method static void assertSentOnDemandTimes(string $notification, int $times = 1)
|
||||
@@ -33,10 +37,6 @@ use Illuminate\Support\Testing\Fakes\NotificationFake;
|
||||
* @method static bool hasSent(mixed $notifiable, string $notification)
|
||||
* @method static \Illuminate\Support\Testing\Fakes\NotificationFake serializeAndRestore(bool $serializeAndRestore = true)
|
||||
* @method static array sentNotifications()
|
||||
* @method static void macro(string $name, object|callable $macro)
|
||||
* @method static void mixin(object $mixin, bool $replace = true)
|
||||
* @method static bool hasMacro(string $name)
|
||||
* @method static void flushMacros()
|
||||
*
|
||||
* @see \Illuminate\Notifications\ChannelManager
|
||||
* @see \Illuminate\Support\Testing\Fakes\NotificationFake
|
||||
|
||||
@@ -7,11 +7,13 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static void resolveTokenUsing(\Closure|null $resolver)
|
||||
* @method static void setUpProcess(callable $callback)
|
||||
* @method static void setUpTestCase(callable $callback)
|
||||
* @method static void setUpTestDatabaseBeforeMigrating(callable $callback)
|
||||
* @method static void setUpTestDatabase(callable $callback)
|
||||
* @method static void tearDownProcess(callable $callback)
|
||||
* @method static void tearDownTestCase(callable $callback)
|
||||
* @method static void callSetUpProcessCallbacks()
|
||||
* @method static void callSetUpTestCaseCallbacks(\Illuminate\Foundation\Testing\TestCase $testCase)
|
||||
* @method static void callSetUpTestDatabaseBeforeMigratingCallbacks(string $database)
|
||||
* @method static void callSetUpTestDatabaseCallbacks(string $database)
|
||||
* @method static void callTearDownProcessCallbacks()
|
||||
* @method static void callTearDownTestCaseCallbacks(\Illuminate\Foundation\Testing\TestCase $testCase)
|
||||
|
||||
@@ -15,6 +15,11 @@ use Illuminate\Support\Testing\Fakes\QueueFake;
|
||||
* @method static void stopping(mixed $callback)
|
||||
* @method static bool connected(string|null $name = null)
|
||||
* @method static \Illuminate\Contracts\Queue\Queue connection(string|null $name = null)
|
||||
* @method static void pause(string $connection, string $queue)
|
||||
* @method static void pauseFor(string $connection, string $queue, \DateTimeInterface|\DateInterval|int $ttl)
|
||||
* @method static void resume(string $connection, string $queue)
|
||||
* @method static bool isPaused(string $connection, string $queue)
|
||||
* @method static void withoutInterruptionPolling()
|
||||
* @method static void extend(string $driver, \Closure $resolver)
|
||||
* @method static void addConnector(string $driver, \Closure $resolver)
|
||||
* @method static string getDefaultDriver()
|
||||
@@ -40,10 +45,13 @@ use Illuminate\Support\Testing\Fakes\QueueFake;
|
||||
* @method static mixed getJobBackoff(mixed $job)
|
||||
* @method static mixed getJobExpiration(mixed $job)
|
||||
* @method static void createPayloadUsing(callable|null $callback)
|
||||
* @method static array getConfig()
|
||||
* @method static \Illuminate\Queue\Queue setConfig(array $config)
|
||||
* @method static \Illuminate\Container\Container getContainer()
|
||||
* @method static void setContainer(\Illuminate\Container\Container $container)
|
||||
* @method static \Illuminate\Support\Testing\Fakes\QueueFake except(array|string $jobsToBeQueued)
|
||||
* @method static void assertPushed(string|\Closure $job, callable|int|null $callback = null)
|
||||
* @method static void assertPushedTimes(string $job, int $times = 1)
|
||||
* @method static void assertPushedOn(string $queue, string|\Closure $job, callable|null $callback = null)
|
||||
* @method static void assertPushedWithChain(string $job, array $expectedChain = [], callable|null $callback = null)
|
||||
* @method static void assertPushedWithoutChain(string $job, callable|null $callback = null)
|
||||
@@ -60,6 +68,7 @@ use Illuminate\Support\Testing\Fakes\QueueFake;
|
||||
* @method static array pushedJobs()
|
||||
* @method static array rawPushes()
|
||||
* @method static \Illuminate\Support\Testing\Fakes\QueueFake serializeAndRestore(bool $serializeAndRestore = true)
|
||||
* @method static void releaseUniqueJobLocks()
|
||||
*
|
||||
* @see \Illuminate\Queue\QueueManager
|
||||
* @see \Illuminate\Queue\Queue
|
||||
@@ -88,7 +97,7 @@ class Queue extends Facade
|
||||
public static function fake($jobsToFake = [])
|
||||
{
|
||||
$actualQueueManager = static::isFake()
|
||||
? static::getFacadeRoot()->queue
|
||||
? tap(static::getFacadeRoot(), fn ($fake) => $fake->releaseUniqueJobLocks())->queue
|
||||
: static::getFacadeRoot();
|
||||
|
||||
return tap(new QueueFake(static::getFacadeApplication(), $jobsToFake, $actualQueueManager), function ($fake) {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Cache\RateLimiter for(\BackedEnum|\UnitEnum|string $name, \Closure $callback)
|
||||
* @method static \Closure|null limiter(\BackedEnum|\UnitEnum|string $name)
|
||||
* @method static \Illuminate\Cache\RateLimiter for(\UnitEnum|string $name, \Closure $callback)
|
||||
* @method static \Closure|null limiter(\UnitEnum|string $name)
|
||||
* @method static mixed attempt(string $key, int $maxAttempts, \Closure $callback, \DateTimeInterface|\DateInterval|int $decaySeconds = 60)
|
||||
* @method static bool tooManyAttempts(string $key, int $maxAttempts)
|
||||
* @method static int hit(string $key, \DateTimeInterface|\DateInterval|int $decaySeconds = 60)
|
||||
|
||||
276
plugins/vendor/illuminate/support/Facades/Redis.php
vendored
276
plugins/vendor/illuminate/support/Facades/Redis.php
vendored
@@ -19,9 +19,10 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static void psubscribe(array|string $channels, \Closure $callback)
|
||||
* @method static mixed command(string $method, array $parameters = [])
|
||||
* @method static void listen(\Closure $callback)
|
||||
* @method static void listenForFailures(\Closure $callback)
|
||||
* @method static string|null getName()
|
||||
* @method static \Illuminate\Redis\Connections\Connection setName(string $name)
|
||||
* @method static \Illuminate\Contracts\Events\Dispatcher getEventDispatcher()
|
||||
* @method static \Illuminate\Contracts\Events\Dispatcher|null getEventDispatcher()
|
||||
* @method static void setEventDispatcher(\Illuminate\Contracts\Events\Dispatcher $events)
|
||||
* @method static void unsetEventDispatcher()
|
||||
* @method static void macro(string $name, object|callable $macro)
|
||||
@@ -29,6 +30,279 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static bool hasMacro(string $name)
|
||||
* @method static void flushMacros()
|
||||
* @method static mixed macroCall(string $method, array $parameters)
|
||||
* @method static string _compress(string $value)
|
||||
* @method static string _uncompress(string $value)
|
||||
* @method static string _prefix(string $key)
|
||||
* @method static string _serialize(mixed $value)
|
||||
* @method static mixed _unserialize(string $value)
|
||||
* @method static string _pack(mixed $value)
|
||||
* @method static mixed _unpack(string $value)
|
||||
* @method static mixed acl(string $subcmd, string ...$args)
|
||||
* @method static \Redis|int|false append(string $key, mixed $value)
|
||||
* @method static \Redis|bool auth(mixed $credentials)
|
||||
* @method static \Redis|bool bgSave()
|
||||
* @method static \Redis|bool bgrewriteaof()
|
||||
* @method static \Redis|array|false waitaof(int $numlocal, int $numreplicas, int $timeout)
|
||||
* @method static \Redis|int|false bitcount(string $key, int $start = 0, int $end = -1, bool $bybit = false)
|
||||
* @method static \Redis|int|false bitop(string $operation, string $deskey, string $srckey, string ...$other_keys)
|
||||
* @method static \Redis|int|false bitpos(string $key, bool $bit, int $start = 0, int $end = -1, bool $bybit = false)
|
||||
* @method static \Redis|array|false|null blPop(array|string $key_or_keys, string|int|float $timeout_or_key, mixed ...$extra_args)
|
||||
* @method static \Redis|array|false|null brPop(array|string $key_or_keys, string|int|float $timeout_or_key, mixed ...$extra_args)
|
||||
* @method static \Redis|string|false brpoplpush(string $src, string $dst, int|float $timeout)
|
||||
* @method static \Redis|array|false bzPopMax(array|string $key, string|int $timeout_or_key, mixed ...$extra_args)
|
||||
* @method static \Redis|array|false bzPopMin(array|string $key, string|int $timeout_or_key, mixed ...$extra_args)
|
||||
* @method static \Redis|array|false|null bzmpop(float $timeout, array $keys, string $from, int $count = 1)
|
||||
* @method static \Redis|array|false|null zmpop(array $keys, string $from, int $count = 1)
|
||||
* @method static \Redis|array|false|null blmpop(float $timeout, array $keys, string $from, int $count = 1)
|
||||
* @method static \Redis|array|false|null lmpop(array $keys, string $from, int $count = 1)
|
||||
* @method static bool clearLastError()
|
||||
* @method static bool close()
|
||||
* @method static mixed config(string $operation, array|string|null $key_or_settings = null, string|null $value = null)
|
||||
* @method static bool connect(string $host, int $port = 6379, float $timeout = 0, string|null $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0, array|null $context = null)
|
||||
* @method static \Redis|bool copy(string $src, string $dst, array|null $options = null)
|
||||
* @method static \Redis|int|false dbSize()
|
||||
* @method static \Redis|string debug(string $key)
|
||||
* @method static \Redis|int|false decr(string $key, int $by = 1)
|
||||
* @method static \Redis|int|false decrBy(string $key, int $value)
|
||||
* @method static \Redis|int|false del(array|string $key, string ...$other_keys)
|
||||
* @method static \Redis|int|false delifeq(string $key, mixed $value)
|
||||
* @method static \Redis|bool discard()
|
||||
* @method static \Redis|string|false dump(string $key)
|
||||
* @method static \Redis|string|false echo(string $str)
|
||||
* @method static mixed eval(string $script, array $args = [], int $num_keys = 0)
|
||||
* @method static mixed eval_ro(string $script_sha, array $args = [], int $num_keys = 0)
|
||||
* @method static mixed evalsha(string $sha1, array $args = [], int $num_keys = 0)
|
||||
* @method static mixed evalsha_ro(string $sha1, array $args = [], int $num_keys = 0)
|
||||
* @method static \Redis|array|false exec()
|
||||
* @method static \Redis|int|bool exists(mixed $key, mixed ...$other_keys)
|
||||
* @method static \Redis|bool expire(string $key, int $timeout, string|null $mode = null)
|
||||
* @method static \Redis|bool expireAt(string $key, int $timestamp, string|null $mode = null)
|
||||
* @method static \Redis|bool failover(array|null $to = null, bool $abort = false, int $timeout = 0)
|
||||
* @method static \Redis|int|false expiretime(string $key)
|
||||
* @method static \Redis|int|false pexpiretime(string $key)
|
||||
* @method static mixed fcall(string $fn, array $keys = [], array $args = [])
|
||||
* @method static mixed fcall_ro(string $fn, array $keys = [], array $args = [])
|
||||
* @method static \Redis|bool flushAll(bool|null $sync = null)
|
||||
* @method static \Redis|bool flushDB(bool|null $sync = null)
|
||||
* @method static \Redis|array|string|bool function(string $operation, mixed ...$args)
|
||||
* @method static \Redis|int|false geoadd(string $key, float $lng, float $lat, string $member, mixed ...$other_triples_and_options)
|
||||
* @method static \Redis|float|false geodist(string $key, string $src, string $dst, string|null $unit = null)
|
||||
* @method static \Redis|array|false geohash(string $key, string $member, string ...$other_members)
|
||||
* @method static \Redis|array|false geopos(string $key, string $member, string ...$other_members)
|
||||
* @method static mixed georadius(string $key, float $lng, float $lat, float $radius, string $unit, array $options = [])
|
||||
* @method static mixed georadius_ro(string $key, float $lng, float $lat, float $radius, string $unit, array $options = [])
|
||||
* @method static mixed georadiusbymember(string $key, string $member, float $radius, string $unit, array $options = [])
|
||||
* @method static mixed georadiusbymember_ro(string $key, string $member, float $radius, string $unit, array $options = [])
|
||||
* @method static array geosearch(string $key, array|string $position, array|int|float $shape, string $unit, array $options = [])
|
||||
* @method static \Redis|array|int|false geosearchstore(string $dst, string $src, array|string $position, array|int|float $shape, string $unit, array $options = [])
|
||||
* @method static mixed get(string $key)
|
||||
* @method static \Redis|array|false getWithMeta(string $key)
|
||||
* @method static mixed getAuth()
|
||||
* @method static \Redis|int|false getBit(string $key, int $idx)
|
||||
* @method static \Redis|string|bool getEx(string $key, array $options = [])
|
||||
* @method static int getDBNum()
|
||||
* @method static \Redis|string|bool getDel(string $key)
|
||||
* @method static string getHost()
|
||||
* @method static string|null getLastError()
|
||||
* @method static int getMode()
|
||||
* @method static mixed getOption(int $option)
|
||||
* @method static string|null getPersistentID()
|
||||
* @method static int getPort()
|
||||
* @method static string|false serverName()
|
||||
* @method static string|false serverVersion()
|
||||
* @method static \Redis|string|false getRange(string $key, int $start, int $end)
|
||||
* @method static \Redis|array|string|int|false lcs(string $key1, string $key2, array|null $options = null)
|
||||
* @method static float getReadTimeout()
|
||||
* @method static \Redis|string|false getset(string $key, mixed $value)
|
||||
* @method static float|false getTimeout()
|
||||
* @method static array getTransferredBytes()
|
||||
* @method static void clearTransferredBytes()
|
||||
* @method static \Redis|int|false hDel(string $key, string $field, string ...$other_fields)
|
||||
* @method static \Redis|bool hExists(string $key, string $field)
|
||||
* @method static mixed hGet(string $key, string $member)
|
||||
* @method static \Redis|array|false hGetAll(string $key)
|
||||
* @method static mixed hGetWithMeta(string $key, string $member)
|
||||
* @method static \Redis|int|false hIncrBy(string $key, string $field, int $value)
|
||||
* @method static \Redis|float|false hIncrByFloat(string $key, string $field, float $value)
|
||||
* @method static \Redis|array|false hKeys(string $key)
|
||||
* @method static \Redis|int|false hLen(string $key)
|
||||
* @method static \Redis|array|false hMget(string $key, array $fields)
|
||||
* @method static \Redis|array|false hgetex(string $key, array $fields, array|string|null $expiry = null)
|
||||
* @method static \Redis|int|false hsetex(string $key, array $fields, array|null $expiry = null)
|
||||
* @method static \Redis|array|false hgetdel(string $key, array $fields)
|
||||
* @method static \Redis|bool hMset(string $key, array $fieldvals)
|
||||
* @method static \Redis|array|string|false hRandField(string $key, array|null $options = null)
|
||||
* @method static \Redis|int|false hSet(string $key, mixed ...$fields_and_vals)
|
||||
* @method static \Redis|bool hSetNx(string $key, string $field, mixed $value)
|
||||
* @method static \Redis|int|false hStrLen(string $key, string $field)
|
||||
* @method static \Redis|array|false hVals(string $key)
|
||||
* @method static \Redis|array|false hexpire(string $key, int $ttl, array $fields, string|null $mode = null)
|
||||
* @method static \Redis|array|false hpexpire(string $key, int $ttl, array $fields, string|null $mode = null)
|
||||
* @method static \Redis|array|false hexpireat(string $key, int $time, array $fields, string|null $mode = null)
|
||||
* @method static \Redis|array|false hpexpireat(string $key, int $mstime, array $fields, string|null $mode = null)
|
||||
* @method static \Redis|array|false httl(string $key, array $fields)
|
||||
* @method static \Redis|array|false hpttl(string $key, array $fields)
|
||||
* @method static \Redis|array|false hexpiretime(string $key, array $fields)
|
||||
* @method static \Redis|array|false hpexpiretime(string $key, array $fields)
|
||||
* @method static \Redis|array|false hpersist(string $key, array $fields)
|
||||
* @method static \Redis|array|bool hscan(string $key, string|int|null $iterator, string|null $pattern = null, int $count = 0)
|
||||
* @method static \Redis|int|false expiremember(string $key, string $field, int $ttl, string|null $unit = null)
|
||||
* @method static \Redis|int|false expirememberat(string $key, string $field, int $timestamp)
|
||||
* @method static \Redis|int|false incr(string $key, int $by = 1)
|
||||
* @method static \Redis|int|false incrBy(string $key, int $value)
|
||||
* @method static \Redis|float|false incrByFloat(string $key, float $value)
|
||||
* @method static \Redis|array|false info(string ...$sections)
|
||||
* @method static bool isConnected()
|
||||
* @method static void keys(string $pattern)
|
||||
* @method static void lInsert(string $key, string $pos, mixed $pivot, mixed $value)
|
||||
* @method static \Redis|int|false lLen(string $key)
|
||||
* @method static \Redis|string|false lMove(string $src, string $dst, string $wherefrom, string $whereto)
|
||||
* @method static \Redis|string|false blmove(string $src, string $dst, string $wherefrom, string $whereto, float $timeout)
|
||||
* @method static \Redis|array|string|bool lPop(string $key, int $count = 0)
|
||||
* @method static \Redis|array|int|bool|null lPos(string $key, mixed $value, array|null $options = null)
|
||||
* @method static \Redis|int|false lPush(string $key, mixed ...$elements)
|
||||
* @method static \Redis|int|false rPush(string $key, mixed ...$elements)
|
||||
* @method static \Redis|int|false lPushx(string $key, mixed $value)
|
||||
* @method static \Redis|int|false rPushx(string $key, mixed $value)
|
||||
* @method static \Redis|bool lSet(string $key, int $index, mixed $value)
|
||||
* @method static int lastSave()
|
||||
* @method static mixed lindex(string $key, int $index)
|
||||
* @method static \Redis|array|false lrange(string $key, int $start, int $end)
|
||||
* @method static \Redis|int|false lrem(string $key, mixed $value, int $count = 0)
|
||||
* @method static \Redis|bool ltrim(string $key, int $start, int $end)
|
||||
* @method static \Redis|array|false mget(array $keys)
|
||||
* @method static \Redis|bool migrate(string $host, int $port, array|string $key, int $dstdb, int $timeout, bool $copy = false, bool $replace = false, mixed $credentials = null)
|
||||
* @method static \Redis|bool move(string $key, int $index)
|
||||
* @method static \Redis|bool mset(array $key_values)
|
||||
* @method static \Redis|bool msetnx(array $key_values)
|
||||
* @method static \Redis|bool multi(int $value = 1)
|
||||
* @method static \Redis|string|int|false object(string $subcommand, string $key)
|
||||
* @method static bool pconnect(string $host, int $port = 6379, float $timeout = 0, string|null $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0, array|null $context = null)
|
||||
* @method static \Redis|bool persist(string $key)
|
||||
* @method static bool pexpire(string $key, int $timeout, string|null $mode = null)
|
||||
* @method static \Redis|bool pexpireAt(string $key, int $timestamp, string|null $mode = null)
|
||||
* @method static \Redis|int pfadd(string $key, array $elements)
|
||||
* @method static \Redis|int|false pfcount(array|string $key_or_keys)
|
||||
* @method static \Redis|bool pfmerge(string $dst, array $srckeys)
|
||||
* @method static \Redis|string|bool ping(string|null $message = null)
|
||||
* @method static \Redis|bool pipeline()
|
||||
* @method static \Redis|bool psetex(string $key, int $expire, mixed $value)
|
||||
* @method static \Redis|int|false pttl(string $key)
|
||||
* @method static \Redis|int|false publish(string $channel, string $message)
|
||||
* @method static mixed pubsub(string $command, mixed $arg = null)
|
||||
* @method static \Redis|array|bool punsubscribe(array $patterns)
|
||||
* @method static \Redis|array|string|bool rPop(string $key, int $count = 0)
|
||||
* @method static \Redis|string|false randomKey()
|
||||
* @method static mixed rawcommand(string $command, mixed ...$args)
|
||||
* @method static \Redis|bool rename(string $old_name, string $new_name)
|
||||
* @method static \Redis|bool renameNx(string $key_src, string $key_dst)
|
||||
* @method static \Redis|bool reset()
|
||||
* @method static \Redis|bool restore(string $key, int $ttl, string $value, array|null $options = null)
|
||||
* @method static mixed role()
|
||||
* @method static \Redis|string|false rpoplpush(string $srckey, string $dstkey)
|
||||
* @method static \Redis|int|false sAdd(string $key, mixed $value, mixed ...$other_values)
|
||||
* @method static int sAddArray(string $key, array $values)
|
||||
* @method static \Redis|array|false sDiff(string $key, string ...$other_keys)
|
||||
* @method static \Redis|int|false sDiffStore(string $dst, string $key, string ...$other_keys)
|
||||
* @method static \Redis|array|false sInter(array|string $key, string ...$other_keys)
|
||||
* @method static \Redis|int|false sintercard(array $keys, int $limit = -1)
|
||||
* @method static \Redis|int|false sInterStore(array|string $key, string ...$other_keys)
|
||||
* @method static \Redis|array|false sMembers(string $key)
|
||||
* @method static \Redis|array|false sMisMember(string $key, string $member, string ...$other_members)
|
||||
* @method static \Redis|bool sMove(string $src, string $dst, mixed $value)
|
||||
* @method static \Redis|array|string|false sPop(string $key, int $count = 0)
|
||||
* @method static mixed sRandMember(string $key, int $count = 0)
|
||||
* @method static \Redis|array|false sUnion(string $key, string ...$other_keys)
|
||||
* @method static \Redis|int|false sUnionStore(string $dst, string $key, string ...$other_keys)
|
||||
* @method static \Redis|bool save()
|
||||
* @method static array|false scan(string|int|null $iterator, string|null $pattern = null, int $count = 0, string|null $type = null)
|
||||
* @method static \Redis|int|false scard(string $key)
|
||||
* @method static mixed script(string $command, mixed ...$args)
|
||||
* @method static \Redis|bool select(int $db)
|
||||
* @method static \Redis|string|bool set(string $key, mixed $value, mixed $options = null)
|
||||
* @method static \Redis|int|false setBit(string $key, int $idx, bool $value)
|
||||
* @method static \Redis|int|false setRange(string $key, int $index, string $value)
|
||||
* @method static bool setOption(int $option, mixed $value)
|
||||
* @method static void setex(string $key, int $expire, mixed $value)
|
||||
* @method static \Redis|bool setnx(string $key, mixed $value)
|
||||
* @method static \Redis|bool sismember(string $key, mixed $value)
|
||||
* @method static \Redis|bool replicaof(string|null $host = null, int $port = 6379)
|
||||
* @method static \Redis|int|false touch(array|string $key_or_array, string ...$more_keys)
|
||||
* @method static mixed slowlog(string $operation, int $length = 0)
|
||||
* @method static mixed sort(string $key, array|null $options = null)
|
||||
* @method static mixed sort_ro(string $key, array|null $options = null)
|
||||
* @method static \Redis|int|false srem(string $key, mixed $value, mixed ...$other_values)
|
||||
* @method static array|false sscan(string $key, string|int|null $iterator, string|null $pattern = null, int $count = 0)
|
||||
* @method static bool ssubscribe(array $channels, callable $cb)
|
||||
* @method static \Redis|int|false strlen(string $key)
|
||||
* @method static \Redis|array|bool sunsubscribe(array $channels)
|
||||
* @method static \Redis|bool swapdb(int $src, int $dst)
|
||||
* @method static \Redis|array time()
|
||||
* @method static \Redis|int|false ttl(string $key)
|
||||
* @method static \Redis|int|false type(string $key)
|
||||
* @method static \Redis|int|false unlink(array|string $key, string ...$other_keys)
|
||||
* @method static \Redis|array|bool unsubscribe(array $channels)
|
||||
* @method static \Redis|bool unwatch()
|
||||
* @method static \Redis|bool watch(array|string $key, string ...$other_keys)
|
||||
* @method static int|false wait(int $numreplicas, int $timeout)
|
||||
* @method static int|false xack(string $key, string $group, array $ids)
|
||||
* @method static \Redis|string|false xadd(string $key, string $id, array $values, int $maxlen = 0, bool $approx = false, bool $nomkstream = false)
|
||||
* @method static \Redis|array|bool xautoclaim(string $key, string $group, string $consumer, int $min_idle, string $start, int $count = -1, bool $justid = false)
|
||||
* @method static \Redis|array|bool xclaim(string $key, string $group, string $consumer, int $min_idle, array $ids, array $options)
|
||||
* @method static \Redis|int|false xdel(string $key, array $ids)
|
||||
* @method static mixed xgroup(string $operation, string|null $key = null, string|null $group = null, string|null $id_or_consumer = null, bool $mkstream = false, int $entries_read = -2)
|
||||
* @method static mixed xinfo(string $operation, string|null $arg1 = null, string|null $arg2 = null, int $count = -1)
|
||||
* @method static \Redis|int|false xlen(string $key)
|
||||
* @method static \Redis|array|false xpending(string $key, string $group, string|null $start = null, string|null $end = null, int $count = -1, string|null $consumer = null)
|
||||
* @method static \Redis|array|bool xrange(string $key, string $start, string $end, int $count = -1)
|
||||
* @method static \Redis|array|bool xread(array $streams, int $count = -1, int $block = -1)
|
||||
* @method static \Redis|array|bool xreadgroup(string $group, string $consumer, array $streams, int $count = 1, int $block = 1)
|
||||
* @method static \Redis|array|bool xrevrange(string $key, string $end, string $start, int $count = -1)
|
||||
* @method static \Redis|int|false vadd(string $key, array $values, mixed $element, array|null $options = null)
|
||||
* @method static \Redis|array|false vsim(string $key, mixed $member, array|null $options = null)
|
||||
* @method static \Redis|int|false vcard(string $key)
|
||||
* @method static \Redis|int|false vdim(string $key)
|
||||
* @method static \Redis|array|false vinfo(string $key)
|
||||
* @method static \Redis|bool vismember(string $key, mixed $member)
|
||||
* @method static \Redis|array|false vemb(string $key, mixed $member, bool $raw = false)
|
||||
* @method static \Redis|array|string|false vrandmember(string $key, int $count = 0)
|
||||
* @method static \Redis|array|false vrange(string $key, string $min, string $max, int $count = -1)
|
||||
* @method static \Redis|int|false vrem(string $key, mixed $member)
|
||||
* @method static \Redis|int|false vsetattr(string $key, mixed $member, array|string $attributes)
|
||||
* @method static \Redis|array|string|false vgetattr(string $key, mixed $member, bool $decode = true)
|
||||
* @method static \Redis|array|false vlinks(string $key, mixed $member, bool $withscores = false)
|
||||
* @method static \Redis|int|false xtrim(string $key, string $threshold, bool $approx = false, bool $minid = false, int $limit = -1)
|
||||
* @method static \Redis|int|float|false zAdd(string $key, array|float $score_or_options, mixed ...$more_scores_and_mems)
|
||||
* @method static \Redis|int|false zCard(string $key)
|
||||
* @method static \Redis|int|false zCount(string $key, string|int $start, string|int $end)
|
||||
* @method static \Redis|float|false zIncrBy(string $key, float $value, mixed $member)
|
||||
* @method static \Redis|int|false zLexCount(string $key, string $min, string $max)
|
||||
* @method static \Redis|array|false zMscore(string $key, mixed $member, mixed ...$other_members)
|
||||
* @method static \Redis|array|false zPopMax(string $key, int|null $count = null)
|
||||
* @method static \Redis|array|false zPopMin(string $key, int|null $count = null)
|
||||
* @method static \Redis|array|false zRange(string $key, string|int $start, string|int $end, array|bool|null $options = null)
|
||||
* @method static \Redis|array|false zRangeByLex(string $key, string $min, string $max, int $offset = -1, int $count = -1)
|
||||
* @method static \Redis|array|false zRangeByScore(string $key, string $start, string $end, array $options = [])
|
||||
* @method static \Redis|int|false zrangestore(string $dstkey, string $srckey, string $start, string $end, array|bool|null $options = null)
|
||||
* @method static \Redis|array|string zRandMember(string $key, array|null $options = null)
|
||||
* @method static \Redis|int|false zRank(string $key, mixed $member)
|
||||
* @method static \Redis|int|false zRem(mixed $key, mixed $member, mixed ...$other_members)
|
||||
* @method static \Redis|int|false zRemRangeByLex(string $key, string $min, string $max)
|
||||
* @method static \Redis|int|false zRemRangeByRank(string $key, int $start, int $end)
|
||||
* @method static \Redis|int|false zRemRangeByScore(string $key, string $start, string $end)
|
||||
* @method static \Redis|array|false zRevRange(string $key, int $start, int $end, mixed $scores = null)
|
||||
* @method static \Redis|array|false zRevRangeByLex(string $key, string $max, string $min, int $offset = -1, int $count = -1)
|
||||
* @method static \Redis|array|false zRevRangeByScore(string $key, string $max, string $min, array|bool $options = [])
|
||||
* @method static \Redis|int|false zRevRank(string $key, mixed $member)
|
||||
* @method static \Redis|float|false zScore(string $key, mixed $member)
|
||||
* @method static \Redis|array|false zdiff(array $keys, array|null $options = null)
|
||||
* @method static \Redis|int|false zdiffstore(string $dst, array $keys)
|
||||
* @method static \Redis|array|false zinter(array $keys, array|null $weights = null, array|null $options = null)
|
||||
* @method static \Redis|int|false zintercard(array $keys, int $limit = -1)
|
||||
* @method static \Redis|int|false zinterstore(string $dst, array $keys, array|null $weights = null, string|null $aggregate = null)
|
||||
* @method static \Redis|array|false zscan(string $key, string|int|null $iterator, string|null $pattern = null, int $count = 0)
|
||||
* @method static \Redis|array|false zunion(array $keys, array|null $weights = null, array|null $options = null)
|
||||
* @method static \Redis|int|false zunionstore(string $dst, array $keys, array|null $weights = null, string|null $aggregate = null)
|
||||
*
|
||||
* @see \Illuminate\Redis\RedisManager
|
||||
*/
|
||||
|
||||
@@ -29,10 +29,10 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static string|null ip()
|
||||
* @method static array ips()
|
||||
* @method static string|null userAgent()
|
||||
* @method static array getAcceptableContentTypes()
|
||||
* @method static \Illuminate\Http\Request merge(array $input)
|
||||
* @method static \Illuminate\Http\Request mergeIfMissing(array $input)
|
||||
* @method static \Illuminate\Http\Request replace(array $input)
|
||||
* @method static mixed get(string $key, mixed $default = null)
|
||||
* @method static \Symfony\Component\HttpFoundation\InputBag|mixed json(string|null $key = null, mixed $default = null)
|
||||
* @method static \Illuminate\Http\Request createFrom(\Illuminate\Http\Request $from, \Illuminate\Http\Request|null $to = null)
|
||||
* @method static \Illuminate\Http\Request createFromBase(\Symfony\Component\HttpFoundation\Request $request)
|
||||
@@ -65,6 +65,8 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static string normalizeQueryString(string|null $qs)
|
||||
* @method static void enableHttpMethodParameterOverride()
|
||||
* @method static bool getHttpMethodParameterOverride()
|
||||
* @method static void setAllowedHttpMethodOverride(string[]|null $methods)
|
||||
* @method static string[]|null getAllowedHttpMethodOverride()
|
||||
* @method static bool hasPreviousSession()
|
||||
* @method static void setSession(\Symfony\Component\HttpFoundation\Session\SessionInterface $session)
|
||||
* @method static array getClientIps()
|
||||
@@ -92,8 +94,8 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static string getRealMethod()
|
||||
* @method static string|null getMimeType(string $format)
|
||||
* @method static string[] getMimeTypes(string $format)
|
||||
* @method static string|null getFormat(string|null $mimeType)
|
||||
* @method static void setFormat(string|null $format, string|string[] $mimeTypes)
|
||||
* @method static string|null getFormat(string|null $mimeType, bool $subtypeFallback = null)
|
||||
* @method static void setFormat(string $format, string|string[] $mimeTypes)
|
||||
* @method static string|null getRequestFormat(string|null $default = 'html')
|
||||
* @method static void setRequestFormat(string|null $format)
|
||||
* @method static string|null getContentTypeFormat()
|
||||
@@ -115,7 +117,6 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static string[] getLanguages()
|
||||
* @method static string[] getCharsets()
|
||||
* @method static string[] getEncodings()
|
||||
* @method static string[] getAcceptableContentTypes()
|
||||
* @method static bool isXmlHttpRequest()
|
||||
* @method static bool preferSafeContent()
|
||||
* @method static bool isFromTrustedProxy()
|
||||
@@ -125,10 +126,12 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static bool isJson()
|
||||
* @method static bool expectsJson()
|
||||
* @method static bool wantsJson()
|
||||
* @method static bool wantsMarkdown()
|
||||
* @method static bool accepts(string|array $contentTypes)
|
||||
* @method static string|null prefers(string|array $contentTypes)
|
||||
* @method static bool acceptsAnyContentType()
|
||||
* @method static bool acceptsJson()
|
||||
* @method static bool acceptsMarkdown()
|
||||
* @method static bool acceptsHtml()
|
||||
* @method static bool matchesType(string $actual, string $type)
|
||||
* @method static string format(string $default = 'html')
|
||||
@@ -144,7 +147,7 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static array keys()
|
||||
* @method static array all(mixed $keys = null)
|
||||
* @method static mixed input(string|null $key = null, mixed $default = null)
|
||||
* @method static \Illuminate\Support\Fluent fluent(array|string|null $key = null)
|
||||
* @method static \Illuminate\Support\Fluent fluent(array|string|null $key = null, array $default = [])
|
||||
* @method static string|array|null query(string|null $key = null, string|array|null $default = null)
|
||||
* @method static string|array|null post(string|null $key = null, string|array|null $default = null)
|
||||
* @method static bool hasCookie(string $key)
|
||||
@@ -169,8 +172,10 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static bool boolean(string|null $key = null, bool $default = false)
|
||||
* @method static int integer(string $key, int $default = 0)
|
||||
* @method static float float(string $key, float $default = 0)
|
||||
* @method static float|int clamp(string $key, int|float $min, int|float $max, int|float $default = 0)
|
||||
* @method static \Illuminate\Support\Carbon|null date(string $key, string|null $format = null, \UnitEnum|string|null $tz = null)
|
||||
* @method static \BackedEnum|null enum(string $key, string $enumClass, \BackedEnum|null $default = null)
|
||||
* @method static \Carbon\CarbonInterval|null interval(string $key, \Carbon\Unit|string|null $unit = null)
|
||||
* @method static \BackedEnum|\BackedEnum|null enum(string $key, string $enumClass, \BackedEnum|null $default = null)
|
||||
* @method static \BackedEnum[] enums(string $key, string $enumClass)
|
||||
* @method static array array(array|string|null $key = null)
|
||||
* @method static \Illuminate\Support\Collection collect(array|string|null $key = null)
|
||||
|
||||
@@ -14,7 +14,7 @@ use Illuminate\Console\Scheduling\Schedule as ConsoleSchedule;
|
||||
* @method static bool serverShouldRun(\Illuminate\Console\Scheduling\Event $event, \DateTimeInterface $time)
|
||||
* @method static \Illuminate\Support\Collection dueEvents(\Illuminate\Contracts\Foundation\Application $app)
|
||||
* @method static \Illuminate\Console\Scheduling\Event[] events()
|
||||
* @method static \Illuminate\Console\Scheduling\Schedule useCache(string $store)
|
||||
* @method static \Illuminate\Console\Scheduling\Schedule useCache(\UnitEnum|string $store)
|
||||
* @method static void macro(string $name, object|callable $macro)
|
||||
* @method static void mixin(object $mixin, bool $replace = true)
|
||||
* @method static bool hasMacro(string $name)
|
||||
@@ -76,6 +76,7 @@ use Illuminate\Console\Scheduling\Schedule as ConsoleSchedule;
|
||||
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes monthlyOn(int $dayOfMonth = 1, string $time = '0:0')
|
||||
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes twiceMonthly(int $first = 1, int $second = 16, string $time = '0:0')
|
||||
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes lastDayOfMonth(string $time = '0:0')
|
||||
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes daysOfMonth(array|int ...$days)
|
||||
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes quarterly()
|
||||
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes quarterlyOn(int $dayOfQuarter = 1, string $time = '0:0')
|
||||
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes yearly()
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static bool hasColumns(string $table, array $columns)
|
||||
* @method static void whenTableHasColumn(string $table, string $column, \Closure $callback)
|
||||
* @method static void whenTableDoesntHaveColumn(string $table, string $column, \Closure $callback)
|
||||
* @method static void whenTableHasIndex(string $table, string|array $index, \Closure $callback, string|null $type = null)
|
||||
* @method static void whenTableDoesntHaveIndex(string $table, string|array $index, \Closure $callback, string|null $type = null)
|
||||
* @method static string getColumnType(string $table, string $column, bool $fullDefinition = false)
|
||||
* @method static array getColumnListing(string $table)
|
||||
* @method static array getColumns(string $table)
|
||||
@@ -40,6 +42,8 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static bool enableForeignKeyConstraints()
|
||||
* @method static bool disableForeignKeyConstraints()
|
||||
* @method static mixed withoutForeignKeyConstraints(\Closure $callback)
|
||||
* @method static void ensureVectorExtensionExists(string|null $schema = null)
|
||||
* @method static void ensureExtensionExists(string $name, string|null $schema = null)
|
||||
* @method static string[]|null getCurrentSchemaListing()
|
||||
* @method static string|null getCurrentSchemaName()
|
||||
* @method static array parseSchemaAndTable(string $reference, string|bool|null $withDefaultSchema = null)
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static int defaultRouteBlockLockSeconds()
|
||||
* @method static int defaultRouteBlockWaitSeconds()
|
||||
* @method static array getSessionConfig()
|
||||
* @method static string getDefaultDriver()
|
||||
* @method static string|null getDefaultDriver()
|
||||
* @method static void setDefaultDriver(string $name)
|
||||
* @method static mixed driver(string|null $driver = null)
|
||||
* @method static \Illuminate\Session\SessionManager extend(string $driver, \Closure $callback)
|
||||
@@ -22,27 +22,28 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static array all()
|
||||
* @method static array only(array $keys)
|
||||
* @method static array except(array $keys)
|
||||
* @method static bool exists(string|array $key)
|
||||
* @method static bool missing(string|array $key)
|
||||
* @method static bool has(string|array $key)
|
||||
* @method static bool hasAny(string|array $key)
|
||||
* @method static mixed get(string $key, mixed $default = null)
|
||||
* @method static mixed pull(string $key, mixed $default = null)
|
||||
* @method static bool exists(\UnitEnum|string|array $key)
|
||||
* @method static bool missing(\UnitEnum|string|array $key)
|
||||
* @method static bool has(\UnitEnum|string|array $key)
|
||||
* @method static bool hasAny(\UnitEnum|string|array $key)
|
||||
* @method static mixed get(\UnitEnum|string $key, mixed $default = null)
|
||||
* @method static mixed pull(\UnitEnum|string $key, mixed $default = null)
|
||||
* @method static bool hasOldInput(string|null $key = null)
|
||||
* @method static mixed getOldInput(string|null $key = null, mixed $default = null)
|
||||
* @method static void replace(array $attributes)
|
||||
* @method static void put(string|array $key, mixed $value = null)
|
||||
* @method static mixed remember(string $key, \Closure $callback)
|
||||
* @method static void push(string $key, mixed $value)
|
||||
* @method static mixed increment(string $key, int $amount = 1)
|
||||
* @method static int decrement(string $key, int $amount = 1)
|
||||
* @method static void flash(string $key, mixed $value = true)
|
||||
* @method static void now(string $key, mixed $value)
|
||||
* @method static void put(\UnitEnum|string|array $key, mixed $value = null)
|
||||
* @method static mixed remember(\UnitEnum|string $key, \Closure $callback)
|
||||
* @method static void push(\UnitEnum|string $key, mixed $value)
|
||||
* @method static mixed increment(\UnitEnum|string $key, int $amount = 1)
|
||||
* @method static int decrement(\UnitEnum|string $key, int $amount = 1)
|
||||
* @method static void flash(\UnitEnum|string $key, mixed $value = true)
|
||||
* @method static void now(\UnitEnum|string $key, mixed $value)
|
||||
* @method static void reflash()
|
||||
* @method static void keep(mixed $keys = null)
|
||||
* @method static void flashInput(array $value)
|
||||
* @method static mixed remove(string $key)
|
||||
* @method static void forget(string|array $keys)
|
||||
* @method static \Illuminate\Contracts\Cache\Repository cache()
|
||||
* @method static mixed remove(\UnitEnum|string $key)
|
||||
* @method static void forget(\UnitEnum|string|array $keys)
|
||||
* @method static void flush()
|
||||
* @method static bool invalidate()
|
||||
* @method static bool regenerate(bool $destroy = false)
|
||||
@@ -61,6 +62,8 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static \Illuminate\Support\Uri previousUri()
|
||||
* @method static string|null previousUrl()
|
||||
* @method static void setPreviousUrl(string $url)
|
||||
* @method static string|null previousRoute()
|
||||
* @method static void setPreviousRoute(string|null $route)
|
||||
* @method static void passwordConfirmed()
|
||||
* @method static \SessionHandlerInterface getHandler()
|
||||
* @method static \SessionHandlerInterface setHandler(\SessionHandlerInterface $handler)
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
use function Illuminate\Support\enum_value;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Contracts\Filesystem\Filesystem drive(string|null $name = null)
|
||||
* @method static \Illuminate\Contracts\Filesystem\Filesystem disk(\UnitEnum|string|null $name = null)
|
||||
@@ -61,6 +63,7 @@ use Illuminate\Filesystem\Filesystem;
|
||||
* @method static string|false mimeType(string $path)
|
||||
* @method static string url(string $path)
|
||||
* @method static bool providesTemporaryUrls()
|
||||
* @method static bool providesTemporaryUploadUrls()
|
||||
* @method static string temporaryUrl(string $path, \DateTimeInterface $expiration, array $options = [])
|
||||
* @method static array temporaryUploadUrl(string $path, \DateTimeInterface $expiration, array $options = [])
|
||||
* @method static \League\Flysystem\FilesystemOperator getDriver()
|
||||
@@ -68,6 +71,7 @@ use Illuminate\Filesystem\Filesystem;
|
||||
* @method static array getConfig()
|
||||
* @method static void serveUsing(\Closure $callback)
|
||||
* @method static void buildTemporaryUrlsUsing(\Closure $callback)
|
||||
* @method static void buildTemporaryUploadUrlsUsing(\Closure $callback)
|
||||
* @method static \Illuminate\Filesystem\FilesystemAdapter|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
|
||||
* @method static \Illuminate\Filesystem\FilesystemAdapter|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
|
||||
* @method static void macro(string $name, object|callable $macro)
|
||||
@@ -90,13 +94,13 @@ class Storage extends Facade
|
||||
/**
|
||||
* Replace the given disk with a local testing disk.
|
||||
*
|
||||
* @param string|null $disk
|
||||
* @param \UnitEnum|string|null $disk
|
||||
* @param array $config
|
||||
* @return \Illuminate\Contracts\Filesystem\Filesystem
|
||||
* @return \Illuminate\Filesystem\LocalFilesystemAdapter
|
||||
*/
|
||||
public static function fake($disk = null, array $config = [])
|
||||
{
|
||||
$root = self::getRootPath($disk = $disk ?: static::$app['config']->get('filesystems.default'));
|
||||
$root = self::getRootPath($disk = enum_value($disk) ?: static::$app['config']->get('filesystems.default'));
|
||||
|
||||
if ($token = ParallelTesting::token()) {
|
||||
$root = "{$root}_test_{$token}";
|
||||
@@ -108,21 +112,27 @@ class Storage extends Facade
|
||||
self::buildDiskConfiguration($disk, $config, root: $root)
|
||||
));
|
||||
|
||||
return tap($fake)->buildTemporaryUrlsUsing(function ($path, $expiration) {
|
||||
return URL::to($path.'?expiration='.$expiration->getTimestamp());
|
||||
return tap($fake, function ($fake) {
|
||||
$fake->buildTemporaryUrlsUsing(function ($path, $expiration) {
|
||||
return URL::to($path.'?expiration='.$expiration->getTimestamp());
|
||||
});
|
||||
|
||||
$fake->buildTemporaryUploadUrlsUsing(function ($path, $expiration) {
|
||||
return ['url' => URL::to($path.'?expiration='.$expiration->getTimestamp()), 'headers' => []];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the given disk with a persistent local testing disk.
|
||||
*
|
||||
* @param string|null $disk
|
||||
* @param \UnitEnum|string|null $disk
|
||||
* @param array $config
|
||||
* @return \Illuminate\Contracts\Filesystem\Filesystem
|
||||
* @return \Illuminate\Filesystem\LocalFilesystemAdapter
|
||||
*/
|
||||
public static function persistentFake($disk = null, array $config = [])
|
||||
{
|
||||
$disk = $disk ?: static::$app['config']->get('filesystems.default');
|
||||
$disk = enum_value($disk) ?: static::$app['config']->get('filesystems.default');
|
||||
|
||||
static::set($disk, $fake = static::createLocalDriver(
|
||||
self::buildDiskConfiguration($disk, $config, root: self::getRootPath($disk))
|
||||
|
||||
@@ -78,6 +78,7 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static void startPrepend(string $section, string $content = '')
|
||||
* @method static string stopPrepend()
|
||||
* @method static string yieldPushContent(string $section, string $default = '')
|
||||
* @method static bool isStackEmpty(string $section)
|
||||
* @method static void flushStacks()
|
||||
* @method static void startTranslation(array $replacements = [])
|
||||
* @method static string renderTranslation()
|
||||
|
||||
5
plugins/vendor/illuminate/support/Fluent.php
vendored
5
plugins/vendor/illuminate/support/Fluent.php
vendored
@@ -153,7 +153,7 @@ class Fluent implements Arrayable, ArrayAccess, IteratorAggregate, Jsonable, Jso
|
||||
/**
|
||||
* Get data from the fluent instance.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string|null $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -206,8 +206,7 @@ class Fluent implements Arrayable, ArrayAccess, IteratorAggregate, Jsonable, Jso
|
||||
/**
|
||||
* Convert the fluent instance to pretty print formatted JSON.
|
||||
*
|
||||
* @params int $options
|
||||
*
|
||||
* @param int $options
|
||||
* @return string
|
||||
*/
|
||||
public function toPrettyJson(int $options = 0)
|
||||
|
||||
@@ -67,7 +67,7 @@ trait InteractsWithTime
|
||||
* Given a start time, format the total run time for human readability.
|
||||
*
|
||||
* @param float $startTime
|
||||
* @param float $endTime
|
||||
* @param float|null $endTime
|
||||
* @return string
|
||||
*/
|
||||
protected function runTimeForHumans($startTime, $endTime = null)
|
||||
|
||||
4
plugins/vendor/illuminate/support/Js.php
vendored
4
plugins/vendor/illuminate/support/Js.php
vendored
@@ -93,6 +93,8 @@ class Js implements Htmlable, Stringable
|
||||
/**
|
||||
* Encode the given data as JSON.
|
||||
*
|
||||
* Invalid UTF-8 sequences are replaced with <20> instead of throwing.
|
||||
*
|
||||
* @param mixed $data
|
||||
* @param int $flags
|
||||
* @param int $depth
|
||||
@@ -110,7 +112,7 @@ class Js implements Htmlable, Stringable
|
||||
$data = $data->toArray();
|
||||
}
|
||||
|
||||
return json_encode($data, $flags | static::REQUIRED_FLAGS, $depth);
|
||||
return json_encode($data, $flags | static::REQUIRED_FLAGS | JSON_INVALID_UTF8_SUBSTITUTE, $depth);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,7 @@ abstract class Manager
|
||||
/**
|
||||
* Get the default driver name.
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
abstract public function getDefaultDriver();
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ class MessageBag implements Jsonable, JsonSerializable, MessageBagContract, Mess
|
||||
$all = [];
|
||||
|
||||
foreach ($this->messages as $key => $messages) {
|
||||
$all = array_merge($all, $this->transform($messages, $format, $key));
|
||||
array_push($all, ...$this->transform($messages, $format, $key));
|
||||
}
|
||||
|
||||
return $all;
|
||||
@@ -434,8 +434,7 @@ class MessageBag implements Jsonable, JsonSerializable, MessageBagContract, Mess
|
||||
/**
|
||||
* Convert the object to pretty print formatted JSON.
|
||||
*
|
||||
* @params int $options
|
||||
*
|
||||
* @param int $options
|
||||
* @return string
|
||||
*/
|
||||
public function toPrettyJson(int $options = 0)
|
||||
|
||||
36
plugins/vendor/illuminate/support/Number.php
vendored
36
plugins/vendor/illuminate/support/Number.php
vendored
@@ -56,7 +56,7 @@ class Number
|
||||
* @param string|null $locale
|
||||
* @return int|float|false
|
||||
*/
|
||||
public static function parse(string $string, ?int $type = NumberFormatter::TYPE_DOUBLE, ?string $locale = null): int|float
|
||||
public static function parse(string $string, ?int $type = NumberFormatter::TYPE_DOUBLE, ?string $locale = null): int|float|false
|
||||
{
|
||||
static::ensureIntlExtensionIsInstalled();
|
||||
|
||||
@@ -72,7 +72,7 @@ class Number
|
||||
* @param string|null $locale
|
||||
* @return int|false
|
||||
*/
|
||||
public static function parseInt(string $string, ?string $locale = null): int
|
||||
public static function parseInt(string $string, ?string $locale = null): int|false
|
||||
{
|
||||
return self::parse($string, NumberFormatter::TYPE_INT32, $locale);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ class Number
|
||||
* @param string|null $locale
|
||||
* @return float|false
|
||||
*/
|
||||
public static function parseFloat(string $string, ?string $locale = null): float
|
||||
public static function parseFloat(string $string, ?string $locale = null): float|false
|
||||
{
|
||||
return self::parse($string, NumberFormatter::TYPE_DOUBLE, $locale);
|
||||
}
|
||||
@@ -209,7 +209,7 @@ class Number
|
||||
|
||||
$unitCount = count($units);
|
||||
|
||||
for ($i = 0; ($bytes / 1024) > 0.9 && ($i < $unitCount - 1); $i++) {
|
||||
for ($i = 0; (abs($bytes) / 1024) > 0.9 && ($i < $unitCount - 1); $i++) {
|
||||
$bytes /= 1024;
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ class Number
|
||||
* @param int|float $number
|
||||
* @param int $precision
|
||||
* @param int|null $maxPrecision
|
||||
* @return bool|string
|
||||
* @return string|false
|
||||
*/
|
||||
public static function abbreviate(int|float $number, int $precision = 0, ?int $maxPrecision = null)
|
||||
{
|
||||
@@ -277,7 +277,7 @@ class Number
|
||||
}
|
||||
|
||||
switch (true) {
|
||||
case floatval($number) === 0.0:
|
||||
case (float) $number === 0.0:
|
||||
return $precision > 0 ? static::format(0, $precision, $maxPrecision) : '0';
|
||||
case $number < 0:
|
||||
return sprintf('-%s', static::summarize(abs($number), $precision, $maxPrecision, $units));
|
||||
@@ -312,10 +312,16 @@ class Number
|
||||
* @param int|float $by
|
||||
* @param int|float $start
|
||||
* @param int|float $offset
|
||||
* @return array
|
||||
* @return list<array{int|float, int|float}>
|
||||
*/
|
||||
public static function pairs(int|float $to, int|float $by, int|float $start = 0, int|float $offset = 1)
|
||||
{
|
||||
if ($by == 0) {
|
||||
throw new \InvalidArgumentException('The $by argument must not be zero.');
|
||||
}
|
||||
|
||||
$by = abs($by);
|
||||
|
||||
$output = [];
|
||||
|
||||
for ($lower = $start; $lower < $to; $lower += $by) {
|
||||
@@ -339,15 +345,21 @@ class Number
|
||||
*/
|
||||
public static function trim(int|float $number)
|
||||
{
|
||||
if (is_infinite($number) || is_nan($number)) {
|
||||
return $number;
|
||||
}
|
||||
|
||||
return json_decode(json_encode($number));
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the given callback using the given locale.
|
||||
*
|
||||
* @template TReturn
|
||||
*
|
||||
* @param string $locale
|
||||
* @param callable $callback
|
||||
* @return mixed
|
||||
* @param callable(): TReturn $callback
|
||||
* @return TReturn
|
||||
*/
|
||||
public static function withLocale(string $locale, callable $callback)
|
||||
{
|
||||
@@ -365,9 +377,11 @@ class Number
|
||||
/**
|
||||
* Execute the given callback using the given currency.
|
||||
*
|
||||
* @template TReturn
|
||||
*
|
||||
* @param string $currency
|
||||
* @param callable $callback
|
||||
* @return mixed
|
||||
* @param callable(): TReturn $callback
|
||||
* @return TReturn
|
||||
*/
|
||||
public static function withCurrency(string $currency, callable $callback)
|
||||
{
|
||||
|
||||
@@ -72,6 +72,13 @@ abstract class ServiceProvider
|
||||
*/
|
||||
public static array $optimizeClearCommands = [];
|
||||
|
||||
/**
|
||||
* Commands that should be run during the "reload" command.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public static array $reloadCommands = [];
|
||||
|
||||
/**
|
||||
* Create a new service provider instance.
|
||||
*
|
||||
@@ -482,6 +489,39 @@ abstract class ServiceProvider
|
||||
* @return void
|
||||
*/
|
||||
protected function optimizes(?string $optimize = null, ?string $clear = null, ?string $key = null)
|
||||
{
|
||||
$key = $this->getProviderKey($key);
|
||||
|
||||
if ($optimize) {
|
||||
static::$optimizeCommands[$key] = $optimize;
|
||||
}
|
||||
|
||||
if ($clear) {
|
||||
static::$optimizeClearCommands[$key] = $clear;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register commands that should run on "reload".
|
||||
*
|
||||
* @param string|null $reload
|
||||
* @param string|null $key
|
||||
* @return void
|
||||
*/
|
||||
protected function reloads(string $reload, ?string $key = null)
|
||||
{
|
||||
$key = $this->getProviderKey($key);
|
||||
|
||||
static::$reloadCommands[$key] = $reload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a short descriptive key for the current service provider.
|
||||
*
|
||||
* @param string|null $key
|
||||
* @return string
|
||||
*/
|
||||
protected function getProviderKey(?string $key = null): string
|
||||
{
|
||||
$key ??= (string) Str::of(get_class($this))
|
||||
->classBasename()
|
||||
@@ -494,13 +534,7 @@ abstract class ServiceProvider
|
||||
$key = class_basename(get_class($this));
|
||||
}
|
||||
|
||||
if ($optimize) {
|
||||
static::$optimizeCommands[$key] = $optimize;
|
||||
}
|
||||
|
||||
if ($clear) {
|
||||
static::$optimizeClearCommands[$key] = $clear;
|
||||
}
|
||||
return $key;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -547,7 +581,7 @@ abstract class ServiceProvider
|
||||
* Add the given provider to the application's provider bootstrap file.
|
||||
*
|
||||
* @param string $provider
|
||||
* @param string $path
|
||||
* @param string|null $path
|
||||
* @return bool
|
||||
*/
|
||||
public static function addProviderToBootstrapFile(string $provider, ?string $path = null)
|
||||
@@ -572,6 +606,51 @@ abstract class ServiceProvider
|
||||
|
||||
$content = '<?php
|
||||
|
||||
return [
|
||||
'.$providers.'
|
||||
];';
|
||||
|
||||
file_put_contents($path, $content.PHP_EOL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a provider from the application's provider bootstrap file.
|
||||
*
|
||||
* @param string|array $providersToRemove
|
||||
* @param string|null $path
|
||||
* @param bool $strict
|
||||
* @return bool
|
||||
*/
|
||||
public static function removeProviderFromBootstrapFile(string|array $providersToRemove, ?string $path = null, bool $strict = false)
|
||||
{
|
||||
$path ??= app()->getBootstrapProvidersPath();
|
||||
|
||||
if (! file_exists($path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (function_exists('opcache_invalidate')) {
|
||||
opcache_invalidate($path, true);
|
||||
}
|
||||
|
||||
$providersToRemove = Arr::wrap($providersToRemove);
|
||||
|
||||
$providers = (new Collection(require $path))
|
||||
->unique()
|
||||
->sort()
|
||||
->values()
|
||||
->when(
|
||||
$strict,
|
||||
static fn (Collection $providerCollection) => $providerCollection->reject(fn (string $p) => in_array($p, $providersToRemove, true)),
|
||||
static fn (Collection $providerCollection) => $providerCollection->reject(fn (string $p) => Str::contains($p, $providersToRemove))
|
||||
)
|
||||
->map(fn ($p) => ' '.$p.'::class,')
|
||||
->implode(PHP_EOL);
|
||||
|
||||
$content = '<?php
|
||||
|
||||
return [
|
||||
'.$providers.'
|
||||
];';
|
||||
|
||||
209
plugins/vendor/illuminate/support/Str.php
vendored
209
plugins/vendor/illuminate/support/Str.php
vendored
@@ -34,42 +34,42 @@ class Str
|
||||
/**
|
||||
* The cache of snake-cased words.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected static $snakeCache = [];
|
||||
|
||||
/**
|
||||
* The cache of camel-cased words.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected static $camelCache = [];
|
||||
|
||||
/**
|
||||
* The cache of studly-cased words.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected static $studlyCache = [];
|
||||
|
||||
/**
|
||||
* The callback that should be used to generate UUIDs.
|
||||
*
|
||||
* @var callable|null
|
||||
* @var (callable(): \Ramsey\Uuid\UuidInterface)|null
|
||||
*/
|
||||
protected static $uuidFactory;
|
||||
|
||||
/**
|
||||
* The callback that should be used to generate ULIDs.
|
||||
*
|
||||
* @var callable|null
|
||||
* @var (callable(): \Symfony\Component\Uid\Ulid)|null
|
||||
*/
|
||||
protected static $ulidFactory;
|
||||
|
||||
/**
|
||||
* The callback that should be used to generate random strings.
|
||||
*
|
||||
* @var callable|null
|
||||
* @var (callable(int): string)|null
|
||||
*/
|
||||
protected static $randomStringFactory;
|
||||
|
||||
@@ -109,13 +109,13 @@ class Str
|
||||
return $subject;
|
||||
}
|
||||
|
||||
$position = strrpos($subject, (string) $search);
|
||||
$position = mb_strrpos($subject, $search);
|
||||
|
||||
if ($position === false) {
|
||||
return $subject;
|
||||
}
|
||||
|
||||
return substr($subject, $position + strlen($search));
|
||||
return static::substr($subject, $position + static::length($search));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,7 +221,7 @@ class Str
|
||||
* Convert a value to camel case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
* @return ($value is '' ? '' : string)
|
||||
*/
|
||||
public static function camel($value)
|
||||
{
|
||||
@@ -254,14 +254,14 @@ class Str
|
||||
* Remove the given string(s) if it exists at the start of the haystack.
|
||||
*
|
||||
* @param string $subject
|
||||
* @param string|array $needle
|
||||
* @param string|string[] $needle
|
||||
* @return string
|
||||
*/
|
||||
public static function chopStart($subject, $needle)
|
||||
{
|
||||
foreach ((array) $needle as $n) {
|
||||
if (str_starts_with($subject, $n)) {
|
||||
return substr($subject, strlen($n));
|
||||
if ($n !== '' && str_starts_with($subject, $n)) {
|
||||
return mb_substr($subject, mb_strlen($n));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,14 +272,14 @@ class Str
|
||||
* Remove the given string(s) if it exists at the end of the haystack.
|
||||
*
|
||||
* @param string $subject
|
||||
* @param string|array $needle
|
||||
* @param string|string[] $needle
|
||||
* @return string
|
||||
*/
|
||||
public static function chopEnd($subject, $needle)
|
||||
{
|
||||
foreach ((array) $needle as $n) {
|
||||
if (str_ends_with($subject, $n)) {
|
||||
return substr($subject, 0, -strlen($n));
|
||||
if ($n !== '' && str_ends_with($subject, $n)) {
|
||||
return mb_substr($subject, 0, -mb_strlen($n));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ class Str
|
||||
* @param string $haystack
|
||||
* @param string|iterable<string> $needles
|
||||
* @param bool $ignoreCase
|
||||
* @return bool
|
||||
* @return ($needles is array{} ? false : ($haystack is non-empty-string ? bool : false))
|
||||
*/
|
||||
public static function contains($haystack, $needles, $ignoreCase = false)
|
||||
{
|
||||
@@ -327,7 +327,7 @@ class Str
|
||||
* @param string $haystack
|
||||
* @param iterable<string> $needles
|
||||
* @param bool $ignoreCase
|
||||
* @return bool
|
||||
* @return ($needles is array{} ? false : ($haystack is non-empty-string ? bool : false))
|
||||
*/
|
||||
public static function containsAll($haystack, $needles, $ignoreCase = false)
|
||||
{
|
||||
@@ -346,7 +346,7 @@ class Str
|
||||
* @param string $haystack
|
||||
* @param string|iterable<string> $needles
|
||||
* @param bool $ignoreCase
|
||||
* @return bool
|
||||
* @return ($needles is array{} ? true : ($haystack is non-empty-string ? bool : true))
|
||||
*/
|
||||
public static function doesntContain($haystack, $needles, $ignoreCase = false)
|
||||
{
|
||||
@@ -357,9 +357,9 @@ class Str
|
||||
* Convert the case of a string.
|
||||
*
|
||||
* @param string $string
|
||||
* @param int $mode
|
||||
* @param MB_CASE_UPPER|MB_CASE_LOWER|MB_CASE_TITLE|MB_CASE_FOLD|MB_CASE_UPPER_SIMPLE|MB_CASE_LOWER_SIMPLE|MB_CASE_TITLE_SIMPLE|MB_CASE_FOLD_SIMPLE $mode
|
||||
* @param string|null $encoding
|
||||
* @return string
|
||||
* @return ($string is '' ? '' : string)
|
||||
*/
|
||||
public static function convertCase(string $string, int $mode = MB_CASE_FOLD, ?string $encoding = 'UTF-8')
|
||||
{
|
||||
@@ -371,7 +371,7 @@ class Str
|
||||
*
|
||||
* @param string $string
|
||||
* @param array<string>|string $characters
|
||||
* @return string
|
||||
* @return ($string is '' ? '' : string)
|
||||
*/
|
||||
public static function deduplicate(string $string, array|string $characters = ' ')
|
||||
{
|
||||
@@ -391,7 +391,7 @@ class Str
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string|iterable<string> $needles
|
||||
* @return bool
|
||||
* @return ($needles is array{} ? false : ($haystack is non-empty-string ? bool : false))
|
||||
*/
|
||||
public static function endsWith($haystack, $needles)
|
||||
{
|
||||
@@ -417,7 +417,7 @@ class Str
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string|iterable<string> $needles
|
||||
* @return bool
|
||||
* @return ($needles is array{} ? true : ($haystack is non-empty-string ? bool : true))
|
||||
*/
|
||||
public static function doesntEndWith($haystack, $needles)
|
||||
{
|
||||
@@ -429,7 +429,7 @@ class Str
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $phrase
|
||||
* @param array $options
|
||||
* @param array{radius?: int|float, omission?: string} $options
|
||||
* @return string|null
|
||||
*/
|
||||
public static function excerpt($text, $phrase = '', $options = [])
|
||||
@@ -465,7 +465,7 @@ class Str
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $cap
|
||||
* @return string
|
||||
* @return ($value is '' ? ($cap is '' ? '' : non-empty-string) : non-empty-string)
|
||||
*/
|
||||
public static function finish($value, $cap)
|
||||
{
|
||||
@@ -480,7 +480,7 @@ class Str
|
||||
* @param string $value
|
||||
* @param string $before
|
||||
* @param string|null $after
|
||||
* @return string
|
||||
* @return ($value is '' ? ($before is '' ? ($after is '' ? '' : ($after is null ? '' : non-empty-string)) : non-empty-string) : non-empty-string)
|
||||
*/
|
||||
public static function wrap($value, $before, $after = null)
|
||||
{
|
||||
@@ -569,6 +569,8 @@ class Str
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*
|
||||
* @phpstan-assert-if-true =non-empty-string $value
|
||||
*/
|
||||
public static function isJson($value)
|
||||
{
|
||||
@@ -583,8 +585,10 @@ class Str
|
||||
* Determine if a given value is a valid URL.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param array $protocols
|
||||
* @param string[] $protocols
|
||||
* @return bool
|
||||
*
|
||||
* @phpstan-assert-if-true =non-empty-string $value
|
||||
*/
|
||||
public static function isUrl($value, array $protocols = [])
|
||||
{
|
||||
@@ -605,10 +609,21 @@ class Str
|
||||
(LARAVEL_PROTOCOLS):// # protocol
|
||||
(((?:[\_\.\pL\pN-]|%[0-9A-Fa-f]{2})+:)?((?:[\_\.\pL\pN-]|%[0-9A-Fa-f]{2})+)@)? # basic auth
|
||||
(
|
||||
([\pL\pN\pS\-\_\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
|
||||
| # or
|
||||
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address
|
||||
| # or
|
||||
(?:
|
||||
(?:
|
||||
(?:[\pL\pN\pS\pM\-\_]++\.)+
|
||||
(?:
|
||||
(?:xn--[a-z0-9-]++) # punycode in tld
|
||||
|
|
||||
(?:[\pL\pN\pM]++) # no punycode in tld
|
||||
)
|
||||
) # a multi-level domain name
|
||||
|
|
||||
[a-z0-9\-\_]++ # a single-level domain name
|
||||
)\.?
|
||||
| # or
|
||||
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address
|
||||
| # or
|
||||
\[
|
||||
(?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::))))
|
||||
\] # an IPv6 address
|
||||
@@ -628,6 +643,8 @@ class Str
|
||||
* @param mixed $value
|
||||
* @param int<0, 8>|'nil'|'max'|null $version
|
||||
* @return bool
|
||||
*
|
||||
* @phpstan-assert-if-true =non-empty-string $value
|
||||
*/
|
||||
public static function isUuid($value, $version = null)
|
||||
{
|
||||
@@ -669,6 +686,8 @@ class Str
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*
|
||||
* @phpstan-assert-if-true =non-empty-string $value
|
||||
*/
|
||||
public static function isUlid($value)
|
||||
{
|
||||
@@ -683,7 +702,7 @@ class Str
|
||||
* Convert a string to kebab case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
* @return ($value is '' ? '' : string)
|
||||
*/
|
||||
public static function kebab($value)
|
||||
{
|
||||
@@ -695,7 +714,7 @@ class Str
|
||||
*
|
||||
* @param string $value
|
||||
* @param string|null $encoding
|
||||
* @return int
|
||||
* @return non-negative-int
|
||||
*/
|
||||
public static function length($value, $encoding = null)
|
||||
{
|
||||
@@ -736,7 +755,7 @@ class Str
|
||||
* Convert the given string to lower-case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
* @return ($value is '' ? '' : non-empty-string&lowercase-string)
|
||||
*/
|
||||
public static function lower($value)
|
||||
{
|
||||
@@ -767,8 +786,8 @@ class Str
|
||||
*
|
||||
* @param string $string
|
||||
* @param array $options
|
||||
* @param array $extensions
|
||||
* @return string
|
||||
* @param \League\CommonMark\Extension\ExtensionInterface[] $extensions
|
||||
* @return ($string is '' ? '' : string)
|
||||
*/
|
||||
public static function markdown($string, array $options = [], array $extensions = [])
|
||||
{
|
||||
@@ -788,8 +807,8 @@ class Str
|
||||
*
|
||||
* @param string $string
|
||||
* @param array $options
|
||||
* @param array $extensions
|
||||
* @return string
|
||||
* @param \League\CommonMark\Extension\ExtensionInterface[] $extensions
|
||||
* @return ($string is '' ? '' : string)
|
||||
*/
|
||||
public static function inlineMarkdown($string, array $options = [], array $extensions = [])
|
||||
{
|
||||
@@ -866,7 +885,7 @@ class Str
|
||||
*
|
||||
* @param string|iterable<string> $pattern
|
||||
* @param string $value
|
||||
* @return bool
|
||||
* @return ($pattern is array{} ? false : bool)
|
||||
*/
|
||||
public static function isMatch($pattern, $value)
|
||||
{
|
||||
@@ -988,6 +1007,10 @@ class Str
|
||||
*/
|
||||
public static function plural($value, $count = 2, $prependCount = false)
|
||||
{
|
||||
if (is_countable($count)) {
|
||||
$count = count($count);
|
||||
}
|
||||
|
||||
return ($prependCount ? Number::format($count).' ' : '').Pluralizer::plural($value, $count);
|
||||
}
|
||||
|
||||
@@ -1027,7 +1050,7 @@ class Str
|
||||
* @param bool $numbers
|
||||
* @param bool $symbols
|
||||
* @param bool $spaces
|
||||
* @return string
|
||||
* @return ($letters is false ? ($numbers is true ? ($symbols is false ? ($spaces is false ? numeric-string : string) : string) : string) : string)
|
||||
*/
|
||||
public static function password($length = 32, $letters = true, $numbers = true, $symbols = true, $spaces = false)
|
||||
{
|
||||
@@ -1069,7 +1092,7 @@ class Str
|
||||
* @param string $needle
|
||||
* @param int $offset
|
||||
* @param string|null $encoding
|
||||
* @return int|false
|
||||
* @return ($haystack is '' ? false : ($needle is '' ? false : int|false))
|
||||
*/
|
||||
public static function position($haystack, $needle, $offset = 0, $encoding = null)
|
||||
{
|
||||
@@ -1104,7 +1127,7 @@ class Str
|
||||
/**
|
||||
* Set the callable that will be used to generate random strings.
|
||||
*
|
||||
* @param callable|null $factory
|
||||
* @param (callable(int): string)|null $factory
|
||||
* @return void
|
||||
*/
|
||||
public static function createRandomStringsUsing(?callable $factory = null)
|
||||
@@ -1115,8 +1138,8 @@ class Str
|
||||
/**
|
||||
* Set the sequence that will be used to generate random strings.
|
||||
*
|
||||
* @param array $sequence
|
||||
* @param callable|null $whenMissing
|
||||
* @param string[] $sequence
|
||||
* @param (callable(int): string)|null $whenMissing
|
||||
* @return void
|
||||
*/
|
||||
public static function createRandomStringsUsingSequence(array $sequence, $whenMissing = null)
|
||||
@@ -1216,7 +1239,7 @@ class Str
|
||||
* @param string|iterable<string> $replace
|
||||
* @param string|iterable<string> $subject
|
||||
* @param bool $caseSensitive
|
||||
* @return string|string[]
|
||||
* @return ($subject is string ? string : string[])
|
||||
*/
|
||||
public static function replace($search, $replace, $subject, $caseSensitive = true)
|
||||
{
|
||||
@@ -1336,11 +1359,11 @@ class Str
|
||||
/**
|
||||
* Replace the patterns matching the given regular expression.
|
||||
*
|
||||
* @param array|string $pattern
|
||||
* @param \Closure|string[]|string $replace
|
||||
* @param array|string $subject
|
||||
* @param string|string[] $pattern
|
||||
* @param (\Closure(array): string)|string[]|string $replace
|
||||
* @param string[]|string $subject
|
||||
* @param int $limit
|
||||
* @return string|string[]|null
|
||||
* @return ($subject is array ? string[]|null : string|null)
|
||||
*/
|
||||
public static function replaceMatches($pattern, $replace, $subject, $limit = -1)
|
||||
{
|
||||
@@ -1386,7 +1409,7 @@ class Str
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $prefix
|
||||
* @return string
|
||||
* @return ($value is '' ? ($prefix is '' ? '' : non-empty-string): non-empty-string)
|
||||
*/
|
||||
public static function start($value, $prefix)
|
||||
{
|
||||
@@ -1399,7 +1422,7 @@ class Str
|
||||
* Convert the given string to upper-case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
* @return ($value is '' ? '' : non-empty-string&uppercase-string)
|
||||
*/
|
||||
public static function upper($value)
|
||||
{
|
||||
@@ -1436,6 +1459,24 @@ class Str
|
||||
return implode(' ', array_filter(explode('_', $collapsed)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "initials" representing each word in the provided string, optionally capitalizing.
|
||||
*
|
||||
* @param string $value
|
||||
* @param bool $capitalize
|
||||
* @return string
|
||||
*/
|
||||
public static function initials($value, $capitalize = false)
|
||||
{
|
||||
$parts = mb_split("\s+", $value);
|
||||
|
||||
$parts = array_map(fn ($part) => mb_substr($part, 0, 1), $parts);
|
||||
|
||||
$initials = implode('', $parts);
|
||||
|
||||
return $capitalize ? static::upper($initials) : $initials;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given string to APA-style title case.
|
||||
*
|
||||
@@ -1452,7 +1493,7 @@ class Str
|
||||
|
||||
$minorWords = [
|
||||
'and', 'as', 'but', 'for', 'if', 'nor', 'or', 'so', 'yet', 'a', 'an',
|
||||
'the', 'at', 'by', 'for', 'in', 'of', 'off', 'on', 'per', 'to', 'up', 'via',
|
||||
'the', 'at', 'by', 'in', 'of', 'off', 'on', 'per', 'to', 'up', 'via',
|
||||
'et', 'ou', 'un', 'une', 'la', 'le', 'les', 'de', 'du', 'des', 'par', 'à',
|
||||
];
|
||||
|
||||
@@ -1627,7 +1668,9 @@ class Str
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string|iterable<string> $needles
|
||||
* @return bool
|
||||
* @return ($needles is array{} ? false : ($haystack is non-empty-string ? bool : false))
|
||||
*
|
||||
* @phpstan-assert-if-true =non-empty-string $haystack
|
||||
*/
|
||||
public static function startsWith($haystack, $needles)
|
||||
{
|
||||
@@ -1653,7 +1696,9 @@ class Str
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string|iterable<string> $needles
|
||||
* @return bool
|
||||
* @return ($needles is array{} ? true : ($haystack is non-empty-string ? bool : true))
|
||||
*
|
||||
* @phpstan-assert-if-false =non-empty-string $haystack
|
||||
*/
|
||||
public static function doesntStartWith($haystack, $needles)
|
||||
{
|
||||
@@ -1664,7 +1709,7 @@ class Str
|
||||
* Convert a value to studly caps case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
* @return ($value is '' ? '' : string)
|
||||
*/
|
||||
public static function studly($value)
|
||||
{
|
||||
@@ -1685,7 +1730,7 @@ class Str
|
||||
* Convert a value to Pascal case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
* @return ($value is '' ? '' : string)
|
||||
*/
|
||||
public static function pascal($value)
|
||||
{
|
||||
@@ -1736,16 +1781,18 @@ class Str
|
||||
public static function substrReplace($string, $replace, $offset = 0, $length = null)
|
||||
{
|
||||
if ($length === null) {
|
||||
$length = strlen($string);
|
||||
$length = static::length($string);
|
||||
}
|
||||
|
||||
return substr_replace($string, $replace, $offset, $length);
|
||||
return mb_substr($string, 0, $offset)
|
||||
.$replace
|
||||
.mb_substr(mb_substr($string, $offset), $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Swap multiple keywords in a string with other keywords.
|
||||
*
|
||||
* @param array $map
|
||||
* @param array<string, string> $map
|
||||
* @param string $subject
|
||||
* @return string
|
||||
*/
|
||||
@@ -1774,7 +1821,7 @@ class Str
|
||||
* Convert the given string to Base64 encoding.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
* @return ($string is '' ? '' : string)
|
||||
*/
|
||||
public static function toBase64($string): string
|
||||
{
|
||||
@@ -1786,7 +1833,7 @@ class Str
|
||||
*
|
||||
* @param string $string
|
||||
* @param bool $strict
|
||||
* @return string|false
|
||||
* @return ($strict is true ? ($string is '' ? '' : string|false) : ($string is '' ? '' : string))
|
||||
*/
|
||||
public static function fromBase64($string, $strict = false)
|
||||
{
|
||||
@@ -1797,7 +1844,7 @@ class Str
|
||||
* Make a string's first character lowercase.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
* @return ($string is '' ? '' : non-empty-string)
|
||||
*/
|
||||
public static function lcfirst($string)
|
||||
{
|
||||
@@ -1808,18 +1855,34 @@ class Str
|
||||
* Make a string's first character uppercase.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
* @return ($string is '' ? '' : non-empty-string)
|
||||
*/
|
||||
public static function ucfirst($string)
|
||||
{
|
||||
return static::upper(static::substr($string, 0, 1)).static::substr($string, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Capitalize the first character of each word in a string.
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $separators
|
||||
* @return ($string is '' ? '' : non-empty-string)
|
||||
*/
|
||||
public static function ucwords($string, $separators = " \t\r\n\f\v")
|
||||
{
|
||||
$pattern = '/(^|['.preg_quote($separators, '/').'])(\p{Ll})/u';
|
||||
|
||||
return preg_replace_callback($pattern, function ($matches) {
|
||||
return $matches[1].mb_strtoupper($matches[2]);
|
||||
}, $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Split a string into pieces by uppercase characters.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string[]
|
||||
* @return ($string is '' ? array{} : string[])
|
||||
*/
|
||||
public static function ucsplit($string)
|
||||
{
|
||||
@@ -1831,7 +1894,7 @@ class Str
|
||||
*
|
||||
* @param string $string
|
||||
* @param string|null $characters
|
||||
* @return int
|
||||
* @return non-negative-int
|
||||
*/
|
||||
public static function wordCount($string, $characters = null)
|
||||
{
|
||||
@@ -1905,7 +1968,7 @@ class Str
|
||||
/**
|
||||
* Set the callable that will be used to generate UUIDs.
|
||||
*
|
||||
* @param callable|null $factory
|
||||
* @param (callable(): \Ramsey\Uuid\UuidInterface)|null $factory
|
||||
* @return void
|
||||
*/
|
||||
public static function createUuidsUsing(?callable $factory = null)
|
||||
@@ -1916,8 +1979,8 @@ class Str
|
||||
/**
|
||||
* Set the sequence that will be used to generate UUIDs.
|
||||
*
|
||||
* @param array $sequence
|
||||
* @param callable|null $whenMissing
|
||||
* @param \Ramsey\Uuid\UuidInterface[] $sequence
|
||||
* @param (callable(): \Ramsey\Uuid\UuidInterface)|null $whenMissing
|
||||
* @return void
|
||||
*/
|
||||
public static function createUuidsUsingSequence(array $sequence, $whenMissing = null)
|
||||
@@ -1950,7 +2013,7 @@ class Str
|
||||
/**
|
||||
* Always return the same UUID when generating new UUIDs.
|
||||
*
|
||||
* @param \Closure|null $callback
|
||||
* @param (\Closure(\Ramsey\Uuid\UuidInterface): mixed)|null $callback
|
||||
* @return \Ramsey\Uuid\UuidInterface
|
||||
*/
|
||||
public static function freezeUuids(?Closure $callback = null)
|
||||
@@ -2012,7 +2075,7 @@ class Str
|
||||
/**
|
||||
* Set the callable that will be used to generate ULIDs.
|
||||
*
|
||||
* @param callable|null $factory
|
||||
* @param (callable(): \Symfony\Component\Uid\Ulid)|null $factory
|
||||
* @return void
|
||||
*/
|
||||
public static function createUlidsUsing(?callable $factory = null)
|
||||
@@ -2023,8 +2086,8 @@ class Str
|
||||
/**
|
||||
* Set the sequence that will be used to generate ULIDs.
|
||||
*
|
||||
* @param array $sequence
|
||||
* @param callable|null $whenMissing
|
||||
* @param \Symfony\Component\Uid\Ulid[] $sequence
|
||||
* @param (callable(): \Symfony\Component\Uid\Ulid)|null $whenMissing
|
||||
* @return void
|
||||
*/
|
||||
public static function createUlidsUsingSequence(array $sequence, $whenMissing = null)
|
||||
@@ -2057,7 +2120,7 @@ class Str
|
||||
/**
|
||||
* Always return the same ULID when generating new ULIDs.
|
||||
*
|
||||
* @param Closure|null $callback
|
||||
* @param (Closure(Ulid): mixed)|null $callback
|
||||
* @return Ulid
|
||||
*/
|
||||
public static function freezeUlids(?Closure $callback = null)
|
||||
|
||||
47
plugins/vendor/illuminate/support/Stringable.php
vendored
47
plugins/vendor/illuminate/support/Stringable.php
vendored
@@ -222,6 +222,18 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
|
||||
return Str::containsAll($this->value, $needles, $ignoreCase);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string doesn't contain a given substring.
|
||||
*
|
||||
* @param string|iterable<string> $needles
|
||||
* @param bool $ignoreCase
|
||||
* @return bool
|
||||
*/
|
||||
public function doesntContain($needles, $ignoreCase = false)
|
||||
{
|
||||
return Str::doesntContain($this->value, $needles, $ignoreCase);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the case of a string.
|
||||
*
|
||||
@@ -237,12 +249,12 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
|
||||
/**
|
||||
* Replace consecutive instances of a given character with a single character.
|
||||
*
|
||||
* @param string $character
|
||||
* @param array<string>|string $characters
|
||||
* @return static
|
||||
*/
|
||||
public function deduplicate(string $character = ' ')
|
||||
public function deduplicate(array|string $characters = ' ')
|
||||
{
|
||||
return new static(Str::deduplicate($this->value, $character));
|
||||
return new static(Str::deduplicate($this->value, $characters));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -879,6 +891,16 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
|
||||
return new static(Str::headline($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given string to only its initials.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function initials()
|
||||
{
|
||||
return new static(Str::initials($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given string to APA-style title case.
|
||||
*
|
||||
@@ -1045,7 +1067,7 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
|
||||
/**
|
||||
* Trim the string of the given characters.
|
||||
*
|
||||
* @param string $characters
|
||||
* @param string|null $characters
|
||||
* @return static
|
||||
*/
|
||||
public function trim($characters = null)
|
||||
@@ -1056,7 +1078,7 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
|
||||
/**
|
||||
* Left trim the string of the given characters.
|
||||
*
|
||||
* @param string $characters
|
||||
* @param string|null $characters
|
||||
* @return static
|
||||
*/
|
||||
public function ltrim($characters = null)
|
||||
@@ -1067,7 +1089,7 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
|
||||
/**
|
||||
* Right trim the string of the given characters.
|
||||
*
|
||||
* @param string $characters
|
||||
* @param string|null $characters
|
||||
* @return static
|
||||
*/
|
||||
public function rtrim($characters = null)
|
||||
@@ -1095,6 +1117,17 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
|
||||
return new static(Str::ucfirst($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Capitalize the first character of each word in a string.
|
||||
*
|
||||
* @param string $separators
|
||||
* @return static
|
||||
*/
|
||||
public function ucwords($separators = " \t\r\n\f\v")
|
||||
{
|
||||
return new static(Str::ucwords($this->value, $separators));
|
||||
}
|
||||
|
||||
/**
|
||||
* Split a string by uppercase characters.
|
||||
*
|
||||
@@ -1470,7 +1503,7 @@ class Stringable implements JsonSerializable, ArrayAccess, BaseStringable
|
||||
*/
|
||||
public function toFloat()
|
||||
{
|
||||
return floatval($this->value);
|
||||
return (float) $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -137,7 +137,6 @@ class BusFake implements Fake, QueueingDispatcher
|
||||
* Assert if a job was pushed exactly once.
|
||||
*
|
||||
* @param string|\Closure $command
|
||||
* @param int $times
|
||||
* @return void
|
||||
*/
|
||||
public function assertDispatchedOnce($command)
|
||||
@@ -488,7 +487,7 @@ class BusFake implements Fake, QueueingDispatcher
|
||||
/**
|
||||
* Create a new assertion about a chained batch.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
* @param \Closure(\Illuminate\Bus\PendingBatch): bool $callback
|
||||
* @return \Illuminate\Support\Testing\Fakes\ChainedBatchTruthTest
|
||||
*/
|
||||
public function chainedBatch(Closure $callback)
|
||||
@@ -499,11 +498,13 @@ class BusFake implements Fake, QueueingDispatcher
|
||||
/**
|
||||
* Assert if a batch was dispatched based on a truth-test callback.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param array|callable(\Illuminate\Bus\PendingBatch): bool $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertBatched(callable $callback)
|
||||
public function assertBatched(callable|array $callback)
|
||||
{
|
||||
$callback = is_array($callback) ? fn (PendingBatchFake $batch) => $batch->hasJobs($callback) : $callback;
|
||||
|
||||
PHPUnit::assertTrue(
|
||||
$this->batched($callback)->count() > 0,
|
||||
'The expected batch was not dispatched.'
|
||||
@@ -606,8 +607,8 @@ class BusFake implements Fake, QueueingDispatcher
|
||||
/**
|
||||
* Get all of the pending batches matching a truth-test callback.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return \Illuminate\Support\Collection
|
||||
* @param callable(\Illuminate\Bus\PendingBatch): bool $callback
|
||||
* @return \Illuminate\Support\Collection<int, \Illuminate\Bus\PendingBatch>
|
||||
*/
|
||||
public function batched(callable $callback)
|
||||
{
|
||||
|
||||
@@ -9,14 +9,14 @@ class ChainedBatchTruthTest
|
||||
/**
|
||||
* The underlying truth test.
|
||||
*
|
||||
* @var \Closure
|
||||
* @var \Closure(\Illuminate\Bus\PendingBatch): bool
|
||||
*/
|
||||
protected $callback;
|
||||
|
||||
/**
|
||||
* Create a new truth test instance.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
* @param \Closure(\Illuminate\Bus\PendingBatch): bool $callback
|
||||
*/
|
||||
public function __construct(Closure $callback)
|
||||
{
|
||||
|
||||
@@ -151,7 +151,6 @@ class EventFake implements Dispatcher, Fake
|
||||
* Assert if an event was dispatched exactly once.
|
||||
*
|
||||
* @param string $event
|
||||
* @param int $times
|
||||
* @return void
|
||||
*/
|
||||
public function assertDispatchedOnce($event)
|
||||
|
||||
@@ -113,7 +113,7 @@ class ExceptionHandlerFake implements ExceptionHandler, Fake
|
||||
{
|
||||
try {
|
||||
$this->assertReported($exception);
|
||||
} catch (ExpectationFailedException $e) {
|
||||
} catch (ExpectationFailedException) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ class MailFake implements Factory, Fake, Mailer, MailQueue
|
||||
* @param int $times
|
||||
* @return void
|
||||
*/
|
||||
protected function assertSentTimes($mailable, $times = 1)
|
||||
public function assertSentTimes($mailable, $times = 1)
|
||||
{
|
||||
$count = $this->sent($mailable)->count();
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ class NotificationFake implements Fake, NotificationDispatcher, NotificationFact
|
||||
}
|
||||
|
||||
PHPUnit::assertEmpty(
|
||||
$this->notifications[get_class($notifiable)][$notifiable->getKey()] ?? [],
|
||||
$this->notifications[get_class($notifiable)][$notifiable->getKey() ?? ''] ?? [],
|
||||
'Notifications were sent unexpectedly.',
|
||||
);
|
||||
}
|
||||
@@ -314,7 +314,7 @@ class NotificationFake implements Fake, NotificationDispatcher, NotificationFact
|
||||
|
||||
foreach ($notifiables as $notifiable) {
|
||||
if (! $notification->id) {
|
||||
$notification->id = Str::uuid()->toString();
|
||||
$notification->id = (string) Str::uuid();
|
||||
}
|
||||
|
||||
$notifiableChannels = $channels ?: $notification->via($notifiable);
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
|
||||
namespace Illuminate\Support\Testing\Fakes;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Bus\PendingBatch;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Traits\ReflectsClosures;
|
||||
|
||||
class PendingBatchFake extends PendingBatch
|
||||
{
|
||||
use ReflectsClosures;
|
||||
|
||||
/**
|
||||
* The fake bus instance.
|
||||
*
|
||||
@@ -23,7 +27,7 @@ class PendingBatchFake extends PendingBatch
|
||||
public function __construct(BusFake $bus, Collection $jobs)
|
||||
{
|
||||
$this->bus = $bus;
|
||||
$this->jobs = $jobs;
|
||||
$this->jobs = $jobs->filter()->values();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,4 +49,39 @@ class PendingBatchFake extends PendingBatch
|
||||
{
|
||||
return $this->bus->recordPendingBatch($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the jobs in the batch match the given jobs.
|
||||
*
|
||||
* @param array $expectedJobs
|
||||
* @return bool
|
||||
*/
|
||||
public function hasJobs(array $expectedJobs)
|
||||
{
|
||||
if (count($this->jobs) !== count($expectedJobs)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($expectedJobs as $index => $expectedJob) {
|
||||
if ($expectedJob instanceof Closure) {
|
||||
$expectedType = $this->firstClosureParameterType($expectedJob);
|
||||
|
||||
if (! $this->jobs[$index] instanceof $expectedType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $expectedJob($this->jobs[$index])) {
|
||||
return false;
|
||||
}
|
||||
} elseif (is_string($expectedJob)) {
|
||||
if ($expectedJob != get_class($this->jobs[$index])) {
|
||||
return false;
|
||||
}
|
||||
} elseif (serialize($expectedJob) != serialize($this->jobs[$index])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,10 @@ namespace Illuminate\Support\Testing\Fakes;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Closure;
|
||||
use Illuminate\Bus\UniqueLock;
|
||||
use Illuminate\Contracts\Cache\Repository as Cache;
|
||||
use Illuminate\Contracts\Queue\Queue;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Events\CallQueuedListener;
|
||||
use Illuminate\Queue\CallQueuedClosure;
|
||||
use Illuminate\Queue\QueueManager;
|
||||
@@ -55,6 +58,13 @@ class QueueFake extends QueueManager implements Fake, Queue
|
||||
*/
|
||||
protected $rawPushes = [];
|
||||
|
||||
/**
|
||||
* All of the unique jobs that were pushed.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $uniqueJobs = [];
|
||||
|
||||
/**
|
||||
* Indicates if items should be serialized and restored when pushed to the queue.
|
||||
*
|
||||
@@ -121,7 +131,7 @@ class QueueFake extends QueueManager implements Fake, Queue
|
||||
* @param int $times
|
||||
* @return void
|
||||
*/
|
||||
protected function assertPushedTimes($job, $times = 1)
|
||||
public function assertPushedTimes($job, $times = 1)
|
||||
{
|
||||
$count = $this->pushed($job)->count();
|
||||
|
||||
@@ -477,6 +487,10 @@ class QueueFake extends QueueManager implements Fake, Queue
|
||||
'queue' => $queue,
|
||||
'data' => $data,
|
||||
];
|
||||
|
||||
if ($job instanceof ShouldBeUnique) {
|
||||
$this->uniqueJobs[] = $job;
|
||||
}
|
||||
} else {
|
||||
is_object($job) && isset($job->connection)
|
||||
? $this->queue->connection($job->connection)->push($job, $data, $queue)
|
||||
@@ -650,6 +664,22 @@ class QueueFake extends QueueManager implements Fake, Queue
|
||||
return unserialize(serialize($job));
|
||||
}
|
||||
|
||||
/**
|
||||
* Release the locks for all unique jobs that were pushed.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function releaseUniqueJobLocks()
|
||||
{
|
||||
$lock = new UniqueLock($this->app->make(Cache::class));
|
||||
|
||||
foreach ($this->uniqueJobs as $job) {
|
||||
$lock->release($job);
|
||||
}
|
||||
|
||||
$this->uniqueJobs = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the connection name for the queue.
|
||||
*
|
||||
|
||||
@@ -36,7 +36,7 @@ class Timebox
|
||||
$exception = $caught;
|
||||
}
|
||||
|
||||
$remainder = intval($microseconds - ((microtime(true) - $start) * 1000000));
|
||||
$remainder = (int) ($microseconds - ((microtime(true) - $start) * 1_000_000));
|
||||
|
||||
if (! $this->earlyReturn && $remainder > 0) {
|
||||
$this->usleep($remainder);
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
|
||||
namespace Illuminate\Support\Traits;
|
||||
|
||||
use Carbon\CarbonInterval;
|
||||
use Carbon\Unit;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
use Illuminate\Support\Number;
|
||||
use Illuminate\Support\Str;
|
||||
use stdClass;
|
||||
|
||||
@@ -269,7 +272,7 @@ trait InteractsWithData
|
||||
*/
|
||||
public function integer($key, $default = 0)
|
||||
{
|
||||
return intval($this->data($key, $default));
|
||||
return (int) $this->data($key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -281,7 +284,21 @@ trait InteractsWithData
|
||||
*/
|
||||
public function float($key, $default = 0.0)
|
||||
{
|
||||
return floatval($this->data($key, $default));
|
||||
return (float) $this->data($key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve data clamped between min and max values.
|
||||
*
|
||||
* @param string $key
|
||||
* @param int|float $min
|
||||
* @param int|float $max
|
||||
* @param int|float $default
|
||||
* @return float|int
|
||||
*/
|
||||
public function clamp($key, $min, $max, $default = 0)
|
||||
{
|
||||
return Number::clamp($this->data($key, $default), $min, $max);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -309,15 +326,40 @@ trait InteractsWithData
|
||||
return Date::createFromFormat($format, $this->data($key), $tz);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve data from the instance as a CarbonInterval instance.
|
||||
*
|
||||
* @param string $key
|
||||
* @param \Carbon\Unit|string|null $unit
|
||||
* @return \Carbon\CarbonInterval|null
|
||||
*/
|
||||
public function interval($key, $unit = null)
|
||||
{
|
||||
if ($this->isNotFilled($key)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$value = $this->data($key);
|
||||
|
||||
if (is_null($unit)) {
|
||||
return CarbonInterval::make($value);
|
||||
}
|
||||
|
||||
$unit = $unit instanceof Unit ? $unit : Unit::fromName($unit);
|
||||
|
||||
return $unit->interval((float) $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve data from the instance as an enum.
|
||||
*
|
||||
* @template TEnum of \BackedEnum
|
||||
* @template TDefault of TEnum|null
|
||||
*
|
||||
* @param string $key
|
||||
* @param class-string<TEnum> $enumClass
|
||||
* @param TEnum|null $default
|
||||
* @return TEnum|null
|
||||
* @param TDefault $default
|
||||
* @return TEnum|TDefault
|
||||
*/
|
||||
public function enum($key, $enumClass, $default = null)
|
||||
{
|
||||
@@ -357,7 +399,7 @@ trait InteractsWithData
|
||||
*/
|
||||
protected function isBackedEnum($enumClass)
|
||||
{
|
||||
return enum_exists($enumClass) && method_exists($enumClass, 'tryFrom');
|
||||
return is_a($enumClass, \BackedEnum::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
12
plugins/vendor/illuminate/support/Uri.php
vendored
12
plugins/vendor/illuminate/support/Uri.php
vendored
@@ -115,6 +115,14 @@ class Uri implements Htmlable, JsonSerializable, Responsable, Stringable
|
||||
return new static(call_user_func(static::$urlGeneratorResolver)->action($action, $parameters, $absolute));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URI's authority.
|
||||
*/
|
||||
public function authority(): ?string
|
||||
{
|
||||
return $this->uri->getAuthority();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URI's scheme.
|
||||
*/
|
||||
@@ -161,8 +169,10 @@ class Uri implements Htmlable, JsonSerializable, Responsable, Stringable
|
||||
* Get the URI's path.
|
||||
*
|
||||
* Empty or missing paths are returned as a single "/".
|
||||
*
|
||||
* @return non-empty-string
|
||||
*/
|
||||
public function path(): ?string
|
||||
public function path(): string
|
||||
{
|
||||
$path = trim((string) $this->uri->getPath(), '/');
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@ namespace Illuminate\Support;
|
||||
|
||||
use ArrayIterator;
|
||||
use Illuminate\Contracts\Support\ValidatedData;
|
||||
use Illuminate\Support\Traits\Dumpable;
|
||||
use Illuminate\Support\Traits\InteractsWithData;
|
||||
use Symfony\Component\VarDumper\VarDumper;
|
||||
use Traversable;
|
||||
|
||||
class ValidatedInput implements ValidatedData
|
||||
{
|
||||
use InteractsWithData;
|
||||
use Dumpable, InteractsWithData;
|
||||
|
||||
/**
|
||||
* The underlying input.
|
||||
@@ -97,30 +97,15 @@ class ValidatedInput implements ValidatedData
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump the validated inputs items and end the script.
|
||||
*
|
||||
* @param mixed ...$keys
|
||||
* @return never
|
||||
*/
|
||||
public function dd(...$keys)
|
||||
{
|
||||
$this->dump(...$keys);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump the items.
|
||||
*
|
||||
* @param mixed $keys
|
||||
* @param mixed ...$keys
|
||||
* @return $this
|
||||
*/
|
||||
public function dump($keys = [])
|
||||
public function dump(...$keys)
|
||||
{
|
||||
$keys = is_array($keys) ? $keys : func_get_args();
|
||||
|
||||
VarDumper::dump(count($keys) > 0 ? $this->only($keys) : $this->all());
|
||||
dump(count($keys) > 0 ? $this->only($keys) : $this->all());
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -161,6 +146,7 @@ class ValidatedInput implements ValidatedData
|
||||
/**
|
||||
* Determine if an input item is set.
|
||||
*
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset($name)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"illuminate/conditionable": "^12.0",
|
||||
"illuminate/contracts": "^12.0",
|
||||
"illuminate/macroable": "^12.0",
|
||||
"illuminate/reflection": "^12.0",
|
||||
"nesbot/carbon": "^3.8.4",
|
||||
"symfony/polyfill-php83": "^1.33",
|
||||
"symfony/polyfill-php85": "^1.33",
|
||||
|
||||
108
plugins/vendor/illuminate/support/functions.php
vendored
108
plugins/vendor/illuminate/support/functions.php
vendored
@@ -2,8 +2,11 @@
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Carbon\CarbonInterface;
|
||||
use Carbon\CarbonInterval;
|
||||
use Illuminate\Support\Defer\DeferredCallback;
|
||||
use Illuminate\Support\Defer\DeferredCallbackCollection;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
use Symfony\Component\Process\PhpExecutableFinder;
|
||||
|
||||
if (! function_exists('Illuminate\Support\defer')) {
|
||||
@@ -47,3 +50,108 @@ if (! function_exists('Illuminate\Support\artisan_binary')) {
|
||||
return defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan';
|
||||
}
|
||||
}
|
||||
|
||||
// Time functions...
|
||||
|
||||
if (! function_exists('Illuminate\Support\now')) {
|
||||
/**
|
||||
* Create a new Carbon instance for the current time.
|
||||
*
|
||||
* @param \DateTimeZone|\UnitEnum|string|null $tz
|
||||
* @return \Illuminate\Support\Carbon
|
||||
*/
|
||||
function now($tz = null): CarbonInterface
|
||||
{
|
||||
return Date::now(enum_value($tz));
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('Illuminate\Support\microseconds')) {
|
||||
/**
|
||||
* Get the current date / time plus the given number of microseconds.
|
||||
*/
|
||||
function microseconds(int|float $microseconds): CarbonInterval
|
||||
{
|
||||
return CarbonInterval::microseconds($microseconds);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('Illuminate\Support\milliseconds')) {
|
||||
/**
|
||||
* Get the current date / time plus the given number of milliseconds.
|
||||
*/
|
||||
function milliseconds(int|float $milliseconds): CarbonInterval
|
||||
{
|
||||
return CarbonInterval::milliseconds($milliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('Illuminate\Support\seconds')) {
|
||||
/**
|
||||
* Get the current date / time plus the given number of seconds.
|
||||
*/
|
||||
function seconds(int|float $seconds): CarbonInterval
|
||||
{
|
||||
return CarbonInterval::seconds($seconds);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('Illuminate\Support\minutes')) {
|
||||
/**
|
||||
* Get the current date / time plus the given number of minutes.
|
||||
*/
|
||||
function minutes(int|float $minutes): CarbonInterval
|
||||
{
|
||||
return CarbonInterval::minutes($minutes);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('Illuminate\Support\hours')) {
|
||||
/**
|
||||
* Get the current date / time plus the given number of hours.
|
||||
*/
|
||||
function hours(int|float $hours): CarbonInterval
|
||||
{
|
||||
return CarbonInterval::hours($hours);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('Illuminate\Support\days')) {
|
||||
/**
|
||||
* Get the current date / time plus the given number of days.
|
||||
*/
|
||||
function days(int|float $days): CarbonInterval
|
||||
{
|
||||
return CarbonInterval::days($days);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('Illuminate\Support\weeks')) {
|
||||
/**
|
||||
* Get the current date / time plus the given number of weeks.
|
||||
*/
|
||||
function weeks(int $weeks): CarbonInterval
|
||||
{
|
||||
return CarbonInterval::weeks($weeks);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('Illuminate\Support\months')) {
|
||||
/**
|
||||
* Get the current date / time plus the given number of months.
|
||||
*/
|
||||
function months(int $months): CarbonInterval
|
||||
{
|
||||
return CarbonInterval::months($months);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('Illuminate\Support\years')) {
|
||||
/**
|
||||
* Get the current date / time plus the given number of years.
|
||||
*/
|
||||
function years(int $years): CarbonInterval
|
||||
{
|
||||
return CarbonInterval::years($years);
|
||||
}
|
||||
}
|
||||
|
||||
33
plugins/vendor/illuminate/support/helpers.php
vendored
33
plugins/vendor/illuminate/support/helpers.php
vendored
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Carbon\CarbonInterval;
|
||||
use Illuminate\Contracts\Support\DeferringDisplayableValue;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -127,7 +128,7 @@ if (! function_exists('e')) {
|
||||
}
|
||||
|
||||
if ($value instanceof Htmlable) {
|
||||
return $value->toHtml();
|
||||
return $value->toHtml() ?? '';
|
||||
}
|
||||
|
||||
if ($value instanceof BackedEnum) {
|
||||
@@ -232,7 +233,7 @@ if (! function_exists('laravel_cloud')) {
|
||||
function laravel_cloud(): bool
|
||||
{
|
||||
return ($_ENV['LARAVEL_CLOUD'] ?? false) === '1' ||
|
||||
($_SERVER['LARAVEL_CLOUD'] ?? false) === '1';
|
||||
($_SERVER['LARAVEL_CLOUD'] ?? false) === '1';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,9 +289,7 @@ if (! function_exists('preg_replace_array')) {
|
||||
function preg_replace_array($pattern, array $replacements, $subject): string
|
||||
{
|
||||
return preg_replace_callback($pattern, function () use (&$replacements) {
|
||||
foreach ($replacements as $value) {
|
||||
return array_shift($replacements);
|
||||
}
|
||||
return array_shift($replacements);
|
||||
}, $subject);
|
||||
}
|
||||
}
|
||||
@@ -303,7 +302,7 @@ if (! function_exists('retry')) {
|
||||
*
|
||||
* @param int|array<int, int> $times
|
||||
* @param callable(int): TValue $callback
|
||||
* @param int|\Closure(int, \Throwable): int $sleepMilliseconds
|
||||
* @param CarbonInterval|int|\Closure(int, \Throwable): CarbonInterval|int $sleepMilliseconds
|
||||
* @param (callable(\Throwable): bool)|null $when
|
||||
* @return TValue
|
||||
*
|
||||
@@ -335,7 +334,11 @@ if (! function_exists('retry')) {
|
||||
$sleepMilliseconds = $backoff[$attempts - 1] ?? $sleepMilliseconds;
|
||||
|
||||
if ($sleepMilliseconds) {
|
||||
Sleep::usleep(value($sleepMilliseconds, $attempts, $e) * 1000);
|
||||
$duration = value($sleepMilliseconds, $attempts, $e);
|
||||
|
||||
$duration instanceof CarbonInterval
|
||||
? Sleep::usleep($duration->totalMicroseconds)
|
||||
: Sleep::usleep($duration * 1000);
|
||||
}
|
||||
|
||||
goto beginning;
|
||||
@@ -398,11 +401,13 @@ if (! function_exists('throw_if')) {
|
||||
* Throw the given exception if the given condition is true.
|
||||
*
|
||||
* @template TValue
|
||||
* @template TParams of mixed
|
||||
* @template TException of \Throwable
|
||||
* @template TExceptionValue of TException|class-string<TException>|string
|
||||
*
|
||||
* @param TValue $condition
|
||||
* @param TException|class-string<TException>|string $exception
|
||||
* @param mixed ...$parameters
|
||||
* @param Closure(TParams): TExceptionValue|TExceptionValue $exception
|
||||
* @param TParams ...$parameters
|
||||
* @return ($condition is true ? never : ($condition is non-empty-mixed ? never : TValue))
|
||||
*
|
||||
* @throws TException
|
||||
@@ -410,6 +415,10 @@ if (! function_exists('throw_if')) {
|
||||
function throw_if($condition, $exception = 'RuntimeException', ...$parameters)
|
||||
{
|
||||
if ($condition) {
|
||||
if ($exception instanceof Closure) {
|
||||
$exception = $exception(...$parameters);
|
||||
}
|
||||
|
||||
if (is_string($exception) && class_exists($exception)) {
|
||||
$exception = new $exception(...$parameters);
|
||||
}
|
||||
@@ -426,11 +435,13 @@ if (! function_exists('throw_unless')) {
|
||||
* Throw the given exception unless the given condition is true.
|
||||
*
|
||||
* @template TValue
|
||||
* @template TParams of mixed
|
||||
* @template TException of \Throwable
|
||||
* @template TExceptionValue of TException|class-string<TException>|string
|
||||
*
|
||||
* @param TValue $condition
|
||||
* @param TException|class-string<TException>|string $exception
|
||||
* @param mixed ...$parameters
|
||||
* @param Closure(TParams): TExceptionValue|TExceptionValue $exception
|
||||
* @param TParams ...$parameters
|
||||
* @return ($condition is false ? never : ($condition is non-empty-mixed ? TValue : never))
|
||||
*
|
||||
* @throws TException
|
||||
|
||||
Reference in New Issue
Block a user