OAuth2AuthenticateException.php
Current file: /home/cristiano/expresso-api/prototype/library/oauth2/lib/OAuth2AuthenticateException.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
0.00% 0 / 1
0.00% 0 / 2 CRAP
0.00% 0 / 11
OAuth2AuthenticateException
0.00% 0 / 1
0.00% 0 / 2 20
0.00% 0 / 11
 __construct($httpCode, $tokenType, $realm, $error, $error_description = NULL, $scope = NULL)
0.00% 0 / 1 12
0.00% 0 / 9
 sendHeaders()
0.00% 0 / 1 2
0.00% 0 / 2


       1                 : <?php                                                                                                             
       2                 :                                                                                                                   
       3                 : /**                                                                                                               
       4                 :  * Send an error header with the given realm and an error, if provided.                                           
       5                 :  * Suitable for the bearer token type.                                                                            
       6                 :  *                                                                                                                
       7                 :  * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-04#section-2.4                                      
       8                 :  *                                                                                                                
       9                 :  * @ingroup oauth2_error                                                                                          
      10                 :  */                                                                                                               
      11                 : class OAuth2AuthenticateException extends OAuth2ServerException {                                                 
      12                 :                                                                                                                   
      13                 :     protected $header;                                                                                            
      14                 :                                                                                                                   
      15                 :     /**                                                                                                           
      16                 :      *                                                                                                            
      17                 :      * @param $http_status_code                                                                                   
      18                 :      * HTTP status code message as predefined.                                                                    
      19                 :      * @param $error                                                                                              
      20                 :      * The "error" attribute is used to provide the client with the reason                                        
      21                 :      * why the access request was declined.                                                                       
      22                 :      * @param $error_description                                                                                  
      23                 :      * (optional) The "error_description" attribute provides a human-readable text                                
      24                 :      * containing additional information, used to assist in the understanding                                     
      25                 :      * and resolution of the error occurred.                                                                      
      26                 :      * @param $scope                                                                                              
      27                 :      * A space-delimited list of scope values indicating the required scope                                       
      28                 :      * of the access token for accessing the requested resource.                                                  
      29                 :      */                                                                                                           
      30                 :     public function __construct($httpCode, $tokenType, $realm, $error, $error_description = NULL, $scope = NULL) {
      31               0 :         parent::__construct($httpCode, $error, $error_description);                                               
      32                 :                                                                                                                   
      33               0 :         if ($scope) {                                                                                             
      34               0 :             $this->errorData['scope'] = $scope;                                                                   
      35               0 :         }                                                                                                         
      36                 :                                                                                                                   
      37                 :         // Build header                                                                                           
      38               0 :         $this->header = sprintf('WWW-Authenticate: %s realm="%s"', ucwords($tokenType), $realm);                  
      39               0 :         foreach ( $this->errorData as $key => $value ) {                                                          
      40               0 :             $this->header .= ", $key=\"$value\"";                                                                 
      41               0 :         }                                                                                                         
      42               0 :     }                                                                                                             
      43                 :                                                                                                                   
      44                 :     /**                                                                                                           
      45                 :      * Send out HTTP headers for JSON.                                                                            
      46                 :      *                                                                                                            
      47                 :      * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-5.1                                         
      48                 :      * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-5.2                                         
      49                 :      *                                                                                                            
      50                 :      * @ingroup oauth2_section_5                                                                                  
      51                 :      */                                                                                                           
      52                 :     protected function sendHeaders() {                                                                            
      53               0 :         header($this->header);                                                                                    
      54               0 :     }                                                                                                             

Generated by PHP_CodeCoverage 1.1.2 using PHP 5.3.10 and PHPUnit 3.6.10 at Thu Mar 29 11:41:57 BRT 2012.