44
55namespace Arachne \Codeception \Http ;
66
7- use Nette \Http \Helpers ;
87use Nette \Http \IResponse ;
8+ use Nette \Http \Response as HttpResponse ;
99use Nette \Utils \DateTime ;
1010
1111/**
@@ -31,40 +31,62 @@ public function reset(): void
3131 $ this ->headers = [];
3232 }
3333
34- public function setCode (int $ code ): self
34+ /**
35+ * @param int $code
36+ */
37+ public function setCode ($ code ): self
3538 {
3639 $ this ->code = $ code ;
3740
3841 return $ this ;
3942 }
4043
41- public function getCode (): int
44+ /**
45+ * @return int
46+ */
47+ public function getCode ()
4248 {
4349 return $ this ->code ;
4450 }
4551
46- public function setHeader (string $ name , string $ value ): self
52+ /**
53+ * @param string $name
54+ * @param string $value
55+ */
56+ public function setHeader ($ name , $ value ): self
4757 {
4858 $ this ->headers [$ name ] = $ value ;
4959
5060 return $ this ;
5161 }
5262
53- public function addHeader (string $ name , string $ value ): self
63+ /**
64+ * @param string $name
65+ * @param string $value
66+ */
67+ public function addHeader ($ name , $ value ): self
5468 {
5569 $ this ->headers [$ name ] = $ value ;
5670
5771 return $ this ;
5872 }
5973
60- public function setContentType (string $ type , ?string $ charset = null ): self
74+ /**
75+ * @param string $type
76+ * @param string $charset
77+ */
78+ public function setContentType ($ type , $ charset = null ): self
6179 {
6280 $ this ->setHeader ('Content-Type ' , $ type .($ charset ? '; charset= ' .$ charset : '' ));
6381
6482 return $ this ;
6583 }
6684
67- public function redirect (string $ url , int $ code = self ::S302_FOUND ): void
85+ /**
86+ * @param string $url
87+ * @param int $code
88+ */
89+ public function redirect ($ url , $ code = self ::S302_FOUND ): void
6890 {
6991 $ this ->setCode ($ code );
7092 $ this ->setHeader ('Location ' , $ url );
@@ -84,35 +106,65 @@ public function setExpiration($time): self
84106
85107 $ time = DateTime::from ($ time );
86108 $ this ->setHeader ('Cache-Control ' , 'max-age= ' .($ time ->format ('U ' ) - time ()));
87- $ this ->setHeader ('Expires ' , Helpers:: formatDate ($ time ));
109+ $ this ->setHeader ('Expires ' , HttpResponse:: date ($ time ));
88110
89111 return $ this ;
90112 }
91113
92- public function isSent (): bool
114+ /**
115+ * @return bool
116+ */
117+ public function isSent ()
93118 {
94119 return false ;
95120 }
96121
97- public function getHeader (string $ name ): ?string
122+ /**
123+ * @param string $name
124+ * @param mixed $default
125+ *
126+ * @return mixed
127+ */
128+ public function getHeader ($ name , $ default = null )
98129 {
99- return $ this ->headers [$ name ] ?? null ;
130+ return isset ( $ this ->headers [$ name ]) ? $ this -> headers [ $ name ] : $ default ;
100131 }
101132
102- public function getHeaders (): array
133+ /**
134+ * @return array
135+ */
136+ public function getHeaders ()
103137 {
104138 return $ this ->headers ;
105139 }
106140
107141 /**
142+ * @param string $name
143+ * @param string $value
108144 * @param string|int|DateTime $time
145+ * @param string $path
146+ * @param string $domain
147+ * @param bool $secure
148+ * @param bool $httpOnly
149+ *
150+ * @return self
109151 */
110- public function setCookie (string $ name , string $ value , $ time , ? string $ path = null , ? string $ domain = null , ? bool $ secure = null , ? bool $ httpOnly = null , ? string $ sameSite = null ): self
152+ public function setCookie ($ name , $ value , $ time , $ path = null , $ domain = null , $ secure = null , $ httpOnly = null )
111153 {
112154 return $ this ;
113155 }
114156
115- public function deleteCookie (string $ name , ?string $ path = null , ?string $ domain = null , ?bool $ secure = null ): void
157+ /**
158+ * @param string $name
159+ * @param string $path
160+ * @param string $domain
161+ * @param bool $secure
162+ */
163+ public function deleteCookie ($ name , $ path = null , $ domain = null , $ secure = null )
164+ {
165+ }
166+
167+ public function removeDuplicateCookies ()
116168 {
117169 }
118170}
0 commit comments