2
0

HttpException.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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_Gdata
  17. * @subpackage App
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * Zend_Gdata_App_Exception
  24. */
  25. require_once 'Zend/Gdata/App/Exception.php';
  26. /**
  27. * Zend_Http_Client_Exception
  28. */
  29. require_once 'Zend/Http/Client/Exception.php';
  30. /**
  31. * Gdata exceptions
  32. *
  33. * Class to represent exceptions that occur during Gdata operations.
  34. *
  35. * @category Zend
  36. * @package Zend_Gdata
  37. * @subpackage App
  38. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  39. * @license http://framework.zend.com/license/new-bsd New BSD License
  40. */
  41. class Zend_Gdata_App_HttpException extends Zend_Gdata_App_Exception
  42. {
  43. protected $_httpClientException = null;
  44. protected $_response = null;
  45. /**
  46. * Create a new Zend_Gdata_App_HttpException
  47. *
  48. * @param string $message Optionally set a message
  49. * @param Zend_Http_Client_Exception Optionally pass in a Zend_Http_Client_Exception
  50. * @param Zend_Http_Response Optionally pass in a Zend_Http_Response
  51. */
  52. public function __construct($message = null, $e = null, $response = null)
  53. {
  54. $this->_httpClientException = $e;
  55. $this->_response = $response;
  56. parent::__construct($message);
  57. }
  58. /**
  59. * Get the Zend_Http_Client_Exception.
  60. *
  61. * @return Zend_Http_Client_Exception
  62. */
  63. public function getHttpClientException()
  64. {
  65. return $this->_httpClientException;
  66. }
  67. /**
  68. * Set the Zend_Http_Client_Exception.
  69. *
  70. * @param Zend_Http_Client_Exception $value
  71. */
  72. public function setHttpClientException($value)
  73. {
  74. $this->_httpClientException = $value;
  75. return $this;
  76. }
  77. /**
  78. * Set the Zend_Http_Response.
  79. *
  80. * @param Zend_Http_Response $response
  81. */
  82. public function setResponse($response)
  83. {
  84. $this->_response = $response;
  85. return $this;
  86. }
  87. /**
  88. * Get the Zend_Http_Response.
  89. *
  90. * @return Zend_Http_Response
  91. */
  92. public function getResponse()
  93. {
  94. return $this->_response;
  95. }
  96. /**
  97. * Get the body of the Zend_Http_Response
  98. *
  99. * @return string
  100. */
  101. public function getRawResponseBody()
  102. {
  103. if ($this->getResponse()) {
  104. $response = $this->getResponse();
  105. return $response->getRawBody();
  106. }
  107. return null;
  108. }
  109. }