git subrepo commit mailcow/src/mailcow-dockerized
subrepo: subdir: "mailcow/src/mailcow-dockerized"
merged: "308860af"
upstream: origin: "https://github.com/mailcow/mailcow-dockerized.git"
branch: "master"
commit: "3f1a5af8"
git-subrepo: version: "0.4.5"
origin: "???"
commit: "???"
Change-Id: I5d51c14b45db54fe706be40a591ddbfcea50d4b0
diff --git a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/tightenco/collect/src/Collect/Support/Traits/EnumeratesValues.php b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/tightenco/collect/src/Collect/Support/Traits/EnumeratesValues.php
index 2ff7d36..2600a22 100644
--- a/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/tightenco/collect/src/Collect/Support/Traits/EnumeratesValues.php
+++ b/mailcow/src/mailcow-dockerized/data/web/inc/lib/vendor/tightenco/collect/src/Collect/Support/Traits/EnumeratesValues.php
@@ -15,11 +15,13 @@
use JsonSerializable;
use Symfony\Component\VarDumper\VarDumper;
use Traversable;
+use UnexpectedValueException;
/**
* @property-read HigherOrderCollectionProxy $average
* @property-read HigherOrderCollectionProxy $avg
* @property-read HigherOrderCollectionProxy $contains
+ * @property-read HigherOrderCollectionProxy $doesntContain
* @property-read HigherOrderCollectionProxy $each
* @property-read HigherOrderCollectionProxy $every
* @property-read HigherOrderCollectionProxy $filter
@@ -46,6 +48,13 @@
trait EnumeratesValues
{
/**
+ * Indicates that the object's string representation should be escaped when __toString is invoked.
+ *
+ * @var bool
+ */
+ protected $escapeWhenCastingToString = false;
+
+ /**
* The methods that can be proxied.
*
* @var string[]
@@ -54,6 +63,7 @@
'average',
'avg',
'contains',
+ 'doesntContain',
'each',
'every',
'filter',
@@ -714,6 +724,22 @@
}
/**
+ * Pass the collection through a series of callable pipes and return the result.
+ *
+ * @param array<callable> $pipes
+ * @return mixed
+ */
+ public function pipeThrough($pipes)
+ {
+ return static::make($pipes)->reduce(
+ function ($carry, $pipe) {
+ return $pipe($carry);
+ },
+ $this,
+ );
+ }
+
+ /**
* Pass the collection to the given callback and then return it.
*
* @param callable $callback
@@ -730,7 +756,7 @@
* Reduce the collection to a single value.
*
* @param callable $callback
- * @param mixed $initial
+ * @param mixed $initial
* @return mixed
*/
public function reduce(callable $callback, $initial = null)
@@ -745,24 +771,61 @@
}
/**
- * Reduce an associative collection to a single value.
+ * Reduce the collection to multiple aggregate values.
*
* @param callable $callback
- * @param mixed $initial
- * @return mixed
+ * @param mixed ...$initial
+ * @return array
+ *
+ * @deprecated Use "reduceSpread" instead
+ *
+ * @throws \UnexpectedValueException
*/
- public function reduceWithKeys(callable $callback, $initial = null)
+ public function reduceMany(callable $callback, ...$initial)
+ {
+ return $this->reduceSpread($callback, ...$initial);
+ }
+
+ /**
+ * Reduce the collection to multiple aggregate values.
+ *
+ * @param callable $callback
+ * @param mixed ...$initial
+ * @return array
+ *
+ * @throws \UnexpectedValueException
+ */
+ public function reduceSpread(callable $callback, ...$initial)
{
$result = $initial;
foreach ($this as $key => $value) {
- $result = $callback($result, $value, $key);
+ $result = call_user_func_array($callback, array_merge($result, [$value, $key]));
+
+ if (! is_array($result)) {
+ throw new UnexpectedValueException(sprintf(
+ "%s::reduceMany expects reducer to return an array, but got a '%s' instead.",
+ class_basename(static::class), gettype($result)
+ ));
+ }
}
return $result;
}
/**
+ * Reduce an associative collection to a single value.
+ *
+ * @param callable $callback
+ * @param mixed $initial
+ * @return mixed
+ */
+ public function reduceWithKeys(callable $callback, $initial = null)
+ {
+ return $this->reduce($callback, $initial);
+ }
+
+ /**
* Create a collection of all elements that do not pass a given truth test.
*
* @param callable|mixed $callback
@@ -780,28 +843,6 @@
}
/**
- * Return only unique items from the collection array.
- *
- * @param string|callable|null $key
- * @param bool $strict
- * @return static
- */
- public function unique($key = null, $strict = false)
- {
- $callback = $this->valueRetriever($key);
-
- $exists = [];
-
- return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) {
- if (in_array($id = $callback($item, $key), $exists, $strict)) {
- return true;
- }
-
- $exists[] = $id;
- });
- }
-
- /**
* Return only unique items from the collection array using strict comparison.
*
* @param string|callable|null $key
@@ -839,6 +880,7 @@
*
* @return array
*/
+ #[\ReturnTypeWillChange]
public function jsonSerialize()
{
return array_map(function ($value) {
@@ -883,7 +925,22 @@
*/
public function __toString()
{
- return $this->toJson();
+ return $this->escapeWhenCastingToString
+ ? e($this->toJson())
+ : $this->toJson();
+ }
+
+ /**
+ * Indicate that the model's string representation should be escaped when __toString is invoked.
+ *
+ * @param bool $escape
+ * @return $this
+ */
+ public function escapeWhenCastingToString($escape = true)
+ {
+ $this->escapeWhenCastingToString = $escape;
+
+ return $this;
}
/**