diff options
| author | wn_ <invalid@email.com> | 2024-10-07 20:22:01 +0000 |
|---|---|---|
| committer | wn_ <invalid@email.com> | 2024-10-07 20:22:01 +0000 |
| commit | 124c4e254250ebac336392711b32dfd6fa3caef3 (patch) | |
| tree | ab331cad28c1619db93474c846b11dc3e131c85f /vendor/guzzlehttp/psr7/src/Utils.php | |
| parent | df489df309dc831b357a9cc36fe72ad5a99d22e0 (diff) | |
Update Guzzle to 7.9.2
https://github.com/guzzle/guzzle/releases
Diffstat (limited to 'vendor/guzzlehttp/psr7/src/Utils.php')
| -rw-r--r-- | vendor/guzzlehttp/psr7/src/Utils.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/vendor/guzzlehttp/psr7/src/Utils.php b/vendor/guzzlehttp/psr7/src/Utils.php index 917c05e30..7682d2cdc 100644 --- a/vendor/guzzlehttp/psr7/src/Utils.php +++ b/vendor/guzzlehttp/psr7/src/Utils.php @@ -14,18 +14,18 @@ final class Utils /** * Remove the items given by the keys, case insensitively from the data. * - * @param string[] $keys + * @param (string|int)[] $keys */ public static function caselessRemove(array $keys, array $data): array { $result = []; foreach ($keys as &$key) { - $key = strtolower($key); + $key = strtolower((string) $key); } foreach ($data as $k => $v) { - if (!is_string($k) || !in_array(strtolower($k), $keys)) { + if (!in_array(strtolower((string) $k), $keys)) { $result[$k] = $v; } } @@ -231,7 +231,7 @@ final class Utils * @param StreamInterface $stream Stream to read from * @param int|null $maxLength Maximum buffer length */ - public static function readLine(StreamInterface $stream, int $maxLength = null): string + public static function readLine(StreamInterface $stream, ?int $maxLength = null): string { $buffer = ''; $size = 0; @@ -251,6 +251,20 @@ final class Utils } /** + * Redact the password in the user info part of a URI. + */ + public static function redactUserInfo(UriInterface $uri): UriInterface + { + $userInfo = $uri->getUserInfo(); + + if (false !== ($pos = \strpos($userInfo, ':'))) { + return $uri->withUserInfo(\substr($userInfo, 0, $pos), '***'); + } + + return $uri; + } + + /** * Create a new stream based on the input type. * * Options is an associative array that can contain the following keys: |