@@ -167,18 +167,18 @@ public function redirect(string $url, int $code = self::S302_FOUND): void
167167 * The parameter is either a time interval (as text) or `null`, which disables caching.
168168 * @throws Nette\InvalidStateException if HTTP headers have been sent
169169 */
170- public function setExpiration (?string $ time ): static
170+ public function setExpiration (?string $ expires ): static
171171 {
172172 $ this ->setHeader ('Pragma ' , null );
173- if (!$ time ) { // no cache
173+ if (!$ expires ) { // no cache
174174 $ this ->setHeader ('Cache-Control ' , 's-maxage=0, max-age=0, must-revalidate ' );
175175 $ this ->setHeader ('Expires ' , 'Mon, 23 Jan 1978 10:00:00 GMT ' );
176176 return $ this ;
177177 }
178178
179- $ time = DateTime::from ($ time );
180- $ this ->setHeader ('Cache-Control ' , 'max-age= ' . ($ time ->format ('U ' ) - time ()));
181- $ this ->setHeader ('Expires ' , Helpers::formatDate ($ time ));
179+ $ expires = DateTime::from ($ expires );
180+ $ this ->setHeader ('Cache-Control ' , 'max-age= ' . ($ expires ->format ('U ' ) - time ()));
181+ $ this ->setHeader ('Expires ' , Helpers::formatDate ($ expires ));
182182 return $ this ;
183183 }
184184
@@ -246,7 +246,7 @@ public function __destruct()
246246 public function setCookie (
247247 string $ name ,
248248 string $ value ,
249- string |int |\ DateTimeInterface | null $ time ,
249+ string |int |null $ expires ,
250250 ?string $ path = null ,
251251 ?string $ domain = null ,
252252 ?bool $ secure = null ,
@@ -255,7 +255,7 @@ public function setCookie(
255255 ): static {
256256 self ::checkHeaders ();
257257 setcookie ($ name , $ value , [
258- 'expires ' => $ time ? (int ) DateTime::from ($ time )->format ('U ' ) : 0 ,
258+ 'expires ' => $ expires ? (int ) DateTime::from ($ expires )->format ('U ' ) : 0 ,
259259 'path ' => $ path ?? ($ domain ? '/ ' : $ this ->cookiePath ),
260260 'domain ' => $ domain ?? ($ path ? '' : $ this ->cookieDomain ),
261261 'secure ' => $ secure ?? $ this ->cookieSecure ,
0 commit comments