| @@ 9-32 (lines=24) @@ | ||
| 6 | * Class TextPlainResponse |
|
| 7 | * @package Preetender\Routing\Response |
|
| 8 | */ |
|
| 9 | class TextPlainResponse extends BaseResponse |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * Inform headers for text requests |
|
| 13 | * |
|
| 14 | * @var array |
|
| 15 | */ |
|
| 16 | protected $headers = [ |
|
| 17 | // 'Content-type' => 'text/plain' |
|
| 18 | ]; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * Format and return to requester |
|
| 22 | * |
|
| 23 | * @return mixed |
|
| 24 | */ |
|
| 25 | public function render() |
|
| 26 | { |
|
| 27 | $this->response->setContent($this->wrapped->render()); |
|
| 28 | $this->response->headers->add($this->headers); |
|
| 29 | $this->response->prepare($this->request); |
|
| 30 | $this->response->send(); |
|
| 31 | } |
|
| 32 | } |
|
| @@ 9-33 (lines=25) @@ | ||
| 6 | * Class XmlResponse |
|
| 7 | * @package Preetender\Routing\Response |
|
| 8 | */ |
|
| 9 | class XmlResponse extends BaseResponse |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * Inform headers for xml requests |
|
| 13 | * |
|
| 14 | * @var array |
|
| 15 | */ |
|
| 16 | protected $headers = []; |
|
| 17 | ||
| 18 | /** |
|
| 19 | * Format and return to requester |
|
| 20 | * |
|
| 21 | * @return mixed |
|
| 22 | */ |
|
| 23 | public function render() |
|
| 24 | { |
|
| 25 | ||
| 26 | $data_format = $this->wrapped->render(); |
|
| 27 | ||
| 28 | $this->response->setContent($data_format); |
|
| 29 | $this->response->headers->add($this->headers); |
|
| 30 | $this->response->prepare($this->request); |
|
| 31 | $this->response->send(); |
|
| 32 | } |
|
| 33 | } |
|