1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: *
6: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
7: *
8: * For the full copyright and license information, please view
9: * the file license.txt that was distributed with this source code.
10: * @package Nette\Application\Responses
11: */
12:
13:
14:
15: /**
16: * String output response.
17: *
18: * @author David Grudl
19: *
20: * @property-read mixed $source
21: * @package Nette\Application\Responses
22: */
23: class NTextResponse extends NObject implements IPresenterResponse
24: {
25: /** @var mixed */
26: private $source;
27:
28:
29:
30: /**
31: * @param mixed renderable variable
32: */
33: public function __construct($source)
34: {
35: $this->source = $source;
36: }
37:
38:
39:
40: /**
41: * @return mixed
42: */
43: final public function getSource()
44: {
45: return $this->source;
46: }
47:
48:
49:
50: /**
51: * Sends response to output.
52: * @return void
53: */
54: public function send(IHttpRequest $httpRequest, IHttpResponse $httpResponse)
55: {
56: if ($this->source instanceof ITemplate) {
57: $this->source->render();
58:
59: } else {
60: echo $this->source;
61: }
62: }
63:
64: }
65: