@@ -31,69 +31,39 @@ public function reset(): void
31
31
$ this ->headers = [];
32
32
}
33
33
34
- /**
35
- * @param int $code
36
- *
37
- * @return static
38
- */
39
- public function setCode (int $ code )
34
+ public function setCode (int $ code ): Response
40
35
{
41
36
$ this ->code = $ code ;
42
37
43
38
return $ this ;
44
39
}
45
40
46
- /**
47
- * @return int
48
- */
49
41
public function getCode (): int
50
42
{
51
43
return $ this ->code ;
52
44
}
53
45
54
- /**
55
- * @param string $name
56
- * @param string $value
57
- *
58
- * @return static
59
- */
60
- public function setHeader (string $ name , string $ value )
46
+ public function setHeader (string $ name , string $ value ): Response
61
47
{
62
48
$ this ->headers [$ name ] = $ value ;
63
49
64
50
return $ this ;
65
51
}
66
52
67
- /**
68
- * @param string $name
69
- * @param string $value
70
- *
71
- * @return static
72
- */
73
- public function addHeader (string $ name , string $ value )
53
+ public function addHeader (string $ name , string $ value ): Response
74
54
{
75
55
$ this ->headers [$ name ] = $ value ;
76
56
77
57
return $ this ;
78
58
}
79
59
80
- /**
81
- * @param string $type
82
- * @param string $charset
83
- *
84
- * @return static
85
- */
86
- public function setContentType (string $ type , string $ charset = null )
60
+ public function setContentType (string $ type , ?string $ charset = null ): Response
87
61
{
88
62
$ this ->setHeader ('Content-Type ' , $ type .($ charset ? '; charset= ' .$ charset : '' ));
89
63
90
64
return $ this ;
91
65
}
92
66
93
- /**
94
- * @param string $url
95
- * @param int $code
96
- */
97
67
public function redirect (string $ url , int $ code = self ::S302_FOUND ): void
98
68
{
99
69
$ this ->setCode ($ code );
@@ -102,10 +72,8 @@ public function redirect(string $url, int $code = self::S302_FOUND): void
102
72
103
73
/**
104
74
* @param string|int|DateTime $time
105
- *
106
- * @return static
107
75
*/
108
- public function setExpiration ($ time )
76
+ public function setExpiration ($ time ): Response
109
77
{
110
78
if (!$ time ) {
111
79
$ this ->setHeader ('Cache-Control ' , 's-maxage=0, max-age=0, must-revalidate ' );
@@ -121,55 +89,30 @@ public function setExpiration($time)
121
89
return $ this ;
122
90
}
123
91
124
- /**
125
- * @return bool
126
- */
127
92
public function isSent (): bool
128
93
{
129
94
return false ;
130
95
}
131
96
132
- /**
133
- * @param string $name
134
- *
135
- * @return mixed
136
- */
137
97
public function getHeader (string $ name ): ?string
138
98
{
139
99
return $ this ->headers [$ name ] ?? null ;
140
100
}
141
101
142
- /**
143
- * @return array
144
- */
145
102
public function getHeaders (): array
146
103
{
147
104
return $ this ->headers ;
148
105
}
149
106
150
107
/**
151
- * @param string $name
152
- * @param string $value
153
108
* @param string|int|DateTime $time
154
- * @param string $path
155
- * @param string $domain
156
- * @param bool $secure
157
- * @param bool $httpOnly
158
- *
159
- * @return self
160
109
*/
161
- public function setCookie (string $ name , string $ value , $ time , string $ path = null , string $ domain = null , bool $ secure = null , bool $ httpOnly = null , string $ sameSite = null )
110
+ public function setCookie (string $ name , string $ value , $ time , ? string $ path = null , ? string $ domain = null , ? bool $ secure = null , ? bool $ httpOnly = null , ? string $ sameSite = null ): Response
162
111
{
163
112
return $ this ;
164
113
}
165
114
166
- /**
167
- * @param string $name
168
- * @param string $path
169
- * @param string $domain
170
- * @param bool $secure
171
- */
172
- public function deleteCookie (string $ name , string $ path = null , string $ domain = null , bool $ secure = null ): void
115
+ public function deleteCookie (string $ name , ?string $ path = null , ?string $ domain = null , ?bool $ secure = null ): void
173
116
{
174
117
}
175
118
}
0 commit comments