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 / Services / DynDNS / Request.php next >
Encoding:
PHP Script  |  2008-07-02  |  2.5 KB  |  85 lines

  1. <?php
  2.  
  3. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  4.  
  5. /**
  6.  * Contains the Services_DynDNS_Request class
  7.  * 
  8.  * PHP versions 4 and 5
  9.  *
  10.  * LICENSE: This source file is subject to version 3.0 of the PHP license
  11.  * that is available through the world-wide-web at the following URI:
  12.  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  13.  * the PHP License and are unable to obtain it through the web, please
  14.  * send a note to license@php.net so we can mail you a copy immediately.
  15.  * 
  16.  * @category   Web Services
  17.  * @package    Services_DynDNS
  18.  * @author     Bryan Dunlap <bdunlap@bryandunlap.com>
  19.  * @copyright  2005 Bryan Dunlap
  20.  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  21.  * @version    CVS: $Id: Request.php,v 1.1 2005/08/13 14:25:34 bdunlap Exp $
  22.  * @link       http://pear.php.net/package/Services_DynDNS
  23.  */
  24.  
  25. /**
  26.  * Load HTTP_Request
  27.  */
  28. require_once 'HTTP/Request.php';
  29.  
  30. /**
  31.  * A static factory class used to create DynDNS_Request object instances
  32.  *
  33.  * @category   Web Services
  34.  * @package    Services_DynDNS
  35.  * @author     Bryan Dunlap <bdunlap@bryandunlap.com>
  36.  * @copyright  2005 Bryan Dunlap
  37.  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  38.  * @version    Release: 0.3.1
  39.  */
  40. class Services_DynDNS_Request
  41. {
  42.     
  43.     /**
  44.      * Creates a new DynDNS_Request object from the specified request type
  45.      *
  46.      * @param  string    $type        a string containing the type of request
  47.      * @param  string    $parameters  an array containing the parameters for the
  48.      *                                request
  49.      * @return object    a new DynDNS_Request object, PEAR_Error on failure
  50.      * @access public
  51.      * @static
  52.      */
  53.     function &factory($type = null, $parameters = array())
  54.     {
  55.         if (is_null($type)) {
  56.             $type = SERVICES_DYNDNS_DEFAULT_SYSTEM;
  57.         }
  58.         $type = basename(strtolower($type));
  59.         @include_once 'Services/DynDNS/Request/' . $type . '.php';
  60.         $class = 'Services_DynDNS_Request_' . $type;
  61.         if (!class_exists($class)) {
  62.             return PEAR::raiseError("'{$class}' doesn't exist");
  63.         }
  64.         $request =& new $class();
  65.         foreach ($parameters as $name => $value) {
  66.             $result = $request->setParameter($name, $value);
  67.             if (PEAR::isError($result)) {
  68.                 return $result;
  69.             }
  70.         }
  71.         return $request;
  72.     }
  73.         
  74. }
  75.  
  76. /*
  77.  * Local variables:
  78.  * tab-width: 4
  79.  * c-basic-offset: 4
  80.  * c-hanging-comment-ender-p: nil
  81.  * End:
  82.  */
  83.  
  84. ?>
  85.