1 | <?php |
||
48 | class Response |
||
49 | { |
||
50 | /** |
||
51 | * @access protected |
||
52 | * @var RequestAbstract |
||
53 | */ |
||
54 | protected $request; |
||
55 | |||
56 | /** |
||
57 | * @access protected |
||
58 | * @var array |
||
59 | */ |
||
60 | protected $data = array(); |
||
61 | |||
62 | /** |
||
63 | * @access protected |
||
64 | * @var array |
||
65 | */ |
||
66 | protected $outputParts = array(); |
||
67 | |||
68 | /** |
||
69 | * @access protected |
||
70 | * @var string |
||
71 | */ |
||
72 | protected $output; |
||
73 | |||
74 | /** |
||
75 | * Constructs the object |
||
76 | * |
||
77 | * @access public |
||
78 | * @param \Zepi\Turbo\Request\RequestAbstract $request |
||
79 | 25 | */ |
|
80 | public function __construct(RequestAbstract $request) |
||
84 | |||
85 | /** |
||
86 | * Return the data for the given key. If the key does |
||
87 | * not exists the function will return false. |
||
88 | * |
||
89 | * @access public |
||
90 | * @param string $key |
||
91 | * @return mixed |
||
92 | 4 | */ |
|
93 | public function getData($key) |
||
101 | |||
102 | /** |
||
103 | * Returns true if the given key is set. |
||
104 | * |
||
105 | * @access public |
||
106 | * @param string $key |
||
107 | * @return boolean |
||
108 | 4 | */ |
|
109 | public function hasData($key) |
||
113 | |||
114 | /** |
||
115 | * Saves the value for the given key in the response object. |
||
116 | * |
||
117 | * @access public |
||
118 | * @param string $key |
||
119 | * @param mixed $value |
||
120 | 3 | */ |
|
121 | public function setData($key, $value) |
||
125 | |||
126 | /** |
||
127 | * Returns the output for the given key. If the key does |
||
128 | * not exists the function will return false. |
||
129 | * |
||
130 | * @access public |
||
131 | * @param string $key |
||
132 | * @return false|string |
||
133 | 2 | */ |
|
134 | public function getOutputPart($key) |
||
142 | |||
143 | /** |
||
144 | * Returns true if the given key exists as output key. |
||
145 | * |
||
146 | * @access public |
||
147 | * @param string $key |
||
148 | * @return boolean |
||
149 | 2 | */ |
|
150 | public function hasOutputPart($key) |
||
154 | |||
155 | /** |
||
156 | * Saves the output for the given key in the Response object. |
||
157 | * |
||
158 | * @access public |
||
159 | * @param string $key |
||
160 | * @param string $output |
||
161 | 2 | */ |
|
162 | public function setOutputPart($key, $output) |
||
166 | |||
167 | /** |
||
168 | * Returns all output parts of the Response object. |
||
169 | * |
||
170 | * @access public |
||
171 | * @return array |
||
172 | 1 | */ |
|
173 | public function getOutputParts() |
||
177 | |||
178 | /** |
||
179 | * Returns the output of the response. |
||
180 | * |
||
181 | * @access public |
||
182 | * @return string |
||
183 | 3 | */ |
|
184 | public function getOutput() |
||
188 | |||
189 | /** |
||
190 | * Returns true if the response has an output. |
||
191 | * |
||
192 | * @access public |
||
193 | * @return boolean |
||
194 | 1 | */ |
|
195 | public function hasOutput() |
||
199 | |||
200 | /** |
||
201 | * Sets the output of the response. |
||
202 | * |
||
203 | * @access public |
||
204 | * @param string $output |
||
205 | 1 | */ |
|
206 | public function setOutput($output) |
||
210 | |||
211 | /** |
||
212 | * Set the Location header to redirect a request |
||
213 | * |
||
214 | * @access public |
||
215 | * @param string $target |
||
216 | * @param integer $headerCode |
||
217 | * @param boolean $withOrigin |
||
218 | 2 | */ |
|
219 | public function redirectTo($target, $headerCode = 301, $withOrigin = false) |
||
251 | |||
252 | /** |
||
253 | * Sends a header |
||
254 | * |
||
255 | * @access public |
||
256 | * @param string $message |
||
257 | * @param integer $code |
||
258 | */ |
||
259 | public function sendHeader($message, $code = null) |
||
271 | |||
272 | /** |
||
273 | * Sends the status code for the give code |
||
274 | * |
||
275 | * @access public |
||
276 | * @param integer $code |
||
277 | * @param boolean $resetOutput |
||
278 | */ |
||
279 | public function sendHttpStatus($code, $resetOutput = false) |
||
354 | |||
355 | /** |
||
356 | * Returns a full url for the given url parts array |
||
357 | * from the function `parse_url()`. |
||
358 | * |
||
359 | * @access public |
||
360 | * @param array $urlParts |
||
361 | * @return string |
||
362 | */ |
||
363 | public function buildUrl($urlParts) |
||
408 | } |
||
409 |