12
12
*/
13
13
14
14
/**
15
- * Response is the base implementation of a server response.
15
+ * Response represents an HTTP response.
16
16
*
17
17
* @package Symfony
18
18
* @subpackage Components_RequestHandler
@@ -70,6 +70,13 @@ class Response
70
70
505 => 'HTTP Version Not Supported ' ,
71
71
);
72
72
73
+ /**
74
+ * Constructor.
75
+ *
76
+ * @param string $content The response content
77
+ * @param integer $status The response status code
78
+ * @param array $headers An array of response headers
79
+ */
73
80
public function __construct ($ content = '' , $ status = 200 , $ headers = array ())
74
81
{
75
82
$ this ->setContent ($ content );
@@ -83,6 +90,11 @@ public function __construct($content = '', $status = 200, $headers = array())
83
90
$ this ->cookies = array ();
84
91
}
85
92
93
+ /**
94
+ * Returns the response content after sending the headers.
95
+ *
96
+ * @return string The response content
97
+ */
86
98
public function __toString ()
87
99
{
88
100
$ this ->sendHeaders ();
@@ -98,8 +110,6 @@ public function __toString()
98
110
public function setContent ($ content )
99
111
{
100
112
$ this ->content = $ content ;
101
-
102
- return $ this ;
103
113
}
104
114
105
115
/**
@@ -120,8 +130,6 @@ public function getContent()
120
130
public function setProtocolVersion ($ version )
121
131
{
122
132
$ this ->version = $ version ;
123
-
124
- return $ this ;
125
133
}
126
134
127
135
/**
@@ -174,8 +182,6 @@ public function setCookie($name, $value, $expire = null, $path = '/', $domain =
174
182
'secure ' => (Boolean ) $ secure ,
175
183
'httpOnly ' => (Boolean ) $ httpOnly ,
176
184
);
177
-
178
- return $ this ;
179
185
}
180
186
181
187
/**
@@ -191,8 +197,8 @@ public function getCookies()
191
197
/**
192
198
* Sets response status code.
193
199
*
194
- * @param string $code HTTP status code
195
- * @param string $text HTTP status text
200
+ * @param integer $code HTTP status code
201
+ * @param string $text HTTP status text
196
202
*
197
203
* @throws \InvalidArgumentException When the HTTP status code is not valid
198
204
*/
@@ -205,8 +211,6 @@ public function setStatusCode($code, $text = null)
205
211
}
206
212
207
213
$ this ->statusText = false === $ text ? '' : (null === $ text ? self ::$ statusTexts [$ this ->statusCode ] : $ text );
208
-
209
- return $ this ;
210
214
}
211
215
212
216
/**
0 commit comments