Current file: /Users/bill/git/HTTP_OAuth/HTTP/OAuth/Signature.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% 1 / 1 CRAP
100.00%100.00%
100.00% 11 / 11
 
HTTP_OAuth_Signature
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 11 / 11
 factory($method)
100.00%100.00%
100.00% 1 / 1 3
100.00%100.00%
100.00% 11 / 11


       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.php';                                                  
      25                 :                                                                                 
      26                 : /**                                                                             
      27                 :  * HTTP_OAuth_Signature                                                         
      28                 :  *                                                                              
      29                 :  * Base util class for signatures, e.g. factory.                                
      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                 : abstract class HTTP_OAuth_Signature                                             
      40                 : {                                                                               
      41                 :                                                                                 
      42                 :     /**                                                                         
      43                 :      * Factory                                                                  
      44                 :      *                                                                          
      45                 :      * @param string $method Signature method                                   
      46                 :      *                                                                          
      47                 :      * @return HTTP_OAuth_Signature_Common Signature instance                   
      48                 :      */                                                                         
      49                 :     static public function factory($method)                                     
      50                 :     {                                                                           
      51               7 :         $method = str_replace('-', '_', $method);                               
      52               7 :         $class  = 'HTTP_OAuth_Signature_' . $method;                            
      53               7 :         $file   = str_replace('_', '/', $class) . '.php';                       
      54                 :                                                                                 
      55               7 :         include_once $file;                                                     
      56                 :                                                                                 
      57               7 :         if (class_exists($class) === false) {                                   
      58               1 :             throw new InvalidArgumentException('No such signature class');      
      59                 :         }                                                                       
      60                 :                                                                                 
      61               6 :         $instance = new $class;                                                 
      62               6 :         if (!$instance instanceof HTTP_OAuth_Signature_Common) {                
      63               1 :             throw new InvalidArgumentException(                                 
      64                 :                 'Signature class does not extend HTTP_OAuth_Signature_Common'   
      65               1 :             );                                                                  
      66                 :         }                                                                       
      67                 :                                                                                 
      68               5 :         return $instance;                                                       
      69                 :     }                                                                           
      70                 : }                                                                               
      71                 :                                                                                 
      72                 : ?>                                                                              

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.