Current file: /Users/bill/git/HTTP_OAuth/HTTP/OAuth/Consumer/Response.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% 4 / 4 CRAP
100.00%100.00%
100.00% 9 / 9
 
HTTP_OAuth_Consumer_Response
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 4 / 4
100.00%100.00%
100.00% 9 / 9
 __construct(HTTP_Request2_Response $response)
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 2 / 2
 getDataFromBody()
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 3 / 3
 getResponse()
100.00%100.00%
100.00% 1 / 1 1
100.00%100.00%
100.00% 1 / 1
 __call($method, $args)
100.00%100.00%
100.00% 1 / 1 2
100.00%100.00%
100.00% 3 / 3


       1                 : <?php                                                                               
       2                 : /**                                                                                 
       3                 :  * HTTP_OAuth                                                                       
       4                 :  *                                                                                  
       5                 :  * Implementation of the OAuth specification                                        
       6                 :  *                                                                                  
       7                 :  * PHP version 5.2.0+                                                               
       8                 :  *                                                                                  
       9                 :  * LICENSE: This source file is subject to the New BSD license that is              
      10                 :  * available through the world-wide-web at the following URI:                       
      11                 :  * http://www.opensource.org/licenses/bsd-license.php. If you did not receive       
      12                 :  * a copy of the New BSD License and are unable to obtain it through the web,       
      13                 :  * please send a note to license@php.net so we can mail you a copy immediately.     
      14                 :  *                                                                                  
      15                 :  * @category  HTTP                                                                  
      16                 :  * @package   HTTP_OAuth                                                            
      17                 :  * @author    Jeff Hodsdon <jeffhodsdon@gmail.com>                                  
      18                 :  * @copyright 2009 Jeff Hodsdon <jeffhodsdon@gmail.com>                             
      19                 :  * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License    
      20                 :  * @link      http://pear.php.net/package/HTTP_OAuth                                
      21                 :  * @link      http://github.com/jeffhodsdon/HTTP_OAuth                              
      22                 :  */                                                                                 
      23                 :                                                                                     
      24                 : require_once 'HTTP/OAuth/Message.php';                                              
      25                 : require_once 'HTTP/OAuth/Exception.php';                                            
      26                 : require_once 'HTTP/Request2/Response.php';                                          
      27                 :                                                                                     
      28                 : /**                                                                                 
      29                 :  * HTTP_OAuth_Consumer_Response                                                     
      30                 :  *                                                                                  
      31                 :  * Class to handle OAuth responses from a provider.  Accepts and decorates a        
      32                 :  * HTTP_Request2_Response instance                                                  
      33                 :  *                                                                                  
      34                 :  * @category  HTTP                                                                  
      35                 :  * @package   HTTP_OAuth                                                            
      36                 :  * @author    Jeff Hodsdon <jeffhodsdon@gmail.com>                                  
      37                 :  * @copyright 2009 Jeff Hodsdon <jeffhodsdon@gmail.com>                             
      38                 :  * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License    
      39                 :  * @link      http://pear.php.net/package/HTTP_OAuth                                
      40                 :  * @link      http://github.com/jeffhodsdon/HTTP_OAuth                              
      41                 :  */                                                                                 
      42                 : class HTTP_OAuth_Consumer_Response extends HTTP_OAuth_Message                       
      43                 : {                                                                                   
      44                 :                                                                                     
      45                 :     /**                                                                             
      46                 :      * Instance of HTTP_Request2_Response                                           
      47                 :      *                                                                              
      48                 :      * @var HTTP_Request2_Response $response Response from the HTTP_Request2        
      49                 :      */                                                                             
      50                 :     protected $response = null;                                                     
      51                 :                                                                                     
      52                 :     /**                                                                             
      53                 :      * Construct                                                                    
      54                 :      *                                                                              
      55                 :      * @param HTTP_Request2_Response $response Response from HTTP_Request2          
      56                 :      *                                                                              
      57                 :      * @return void                                                                 
      58                 :      */                                                                             
      59                 :     public function __construct(HTTP_Request2_Response $response)                   
      60                 :     {                                                                               
      61              11 :         $this->response = $response;                                                
      62              11 :     }                                                                               
      63                 :                                                                                     
      64                 :     /**                                                                             
      65                 :      * Gets data from body                                                          
      66                 :      *                                                                              
      67                 :      * If body is and OAuth specific query string, parse and return                 
      68                 :      *                                                                              
      69                 :      * @return array Query string data                                              
      70                 :      */                                                                             
      71                 :     public function getDataFromBody()                                               
      72                 :     {                                                                               
      73               1 :         $result = array();                                                          
      74               1 :         parse_str($this->getBody(), $result);                                       
      75               1 :         return $result;                                                             
      76                 :     }                                                                               
      77                 :                                                                                     
      78                 :     /**                                                                             
      79                 :      * Gets HTTP_Request2_Response                                                  
      80                 :      *                                                                              
      81                 :      * @return HTTP_Request2_Response Instance of the current HTTP_Request2_Response
      82                 :      */                                                                             
      83                 :     public function getResponse()                                                   
      84                 :     {                                                                               
      85               2 :         return $this->response;                                                     
      86                 :     }                                                                               
      87                 :                                                                                     
      88                 :     /**                                                                             
      89                 :      * Call                                                                         
      90                 :      *                                                                              
      91                 :      * If method exists on HTTP_Request2_Response pass to that, otherwise           
      92                 :      * throw BadMethodCallException                                                 
      93                 :      *                                                                              
      94                 :      * @param string $method Name of the method                                     
      95                 :      * @param array  $args   Arguments for the method                               
      96                 :      *                                                                              
      97                 :      * @return mixed Result from method                                             
      98                 :      * @throws BadMethodCallException When method does not exist on                 
      99                 :                                       HTTP_Request2_Response                        
     100                 :      */                                                                             
     101                 :     public function __call($method, $args)                                          
     102                 :     {                                                                               
     103               4 :         if (method_exists($this->response, $method)) {                              
     104               3 :             return call_user_func_array(array($this->response, $method), $args);    
     105                 :         }                                                                           
     106                 :                                                                                     
     107               1 :         throw new BadMethodCallException($method);                                  
     108                 :     }                                                                               
     109                 :                                                                                     
     110                 : }                                                                                   
     111                 :                                                                                     
     112                 : ?>                                                                                  

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.