@@ -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 |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public function get(string $name) : ?SetCookie |
| 37 | 37 | { |
| 38 | - if (! $this->has($name)) { |
|
| 38 | + if (!$this->has($name)) { |
|
| 39 | 39 | return null; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | $clone = clone $this; |
| 63 | 63 | |
| 64 | - if (! $clone->has($name)) { |
|
| 64 | + if (!$clone->has($name)) { |
|
| 65 | 65 | return $clone; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public static function fromSetCookieStrings(array $setCookieStrings) : self |
| 94 | 94 | { |
| 95 | - return new static(array_map(static function (string $setCookieString) : SetCookie { |
|
| 95 | + return new static(array_map(static function(string $setCookieString) : SetCookie { |
|
| 96 | 96 | return SetCookie::fromSetCookieString($setCookieString); |
| 97 | 97 | }, $setCookieStrings)); |
| 98 | 98 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public static function fromResponse(ResponseInterface $response) : SetCookies |
| 104 | 104 | { |
| 105 | - return new static(array_map(static function (string $setCookieString) : SetCookie { |
|
| 105 | + return new static(array_map(static function(string $setCookieString) : SetCookie { |
|
| 106 | 106 | return SetCookie::fromSetCookieString($setCookieString); |
| 107 | 107 | }, $response->getHeader(static::SET_COOKIE_HEADER))); |
| 108 | 108 | } |
@@ -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 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public function get(string $name) : ?Cookie |
| 37 | 37 | { |
| 38 | - if (! $this->has($name)) { |
|
| 38 | + if (!$this->has($name)) { |
|
| 39 | 39 | return null; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | $clone = clone $this; |
| 63 | 63 | |
| 64 | - if (! $clone->has($name)) { |
|
| 64 | + if (!$clone->has($name)) { |
|
| 65 | 65 | return $clone; |
| 66 | 66 | } |
| 67 | 67 | |