Source for file RenderResponse.php

Documentation is available at RenderResponse.php

  1. 1: <?php
  2. 2:  
  3. 3: /**
  4. 4:  * Nette Framework
  5. 5:  *
  6. 6:  * @copyright  Copyright (c) 2004, 2010 David Grudl
  7. 7:  * @license    http://nettephp.com/license  Nette license
  8. 8:  * @link       http://nettephp.com
  9. 9:  * @category   Nette
  10. 10:  * @package    Nette\Application
  11. 11:  */
  12. 12:  
  13. 13:  
  14. 14:  
  15. 15: /**
  16. 16:  * Rendering presenter response.
  17. 17:  *
  18. 18:  * @copyright  Copyright (c) 2004, 2010 David Grudl
  19. 19:  * @package    Nette\Application
  20. 20:  */
  21. 21: class RenderResponse extends Object implements IPresenterResponse
  22. 22: {
  23. 23:     /** @var mixed */
  24. 24:     private $source;
  25. 25:  
  26. 26:  
  27. 27:  
  28. 28:     /**
  29. 29:      * @param  mixed  renderable variable
  30. 30:      */
  31. 31:     public function __construct($source)
  32. 32:     {
  33. 33:         $this->source $source;
  34. 34:     }
  35. 35:  
  36. 36:  
  37. 37:  
  38. 38:     /**
  39. 39:      * @return mixed 
  40. 40:      */
  41. 41:     final public function getSource()
  42. 42:     {
  43. 43:         return $this->source;
  44. 44:     }
  45. 45:  
  46. 46:  
  47. 47:  
  48. 48:     /**
  49. 49:      * Sends response to output.
  50. 50:      * @return void 
  51. 51:      */
  52. 52:     public function send()
  53. 53:     {
  54. 54:         if ($this->source instanceof ITemplate{
  55. 55:             $this->source->render();
  56. 56:  
  57. 57:         else {
  58. 58:             echo $this->source;
  59. 59:         }
  60. 60:     }
  61. 61:  
  62. 62: }