1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00

Update dependencies.

This commit is contained in:
Caleb Mazalevskis 2022-01-06 20:13:38 +08:00
parent 43c00721ca
commit feb9ac315b
No known key found for this signature in database
GPG key ID: 082E6BC1046FAB95
11243 changed files with 338413 additions and 11922 deletions

View file

@ -34,7 +34,7 @@ class Cookie
private $sameSite;
private $secureDefault = false;
private static $reservedCharsList = "=,; \t\r\n\v\f";
private const RESERVED_CHARS_LIST = "=,; \t\r\n\v\f";
private const RESERVED_CHARS_FROM = ['=', ',', ';', ' ', "\t", "\r", "\n", "\v", "\f"];
private const RESERVED_CHARS_TO = ['%3D', '%2C', '%3B', '%20', '%09', '%0D', '%0A', '%0B', '%0C'];
@ -92,7 +92,7 @@ class Cookie
public function __construct(string $name, string $value = null, $expire = 0, ?string $path = '/', string $domain = null, bool $secure = null, bool $httpOnly = true, bool $raw = false, ?string $sameSite = 'lax')
{
// from PHP source code
if ($raw && false !== strpbrk($name, self::$reservedCharsList)) {
if ($raw && false !== strpbrk($name, self::RESERVED_CHARS_LIST)) {
throw new \InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $name));
}
@ -156,10 +156,8 @@ class Cookie
* Converts expires formats to a unix timestamp.
*
* @param int|string|\DateTimeInterface $expire
*
* @return int
*/
private static function expiresTimestamp($expire = 0)
private static function expiresTimestamp($expire = 0): int
{
// convert expiration time to a Unix timestamp
if ($expire instanceof \DateTimeInterface) {
@ -221,7 +219,7 @@ class Cookie
*/
public function withRaw(bool $raw = true): self
{
if ($raw && false !== strpbrk($this->name, self::$reservedCharsList)) {
if ($raw && false !== strpbrk($this->name, self::RESERVED_CHARS_LIST)) {
throw new \InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $this->name));
}
@ -257,7 +255,7 @@ class Cookie
/**
* Returns the cookie as a string.
*
* @return string The cookie
* @return string
*/
public function __toString()
{