Current file: /Users/bill/git/HTTP_OAuth/HTTP/OAuth/Consumer/Exception/InvalidResponse.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 2 / 2 CRAP
100.00%100.00%
100.00% 8 / 8
 
HTTP_OAuth_Consumer_Exception_InvalidResponse
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 2 / 2
100.00%100.00%
100.00% 8 / 8
 __construct($message, HTTP_OAuth_Consumer_Response $response)
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 3 / 3
 __call($method, $args)
100.00%100.00%
100.00% 1 / 1 3
100.00%100.00%
100.00% 5 / 5


       1                 : <?php                                                                            
       2                 : /**                                                                              
       3                 :  * HTTP_OAuth                                                                    
       4                 :  *                                                                               
       5                 :  * PHP version 5.2.0+                                                            
       6                 :  *                                                                               
       7                 :  * LICENSE: This source file is subject to the New BSD license that is           
       8                 :  * available through the world-wide-web at the following URI:                    
       9                 :  * http://www.opensource.org/licenses/bsd-license.php. If you did not receive    
      10                 :  * a copy of the New BSD License and are unable to obtain it through the web,    
      11                 :  * please send a note to license@php.net so we can mail you a copy immediately.  
      12                 :  *                                                                               
      13                 :  * @category  HTTP                                                               
      14                 :  * @package   HTTP_OAuth                                                         
      15                 :  * @author    Jeff Hodsdon <jeffhodsdon@gmail.com>                               
      16                 :  * @copyright 2009 Jeff Hodsdon <jeffhodsdon@gmail.com>                          
      17                 :  * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License 
      18                 :  * @link      http://pear.php.net/package/HTTP_OAuth                             
      19                 :  * @link      http://github.com/jeffhodsdon/HTTP_OAuth                           
      20                 :  */                                                                              
      21                 :                                                                                  
      22                 : require_once 'HTTP/OAuth/Exception.php';                                         
      23                 : require_once 'HTTP/OAuth/Consumer/Response.php';                                 
      24                 :                                                                                  
      25                 : /**                                                                              
      26                 :  * HTTP_OAuth_Consumer_Exception_InvalidResponse                                 
      27                 :  *                                                                               
      28                 :  * Exception for invalid responses from OAuth providers. Supplies methods        
      29                 :  * to get information about the request                                          
      30                 :  *                                                                               
      31                 :  * @category  HTTP                                                               
      32                 :  * @package   HTTP_OAuth                                                         
      33                 :  * @author    Jeff Hodsdon <jeffhodsdon@gmail.com>                               
      34                 :  * @copyright 2009 Jeff Hodsdon <jeffhodsdon@gmail.com>                          
      35                 :  * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License 
      36                 :  * @link      http://pear.php.net/package/HTTP_OAuth                             
      37                 :  * @link      http://github.com/jeffhodsdon/HTTP_OAuth                           
      38                 :  */                                                                              
      39                 : class HTTP_OAuth_Consumer_Exception_InvalidResponse extends HTTP_OAuth_Exception 
      40                 : {                                                                                
      41                 :                                                                                  
      42                 :     /**                                                                          
      43                 :      * HTTP_OAuth_Consumer_Response instance                                     
      44                 :      *                                                                           
      45                 :      * @var HTTP_OAuth_Consumer_Response $resonse Invalid response               
      46                 :      */                                                                          
      47                 :     public $response = null;                                                     
      48                 :                                                                                  
      49                 :     /**                                                                          
      50                 :      * Construct                                                                 
      51                 :      *                                                                           
      52                 :      * @param string                       $message  Exception message           
      53                 :      * @param HTTP_OAuth_Consumer_Response $response Invalid response            
      54                 :      *                                                                           
      55                 :      * @return void                                                              
      56                 :      */                                                                          
      57                 :     public function __construct($message, HTTP_OAuth_Consumer_Response $response)
      58                 :     {                                                                            
      59               4 :         parent::__construct($message);                                           
      60                 :                                                                                  
      61               4 :         $this->response = $response;                                             
      62               4 :     }                                                                            
      63                 :                                                                                  
      64                 :     /**                                                                          
      65                 :      * Call                                                                      
      66                 :      *                                                                           
      67                 :      * If method exists on self::$response pass to that, otherwise               
      68                 :      * throw BadMethodCallException                                              
      69                 :      *                                                                           
      70                 :      * @param string $method Name of the method                                  
      71                 :      * @param array  $args   Arguments for the method                            
      72                 :      *                                                                           
      73                 :      * @return mixed Result from method                                          
      74                 :      * @throws BadMethodCallException When method does not exist on              
      75                 :      *                                self::$response                            
      76                 :      */                                                                          
      77                 :     public function __call($method, $args)                                       
      78                 :     {                                                                            
      79               2 :         if (method_exists($this->response->getResponse(), $method)               
      80               1 :             || method_exists($this->response, $method)                           
      81               2 :         ) {                                                                      
      82               1 :             return call_user_func_array(array($this->response, $method), $args); 
      83                 :         }                                                                        
      84                 :                                                                                  
      85               1 :         throw new BadMethodCallException($method);                               
      86                 :     }                                                                            
      87                 :                                                                                  
      88                 :                                                                                  
      89                 : }                                                                                
      90                 :                                                                                  
      91                 : ?>                                                                               

Generated by PHP_CodeCoverage 1.0.2 using PHP 5.3.3 and PHPUnit 3.5.6 at Tue Dec 28 21:42:13 PST 2010.