PEAR_PackageUpdate Test Suite
Current file: PEAR\PackageUpdate\Adapter\XmlRPC.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
100.00%100.00%
100.00% 1 / 1
66.67%66.67%
66.67% 2 / 3
54.17%54.17%
54.17% 13 / 24
 
PEAR_PackageUpdate_Adapter_XmlRPC
100.00%100.00%
100.00% 1 / 1
66.67%66.67%
66.67% 2 / 3
52.17%52.17%
52.17% 12 / 23
 public function PEAR_PackageUpdate_Adapter_XmlRPC(&$config, &$ppu)
100.00%100.00%
100.00% 1 / 1
100.00%100.00%
100.00% 4 / 4
 public function supports()
100.00%100.00%
100.00% 1 / 1
77.78%77.78%
77.78% 7 / 9
 public function sendRequest($request)
0.00%0.00%
0.00% 0 / 1
0.00%0.00%
0.00% 0 / 9


       1                 : <?php
       2                 : /**
       3                 :  * XMLRPC-based adapter for PEAR_PackageUpdate
       4                 :  *
       5                 :  * PHP versions 4 and 5
       6                 :  *
       7                 :  * LICENSE: This source file is subject to version 3.01 of the PHP license
       8                 :  * that is available through the world-wide-web at the following URI:
       9                 :  * http://www.php.net/license/3_01.txt.  If you did not receive a copy of
      10                 :  * the PHP License and are unable to obtain it through the web, please
      11                 :  * send a note to license@php.net so we can mail you a copy immediately.
      12                 :  *
      13                 :  * @category PEAR
      14                 :  * @package  PEAR_PackageUpdate
      15                 :  * @author   Laurent Laville <pear@laurent-laville.org>
      16                 :  * @license  http://www.php.net/license/3_01.txt  PHP License 3.01
      17                 :  * @version  CVS: $Id: XmlRPC.php,v 1.1 2009/02/28 11:29:17 farell Exp $
      18                 :  * @link     http://pear.php.net/package/PEAR_PackageUpdate
      19                 :  * @since    File available since Release 1.1.0a1
      20                 :  */
      21                 :
      22               1 : require_once 'PEAR/PackageUpdate/Adapter.php';                               
      23                 :
      24                 : /**
      25                 :  * XMLRPC-based adapter for PEAR_PackageUpdate
      26                 :  *
      27                 :  * @category PEAR
      28                 :  * @package  PEAR_PackageUpdate
      29                 :  * @author   Laurent Laville <pear@laurent-laville.org>
      30                 :  * @license  http://www.php.net/license/3_01.txt  PHP License 3.01
      31                 :  * @version  Release: 1.1.0a1
      32                 :  * @link     http://pear.php.net/package/PEAR_PackageUpdate
      33                 :  * @since    Class available since Release 1.1.0a1
      34                 :  */
      35                 :
      36               1 : class PEAR_PackageUpdate_Adapter_XmlRPC extends PEAR_PackageUpdate_Adapter   
      37                 : {
      38                 :     var $channel;
      39                 :     var $config;
      40                 :     var $ppu;
      41                 :
      42                 :     function PEAR_PackageUpdate_Adapter_XmlRPC(&$config, &$ppu)
      43                 :     {
      44               1 :         $this->config  =&$config;                                            
      45               1 :         $this->ppu     =&$ppu;                                               
      46               1 :         $this->channel = null;                                               
      47               1 :     }                                                                        
      48                 :
      49                 :     /**
      50                 :      * Check if the protocol asked is supported
      51                 :      *
      52                 :      * Check if the protocol asked is supported by default or package channel
      53                 :      *
      54                 :      * @access public
      55                 :      * @return bool
      56                 :      * @since  version 1.1.0a1 (2009-02-28)
      57                 :      */
      58                 :     function supports()
      59                 :     {
      60                 :         // Get the config's registry object
      61               1 :         $reg  = &$this->config->getRegistry();                               
      62               1 :         if ($reg === false) {                                                
      63               0 :             return false;                                                    
      64                 :         }                                                                    
      65                 :
      66                 :         // Get the registry's channel object
      67               1 :         $chan = &$reg->getChannel($this->ppu->channel);                      
      68               1 :         if (PEAR::isError($chan)) {                                          
      69               0 :             return false;                                                    
      70                 :         }                                                                    
      71               1 :         $this->channel = $chan;                                              
      72                 :
      73               1 :         $mirror = $this->config->get('preferred_mirror');                    
      74               1 :         return $chan->supports('xmlrpc', 'package.info', $mirror);           
      75                 :     }                                                                        
      76                 :
      77                 :     /**
      78                 :      * Sends request to the remote server
      79                 :      *
      80                 :      * Sends request to the remote server and returns its response
      81                 :      *
      82                 :      * @param string $request Remote request id to proceed
      83                 :      *
      84                 :      * @access public
      85                 :      * @return mixed
      86                 :      * @since  version 1.1.0a1 (2009-02-28)
      87                 :      */
      88                 :     function sendRequest($request)
      89                 :     {
      90                 :         switch ($request) {
      91               0 :         case 'package.info' :                                                
      92               0 :             if (!isset($this->channel)) {                                    
      93               0 :                 if ($this->supports() == false) {                            
      94               0 :                     return false;                                            
      95                 :                 }                                                            
      96               0 :             }                                                                
      97               0 :             $r    =& $this->config->getRemote();                             
      98               0 :             $info =  $r->call('package.info', $this->ppu->packageName);      
      99               0 :             return $info;                                                    
     100                 :         }                                                                    
     101                 :
     102               0 :         return false;                                                        
     103                 :     }                                                                        
     104                 : }

Generated by PHPUnit 3.3.15 and Xdebug 2.0.4 at Sat Feb 28 15:03:05 CET 2009.