| 1 | <?php |
||
| 7 | class Response |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Application Object |
||
| 11 | * |
||
| 12 | * @var \System\Application |
||
| 13 | */ |
||
| 14 | private $app; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Headers container will be sent to the browser |
||
| 18 | * |
||
| 19 | * @var array |
||
| 20 | */ |
||
| 21 | private $headers = []; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The content will be sent to the browser |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | private $content = ''; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Constructor |
||
| 32 | * |
||
| 33 | * @param \System\Application $app |
||
| 34 | */ |
||
| 35 | public function __construct(Application $app) |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Set the response output content |
||
| 42 | * |
||
| 43 | * @param string $content |
||
| 44 | * @return void |
||
| 45 | */ |
||
| 46 | public function setOutput(string $content) |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Set the response Headers |
||
| 53 | * |
||
| 54 | * @param string $header |
||
| 55 | * @param mixed $value |
||
| 56 | * @return void |
||
| 57 | */ |
||
| 58 | public function setHeader(string $header, $value = '') |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Send the response headers and content |
||
| 65 | * |
||
| 66 | * @return void |
||
| 67 | */ |
||
| 68 | public function send() |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Send the response headers |
||
| 77 | * |
||
| 78 | * @return void |
||
| 79 | */ |
||
| 80 | private function sendHeaders() |
||
| 88 | |||
| 89 | /** |
||
| 90 | * Send the response output |
||
| 91 | * |
||
| 92 | * @return void |
||
| 93 | */ |
||
| 94 | private function sendOutput() |
||
| 99 | } |
||
| 100 |