1 | <?php |
||
21 | abstract class View { |
||
22 | |||
23 | use Di\ContainerAware; |
||
24 | use \Aviat\Ion\StringWrapper; |
||
25 | |||
26 | /** |
||
27 | * HTTP response Object |
||
28 | * |
||
29 | * @var Aura\Web\Response |
||
30 | */ |
||
31 | protected $response; |
||
32 | |||
33 | /** |
||
34 | * Response mime type |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $contentType = ''; |
||
39 | |||
40 | /** |
||
41 | * String of response to be output |
||
42 | * |
||
43 | * @var StringType |
||
44 | */ |
||
45 | protected $output; |
||
46 | |||
47 | /** |
||
48 | * If the view has sent output via |
||
49 | * __toString or send method |
||
50 | * |
||
51 | * @var boolean |
||
52 | */ |
||
53 | protected $hasRendered = false; |
||
54 | |||
55 | /** |
||
56 | * Constructor |
||
57 | * |
||
58 | * @param ContainerInterface $container |
||
59 | */ |
||
60 | public function __construct(ContainerInterface $container) |
||
65 | |||
66 | /** |
||
67 | * Send output to client |
||
68 | */ |
||
69 | public function __destruct() |
||
76 | |||
77 | /** |
||
78 | * Return rendered output |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function __toString() |
||
87 | |||
88 | /** |
||
89 | * Set the output string |
||
90 | * |
||
91 | * @param string $string |
||
92 | * @return View |
||
93 | */ |
||
94 | public function setOutput($string) |
||
100 | |||
101 | /** |
||
102 | * Append additional output |
||
103 | * |
||
104 | * @param string $string |
||
105 | * @return View |
||
106 | */ |
||
107 | public function appendOutput($string) |
||
113 | |||
114 | /** |
||
115 | * Get the current output string |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | public function getOutput() |
||
123 | |||
124 | /** |
||
125 | * Send output to client |
||
126 | */ |
||
127 | public function send() |
||
132 | |||
133 | /** |
||
134 | * Send the appropriate response |
||
135 | * |
||
136 | * @return void |
||
137 | */ |
||
138 | protected function output() |
||
145 | } |
||
146 | // End of View.php |