@@ -149,6 +149,9 @@ |
||
| 149 | 149 | return $this->withExpires(new DateTime('-5 years')); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | + /** |
|
| 153 | + * @param integer $maxAge |
|
| 154 | + */ |
|
| 152 | 155 | public function withMaxAge(?int $maxAge = null): self |
| 153 | 156 | { |
| 154 | 157 | $clone = clone $this; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $time = strtotime($expires); |
| 122 | 122 | |
| 123 | - if (! is_int($time)) { |
|
| 123 | + if (!is_int($time)) { |
|
| 124 | 124 | throw new InvalidArgumentException(sprintf('Invalid expires "%s" provided', $expires)); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | public function __toString(): string |
| 216 | 216 | { |
| 217 | 217 | $cookieStringParts = [ |
| 218 | - urlencode($this->name) . '=' . urlencode((string) $this->value), |
|
| 218 | + urlencode($this->name).'='.urlencode((string) $this->value), |
|
| 219 | 219 | ]; |
| 220 | 220 | |
| 221 | 221 | $cookieStringParts = $this->appendFormattedDomainPartIfSet($cookieStringParts); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | $rawAttribute = array_shift($rawAttributes); |
| 252 | 252 | |
| 253 | - if (! is_string($rawAttribute)) { |
|
| 253 | + if (!is_string($rawAttribute)) { |
|
| 254 | 254 | throw new InvalidArgumentException(sprintf( |
| 255 | 255 | 'The provided cookie string "%s" must have at least one attribute', |
| 256 | 256 | $string |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function get(string $name): ?SetCookie |
| 36 | 36 | { |
| 37 | - if (! $this->has($name)) { |
|
| 37 | + if (!$this->has($name)) { |
|
| 38 | 38 | return null; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | $clone = clone $this; |
| 62 | 62 | |
| 63 | - if (! $clone->has($name)) { |
|
| 63 | + if (!$clone->has($name)) { |
|
| 64 | 64 | return $clone; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public static function fromSetCookieStrings(array $setCookieStrings): self |
| 91 | 91 | { |
| 92 | - return new self(array_map(static function (string $setCookieString): SetCookie { |
|
| 92 | + return new self(array_map(static function(string $setCookieString): SetCookie { |
|
| 93 | 93 | return SetCookie::fromSetCookieString($setCookieString); |
| 94 | 94 | }, $setCookieStrings)); |
| 95 | 95 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public static function fromResponse(ResponseInterface $response): SetCookies |
| 101 | 101 | { |
| 102 | - return new self(array_map(static function (string $setCookieString): SetCookie { |
|
| 102 | + return new self(array_map(static function(string $setCookieString): SetCookie { |
|
| 103 | 103 | return SetCookie::fromSetCookieString($setCookieString); |
| 104 | 104 | }, $response->getHeader(self::SET_COOKIE_HEADER))); |
| 105 | 105 | } |
@@ -68,6 +68,6 @@ |
||
| 68 | 68 | |
| 69 | 69 | public function asString(): string |
| 70 | 70 | { |
| 71 | - return 'SameSite=' . $this->value; |
|
| 71 | + return 'SameSite='.$this->value; |
|
| 72 | 72 | } |
| 73 | 73 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | |
| 38 | 38 | public static function modify(ResponseInterface $response, string $name, callable $modify): ResponseInterface |
| 39 | 39 | { |
| 40 | - if (! is_callable($modify)) { |
|
| 40 | + if (!is_callable($modify)) { |
|
| 41 | 41 | throw new InvalidArgumentException('$modify must be callable.'); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function __toString(): string |
| 47 | 47 | { |
| 48 | - return urlencode($this->name) . '=' . urlencode((string) $this->value); |
|
| 48 | + return urlencode($this->name).'='.urlencode((string) $this->value); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $cookies = StringUtil::splitOnAttributeDelimiter($string); |
| 67 | 67 | |
| 68 | - return array_map(static function ($cookiePair) { |
|
| 68 | + return array_map(static function($cookiePair) { |
|
| 69 | 69 | return static::oneFromCookiePair($cookiePair); |
| 70 | 70 | }, $cookies); |
| 71 | 71 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function get(string $name): ?Cookie |
| 36 | 36 | { |
| 37 | - if (! $this->has($name)) { |
|
| 37 | + if (!$this->has($name)) { |
|
| 38 | 38 | return null; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | $clone = clone $this; |
| 62 | 62 | |
| 63 | - if (! $clone->has($name)) { |
|
| 63 | + if (!$clone->has($name)) { |
|
| 64 | 64 | return $clone; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | public static function modify(RequestInterface $request, string $name, callable $modify): RequestInterface |
| 34 | 34 | { |
| 35 | - if (! is_callable($modify)) { |
|
| 35 | + if (!is_callable($modify)) { |
|
| 36 | 36 | throw new InvalidArgumentException('$modify must be callable.'); |
| 37 | 37 | } |
| 38 | 38 | |