Services_Digg
[ class tree: Services_Digg ] [ index: Services_Digg ] [ all elements ]

Source for file Exception.php

Documentation is available at Exception.php

  1. <?php
  2.  
  3. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  4.  
  5. /**
  6.  * The Services_Digg Exception
  7.  *
  8.  * PHP version 5.1.0+
  9.  *
  10.  * LICENSE: This source file is subject to version 3.0 of the PHP license
  11.  * that is available through the world-wide-web at the following URI:
  12.  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  13.  * the PHP License and are unable to obtain it through the web, please
  14.  * send a note to license@php.net so we can mail you a copy immediately.
  15.  *
  16.  * @category    Services
  17.  * @package     Services_Digg
  18.  * @author      Joe Stump <joe@joestump.net>
  19.  * @copyright   1997-2007 The PHP Group
  20.  * @license     http://www.php.net/license/3_0.txt  PHP License 3.0
  21.  * @version     CVS: $Id:$
  22.  * @link        http://pear.php.net/package/Services_Digg
  23.  */ 
  24.  
  25. require_once 'PEAR/Exception.php';
  26.  
  27. /**
  28.  * Services_Digg_Exception
  29.  *
  30.  * @category    Services
  31.  * @package     Services_Digg
  32.  * @author      Joe Stump <joe@joestump.net>
  33.  */
  34. class Services_Digg_Exception extends PEAR_Exception 
  35. {
  36.     /**
  37.      * The the call that likely caused the exception
  38.      *
  39.      * @access      private
  40.      * @var         string      $call 
  41.      */
  42.     private $call '';
  43.  
  44.     /**
  45.      * The raw response from the API when the exception was called
  46.      *
  47.      * @access      private
  48.      * @var         string      $response 
  49.      */
  50.     private $response '';
  51.  
  52.     /**
  53.      * Constructor
  54.      *
  55.      * @access      public
  56.      * @param       string      $message 
  57.      * @param       int         $code 
  58.      * @param       string      $call 
  59.      * @param       string      $response 
  60.      * @return      void 
  61.      */
  62.     public function __construct($message = null
  63.                                 $code = 0
  64.                                 $call '',
  65.                                 $response ''
  66.     {
  67.         parent::__construct($message$code);
  68.         $this->call $call;
  69.         $this->response $response;
  70.     }
  71.  
  72.     /**
  73.      * Get the last call that probably caused this exception
  74.      *
  75.      * @access      public
  76.      * @return      string 
  77.      */
  78.     public function getCall()
  79.     {
  80.         return $this->call;
  81.     }
  82.  
  83.     /**
  84.      * Get the raw API response from the last call
  85.      *
  86.      * @access      public
  87.      * @return      string 
  88.      */
  89.     public function getResponse()
  90.     {
  91.         return $this->response;
  92.     }
  93.  
  94.     /**
  95.      * __toString
  96.      *
  97.      * Override the PEAR_Exception::__toString() method with a text-only pretty
  98.      * formatted string with the message, code and API call that generated the
  99.      * exception.
  100.      *
  101.      * @access      public
  102.      * @return      string 
  103.      */
  104.     public function __toString()
  105.     {
  106.         return $this->getMessage(' (Code: ' $this->getCode(', Call: ' $this->getCall(')'
  107.     }
  108. }
  109.  
  110. ?>

Documentation generated on Fri, 10 Jul 2009 01:30:03 +0000 by phpDocumentor 1.4.2. PEAR Logo Copyright © PHP Group 2004.