File indexing completed on 2025-03-02 05:29:26

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage App
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * Zend_Gdata_App_Exception
0026  */
0027 // require_once 'Zend/Gdata/App/Exception.php';
0028 
0029 /**
0030  * Zend_Http_Client_Exception
0031  */
0032 // require_once 'Zend/Http/Client/Exception.php';
0033 
0034 /**
0035  * Gdata exceptions
0036  *
0037  * Class to represent exceptions that occur during Gdata operations.
0038  *
0039  * @category   Zend
0040  * @package    Zend_Gdata
0041  * @subpackage App
0042  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0043  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0044  */
0045 class Zend_Gdata_App_HttpException extends Zend_Gdata_App_Exception
0046 {
0047 
0048     protected $_httpClientException = null;
0049     protected $_response = null;
0050 
0051     /**
0052      * Create a new Zend_Gdata_App_HttpException
0053      *
0054      * @param  string $message Optionally set a message
0055      * @param Zend_Http_Client_Exception Optionally pass in a Zend_Http_Client_Exception
0056      * @param Zend_Http_Response Optionally pass in a Zend_Http_Response
0057      */
0058     public function __construct($message = null, $e = null, $response = null)
0059     {
0060         $this->_httpClientException = $e;
0061         $this->_response = $response;
0062         parent::__construct($message);
0063     }
0064 
0065     /**
0066      * Get the Zend_Http_Client_Exception.
0067      *
0068      * @return Zend_Http_Client_Exception
0069      */
0070     public function getHttpClientException()
0071     {
0072         return $this->_httpClientException;
0073     }
0074 
0075     /**
0076      * Set the Zend_Http_Client_Exception.
0077      *
0078      * @param Zend_Http_Client_Exception $value
0079      */
0080     public function setHttpClientException($value)
0081     {
0082         $this->_httpClientException = $value;
0083         return $this;
0084     }
0085 
0086     /**
0087      * Set the Zend_Http_Response.
0088      *
0089      * @param Zend_Http_Response $response
0090      */
0091     public function setResponse($response)
0092     {
0093         $this->_response = $response;
0094         return $this;
0095     }
0096 
0097     /**
0098      * Get the Zend_Http_Response.
0099      *
0100      * @return Zend_Http_Response
0101      */
0102     public function getResponse()
0103     {
0104         return $this->_response;
0105     }
0106 
0107     /**
0108      * Get the body of the Zend_Http_Response
0109      *
0110      * @return string
0111      */
0112     public function getRawResponseBody()
0113     {
0114         if ($this->getResponse()) {
0115             $response = $this->getResponse();
0116             return $response->getRawBody();
0117         }
0118         return null;
0119     }
0120 
0121 }