@@ -131,6 +131,9 @@ |
||
131 | 131 | return $this->withExpires(new DateTime('-5 years')); |
132 | 132 | } |
133 | 133 | |
134 | + /** |
|
135 | + * @param integer $maxAge |
|
136 | + */ |
|
134 | 137 | public function withMaxAge(?int $maxAge = null) : self |
135 | 138 | { |
136 | 139 | $clone = clone($this); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | $time = strtotime($expires); |
120 | 120 | |
121 | - if (! is_int($time)) { |
|
121 | + if (!is_int($time)) { |
|
122 | 122 | throw new \InvalidArgumentException(sprintf('Invalid expires "%s" provided', $expires)); |
123 | 123 | } |
124 | 124 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | public function __toString() : string |
214 | 214 | { |
215 | 215 | $cookieStringParts = [ |
216 | - urlencode($this->name) . '=' . urlencode((string) $this->value), |
|
216 | + urlencode($this->name).'='.urlencode((string) $this->value), |
|
217 | 217 | ]; |
218 | 218 | |
219 | 219 | $cookieStringParts = $this->appendFormattedDomainPartIfSet($cookieStringParts); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | $rawAttribute = array_shift($rawAttributes); |
250 | 250 | |
251 | - if (! is_string($rawAttribute)) { |
|
251 | + if (!is_string($rawAttribute)) { |
|
252 | 252 | throw new \InvalidArgumentException(sprintf( |
253 | 253 | 'The provided cookie string "%s" must have at least one attribute', |
254 | 254 | $string |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | public function get(string $name) : ?SetCookie |
35 | 35 | { |
36 | - if (! $this->has($name)) { |
|
36 | + if (!$this->has($name)) { |
|
37 | 37 | return null; |
38 | 38 | } |
39 | 39 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | $clone = clone($this); |
61 | 61 | |
62 | - if (! $clone->has($name)) { |
|
62 | + if (!$clone->has($name)) { |
|
63 | 63 | return $clone; |
64 | 64 | } |
65 | 65 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public static function fromSetCookieStrings(array $setCookieStrings) : self |
92 | 92 | { |
93 | - return new static(array_map(function (string $setCookieString) : SetCookie { |
|
93 | + return new static(array_map(function(string $setCookieString) : SetCookie { |
|
94 | 94 | return SetCookie::fromSetCookieString($setCookieString); |
95 | 95 | }, $setCookieStrings)); |
96 | 96 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public static function fromResponse(ResponseInterface $response) : SetCookies |
103 | 103 | { |
104 | - return new static(array_map(function (string $setCookieString) : SetCookie { |
|
104 | + return new static(array_map(function(string $setCookieString) : SetCookie { |
|
105 | 105 | return SetCookie::fromSetCookieString($setCookieString); |
106 | 106 | }, $response->getHeader(static::SET_COOKIE_HEADER))); |
107 | 107 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | public function get(string $name) : ?Cookie |
35 | 35 | { |
36 | - if (! $this->has($name)) { |
|
36 | + if (!$this->has($name)) { |
|
37 | 37 | return null; |
38 | 38 | } |
39 | 39 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | $clone = clone($this); |
61 | 61 | |
62 | - if (! $clone->has($name)) { |
|
62 | + if (!$clone->has($name)) { |
|
63 | 63 | return $clone; |
64 | 64 | } |
65 | 65 |
@@ -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 |
@@ -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 |
@@ -50,6 +50,6 @@ |
||
50 | 50 | |
51 | 51 | public function asString() : string |
52 | 52 | { |
53 | - return 'SameSite=' . ($this->strict ? 'Strict' : 'Lax'); |
|
53 | + return 'SameSite='.($this->strict ? 'Strict' : 'Lax'); |
|
54 | 54 | } |
55 | 55 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function __toString() : string |
48 | 48 | { |
49 | - return urlencode($this->name) . '=' . urlencode((string) $this->value); |
|
49 | + return urlencode($this->name).'='.urlencode((string) $this->value); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | $cookies = StringUtil::splitOnAttributeDelimiter($string); |
69 | 69 | |
70 | - return array_map(function ($cookiePair) { |
|
70 | + return array_map(function($cookiePair) { |
|
71 | 71 | return static::oneFromCookiePair($cookiePair); |
72 | 72 | }, $cookies); |
73 | 73 | } |