File indexing completed on 2024-05-12 06:02:59

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Server
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0019  */
0020 
0021 /**
0022  * Zend_Server_Interface
0023  *
0024  * @category Zend
0025  * @package  Zend_Server
0026  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0027  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0028  * @version $Id$
0029  */
0030 interface Zend_Server_Interface
0031 {
0032     /**
0033      * Attach a function as a server method
0034      *
0035      * Namespacing is primarily for xmlrpc, but may be used with other
0036      * implementations to prevent naming collisions.
0037      *
0038      * @param string $function
0039      * @param string $namespace
0040      * @param null|array Optional array of arguments to pass to callbacks at
0041      * dispatch.
0042      * @return void
0043      */
0044     public function addFunction($function, $namespace = '');
0045 
0046     /**
0047      * Attach a class to a server
0048      *
0049      * The individual implementations should probably allow passing a variable
0050      * number of arguments in, so that developers may define custom runtime
0051      * arguments to pass to server methods.
0052      *
0053      * Namespacing is primarily for xmlrpc, but could be used for other
0054      * implementations as well.
0055      *
0056      * @param mixed $class Class name or object instance to examine and attach
0057      * to the server.
0058      * @param string $namespace Optional namespace with which to prepend method
0059      * names in the dispatch table.
0060      * methods in the class will be valid callbacks.
0061      * @param null|array Optional array of arguments to pass to callbacks at
0062      * dispatch.
0063      * @return void
0064      */
0065     public function setClass($class, $namespace = '', $argv = null);
0066 
0067     /**
0068      * Generate a server fault
0069      *
0070      * @param mixed $fault
0071      * @param int $code
0072      * @return mixed
0073      */
0074     public function fault($fault = null, $code = 404);
0075 
0076     /**
0077      * Handle a request
0078      *
0079      * Requests may be passed in, or the server may automagically determine the
0080      * request based on defaults. Dispatches server request to appropriate
0081      * method and returns a response
0082      *
0083      * @param mixed $request
0084      * @return mixed
0085      */
0086     public function handle($request = false);
0087 
0088     /**
0089      * Return a server definition array
0090      *
0091      * Returns a server definition array as created using
0092      * {@link * Zend_Server_Reflection}. Can be used for server introspection,
0093      * documentation, or persistence.
0094      *
0095      * @access public
0096      * @return array
0097      */
0098     public function getFunctions();
0099 
0100     /**
0101      * Load server definition
0102      *
0103      * Used for persistence; loads a construct as returned by {@link getFunctions()}.
0104      *
0105      * @param array $array
0106      * @return void
0107      */
0108     public function loadFunctions($definition);
0109 
0110     /**
0111      * Set server persistence
0112      *
0113      * @todo Determine how to implement this
0114      * @param int $mode
0115      * @return void
0116      */
0117     public function setPersistence($mode);
0118 }