BaseException.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * BaseException class
  4. *
  5. * PHP 5
  6. *
  7. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  8. * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  9. *
  10. * Licensed under The MIT License
  11. * Redistributions of files must retain the above copyright notice.
  12. *
  13. * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  14. * @link http://book.cakephp.org/2.0/en/development/testing.html
  15. * @since CakePHP(tm) v 3.0
  16. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  17. */
  18. namespace Cake\Error;
  19. /**
  20. * Base class that all Exceptions extend.
  21. *
  22. */
  23. class BaseException extends \RuntimeException {
  24. /**
  25. * Array of headers to be passed to Cake\Network\Response::header()
  26. *
  27. * @var array
  28. */
  29. protected $_responseHeaders = null;
  30. /**
  31. * Get/set the response header to be used
  32. *
  33. * See also Cake\Network\Response::header()
  34. *
  35. * @param string|array $header. An array of header strings or a single header string
  36. * - an associative array of "header name" => "header value"
  37. * - an array of string headers is also accepted
  38. * @param string $value The header value.
  39. * @return array
  40. */
  41. public function responseHeader($header = null, $value = null) {
  42. if ($header) {
  43. if (is_array($header)) {
  44. return $this->_responseHeaders = $header;
  45. }
  46. $this->_responseHeaders = array($header => $value);
  47. }
  48. return $this->_responseHeaders;
  49. }
  50. }