PageRenderTime 23ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/Nette/Application/Responses/RenderResponse.php

https://github.com/DocX/nette
PHP | 78 lines | 23 code | 20 blank | 35 comment | 2 complexity | cab8c0d66a7cf7b7d9d1783c5bed3623 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * Nette Framework
  4. *
  5. * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
  6. *
  7. * This source file is subject to the "Nette license" that is bundled
  8. * with this package in the file license.txt.
  9. *
  10. * For more information please see http://nettephp.com
  11. *
  12. * @copyright Copyright (c) 2004, 2009 David Grudl
  13. * @license http://nettephp.com/license Nette license
  14. * @link http://nettephp.com
  15. * @category Nette
  16. * @package Nette\Application
  17. */
  18. /*namespace Nette\Application;*/
  19. require_once dirname(__FILE__) . '/../../Object.php';
  20. require_once dirname(__FILE__) . '/../../Application/IPresenterResponse.php';
  21. /**
  22. * Rendering presenter response.
  23. *
  24. * @author David Grudl
  25. * @copyright Copyright (c) 2004, 2009 David Grudl
  26. * @package Nette\Application
  27. */
  28. class RenderResponse extends /*Nette\*/Object implements IPresenterResponse
  29. {
  30. /** @var mixed */
  31. private $source;
  32. /**
  33. * @param mixed renderable variable
  34. */
  35. public function __construct($source)
  36. {
  37. $this->source = $source;
  38. }
  39. /**
  40. * @return mixed
  41. */
  42. final public function getSource()
  43. {
  44. return $this->source;
  45. }
  46. /**
  47. * Sends response to output.
  48. * @return void
  49. */
  50. public function send()
  51. {
  52. if ($this->source instanceof /*Nette\Templates\*/ITemplate) {
  53. $this->source->render();
  54. } else {
  55. echo $this->source;
  56. }
  57. }
  58. }