[Web] Update composer libraries

This commit is contained in:
FreddleSpl0it committed 2026-10-28 11:56:29 +01:00
1 parent 9cc8ac2908
commit bd8c784118
1297 files changed
+71585 -24460

No files matched your search

+73 -6
View File
@@ -13,7 +13,7 @@ if (! function_exists('collect')) {
* @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue>|null $value
* @return \Illuminate\Support\Collection<TKey, TValue>
*/
function collect($value = [])
function collect($value = []): Collection
{
return new Collection($value);
}
@@ -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.
@@ -74,6 +104,15 @@ if (! function_exists('data_get')) {
return in_array('*', $key) ? Arr::collapse($result) : $result;
}
$segment = match ($segment) {
'\*' => '*',
'\{first}' => '{first}',
'{first}' => array_key_first(Arr::from($target)),
'\{last}' => '{last}',
'{last}' => array_key_last(Arr::from($target)),
default => $segment,
};
if (Arr::accessible($target) && Arr::exists($target, $segment)) {
$target = $target[$segment];
} elseif (is_object($target) && isset($target->{$segment})) {
@@ -194,7 +233,7 @@ if (! function_exists('head')) {
*/
function head($array)
{
return reset($array);
return empty($array) ? false : array_first($array);
}
}
@@ -207,7 +246,7 @@ if (! function_exists('last')) {
*/
function last($array)
{
return end($array);
return empty($array) ? false : array_last($array);
}
}
@@ -215,12 +254,40 @@ if (! function_exists('value')) {
/**
* Return the default value of the given value.
*
* @param mixed $value
* @param mixed ...$args
* @return mixed
* @template TValue
* @template TArgs
*
* @param TValue|\Closure(TArgs): TValue $value
* @param TArgs ...$args
* @return TValue
*/
function value($value, ...$args)
{
return $value instanceof Closure ? $value(...$args) : $value;
}
}
if (! function_exists('when')) {
/**
* Return a value if the given condition is true.
*
* @template TValue
* @template TArgs
* @template TDefault
*
* @param mixed $condition
* @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)
{
$condition = $condition instanceof Closure ? $condition() : $condition;
if ($condition) {
return value($value, $condition);
}
return value($default, $condition);
}
}