home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / XML / RPC2 / Server / CallHandler.php next >
Encoding:
PHP Script  |  2008-07-02  |  4.7 KB  |  130 lines

  1. <?php
  2.  
  3. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
  4.  
  5. // LICENSE AGREEMENT. If folded, press za here to unfold and read license {{{ 
  6.  
  7. /**
  8. * +-----------------------------------------------------------------------------+
  9. * | Copyright (c) 2004-2006 Sergio Gonalves Carvalho                                |
  10. * +-----------------------------------------------------------------------------+
  11. * | This file is part of XML_RPC2.                                              |
  12. * |                                                                             |
  13. * | XML_RPC2 is free software; you can redistribute it and/or modify            |
  14. * | it under the terms of the GNU Lesser General Public License as published by |
  15. * | the Free Software Foundation; either version 2.1 of the License, or         |
  16. * | (at your option) any later version.                                         |
  17. * |                                                                             |
  18. * | XML_RPC2 is distributed in the hope that it will be useful,                 |
  19. * | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
  20. * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
  21. * | GNU Lesser General Public License for more details.                         |
  22. * |                                                                             |
  23. * | You should have received a copy of the GNU Lesser General Public License    |
  24. * | along with XML_RPC2; if not, write to the Free Software                     |
  25. * | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                    |
  26. * | 02111-1307 USA                                                              |
  27. * +-----------------------------------------------------------------------------+
  28. * | Author: Sergio Carvalho <sergio.carvalho@portugalmail.com>                  |
  29. * +-----------------------------------------------------------------------------+
  30. *
  31. * @category   XML
  32. * @package    XML_RPC2
  33. * @author     Sergio Carvalho <sergio.carvalho@portugalmail.com>  
  34. * @copyright  2004-2006 Sergio Carvalho
  35. * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  36. * @version    CVS: $Id: CallHandler.php,v 1.6 2006/01/22 01:54:48 fab Exp $
  37. * @link       http://pear.php.net/package/XML_RPC2
  38. */
  39.  
  40. // }}}
  41.  
  42. // dependencies {{{
  43. require_once 'XML/RPC2/Exception.php';
  44. // }}}
  45.  
  46. /**
  47.  * A CallHandler is responsible for actually calling the server-exported methods from the exported class.
  48.  *
  49.  * This class is abstract and not meant to be used directly by XML_RPC2 users.
  50.  *
  51.  * XML_RPC2_Server_CallHandler provides the basic code for a call handler class. An XML_RPC2 Call Handler 
  52.  * operates in tandem with an XML_RPC2 server to export a classe's methods. While XML_RPC2 Server 
  53.  * is responsible for request decoding and response encoding, the Call Handler is responsible for 
  54.  * delegating the actual method call to the intended target. 
  55.  * 
  56.  * Different server behaviours can be obtained by plugging different Call Handlers into the XML_RPC2_Server. 
  57.  * Namely, there are two call handlers available:
  58.  *  - XML_RPC2_Server_Callhandler_Class: Which exports a classe's public static methods
  59.  *  - XML_RPC2_Server_Callhandler_Instance: Which exports an object's pubilc methods
  60.  *
  61.  * @see XML_RPC2_Server_Callhandler_Class
  62.  * @see XML_RPC2_Server_Callhandler_Instance
  63.  * @category   XML
  64.  * @package    XML_RPC2
  65.  * @author     Sergio Carvalho <sergio.carvalho@portugalmail.com>  
  66.  * @copyright  2004-2006 Sergio Carvalho
  67.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  68.  * @link       http://pear.php.net/package/XML_RPC2
  69.  */ 
  70. abstract class XML_RPC2_Server_CallHandler
  71. {
  72.     
  73.     // {{{ properties
  74.     
  75.     /**
  76.      * methods Field : holds server methods 
  77.      *
  78.      * @var array
  79.      */
  80.     protected $methods = array();
  81.        
  82.     // }}}
  83.     // {{{ getMethods()
  84.     
  85.     /** 
  86.      * methods getter 
  87.      *
  88.      * @return array Array of XML_RPC2_Server_Method instances
  89.      */
  90.     public function getMethods()
  91.     {
  92.         return $this->methods;
  93.     }
  94.     
  95.     // }}} 
  96.     // {{{ addMethod()
  97.     
  98.     /** 
  99.      * method appender 
  100.      *
  101.      * @param XML_RPC2_Server_Method Method to append to methods
  102.      */
  103.     protected function addMethod(XML_RPC2_Server_Method $method) 
  104.     {
  105.         $this->methods[$method->getName()] = $method;
  106.     }
  107.     
  108.     // }}}
  109.     // {{{ getMethod()
  110.     
  111.     /** 
  112.      * method getter
  113.      *
  114.      * @param string Name of method to return
  115.      * @param XML_RPC2_Server_Method Method named $name
  116.      */
  117.     public function getMethod($name)
  118.     {
  119.         if (isset($this->methods[$name])) {
  120.             return $this->methods[$name];
  121.         }
  122.         return false;    
  123.     }
  124.        
  125.     // }}}
  126.     
  127. }
  128.  
  129. ?>
  130.