Cli.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Controller
  17. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. * @version $Id$
  20. */
  21. /** Zend_Controller_Response_Abstract */
  22. require_once 'Zend/Controller/Response/Abstract.php';
  23. /**
  24. * Zend_Controller_Response_Cli
  25. *
  26. * CLI response for controllers
  27. *
  28. * @uses Zend_Controller_Response_Abstract
  29. * @package Zend_Controller
  30. * @subpackage Response
  31. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  32. * @license http://framework.zend.com/license/new-bsd New BSD License
  33. */
  34. class Zend_Controller_Response_Cli extends Zend_Controller_Response_Abstract
  35. {
  36. /**
  37. * Flag; if true, when header operations are called after headers have been
  38. * sent, an exception will be raised; otherwise, processing will continue
  39. * as normal. Defaults to false.
  40. *
  41. * @see canSendHeaders()
  42. * @var boolean
  43. */
  44. public $headersSentThrowsException = false;
  45. /**
  46. * Magic __toString functionality
  47. *
  48. * @return string
  49. */
  50. public function __toString()
  51. {
  52. if ($this->isException() && $this->renderExceptions()) {
  53. $exceptions = '';
  54. foreach ($this->getException() as $e) {
  55. $exceptions .= $e->__toString() . "\n";
  56. }
  57. return $exceptions;
  58. }
  59. return $this->_body;
  60. }
  61. }