1<?php 2/** 3 * Zend Framework 4 * 5 * LICENSE 6 * 7 * This source file is subject to the new BSD license that is bundled 8 * with this package in the file LICENSE.txt. 9 * It is also available through the world-wide-web at this URL: 10 * http://framework.zend.com/license/new-bsd 11 * If you did not receive a copy of the license and are unable to 12 * obtain it through the world-wide-web, please send an email 13 * to license@zend.com so we can send you a copy immediately. 14 * 15 * @category Zend 16 * @package Zend_Server 17 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 18 * @license http://framework.zend.com/license/new-bsd New BSD License 19 */ 20 21/** 22 * Zend_Server_Interface 23 * 24 * @category Zend 25 * @package Zend_Server 26 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 27 * @license http://framework.zend.com/license/new-bsd New BSD License 28 * @version $Id$ 29 */ 30interface Zend_Server_Interface 31{ 32 /** 33 * Attach a function as a server method 34 * 35 * Namespacing is primarily for xmlrpc, but may be used with other 36 * implementations to prevent naming collisions. 37 * 38 * @param string $function 39 * @param string $namespace 40 * @param null|array Optional array of arguments to pass to callbacks at 41 * dispatch. 42 * @return void 43 */ 44 public function addFunction($function, $namespace = ''); 45 46 /** 47 * Attach a class to a server 48 * 49 * The individual implementations should probably allow passing a variable 50 * number of arguments in, so that developers may define custom runtime 51 * arguments to pass to server methods. 52 * 53 * Namespacing is primarily for xmlrpc, but could be used for other 54 * implementations as well. 55 * 56 * @param mixed $class Class name or object instance to examine and attach 57 * to the server. 58 * @param string $namespace Optional namespace with which to prepend method 59 * names in the dispatch table. 60 * methods in the class will be valid callbacks. 61 * @param null|array Optional array of arguments to pass to callbacks at 62 * dispatch. 63 * @return void 64 */ 65 public function setClass($class, $namespace = '', $argv = null); 66 67 /** 68 * Generate a server fault 69 * 70 * @param mixed $fault 71 * @param int $code 72 * @return mixed 73 */ 74 public function fault($fault = null, $code = 404); 75 76 /** 77 * Handle a request 78 * 79 * Requests may be passed in, or the server may automagically determine the 80 * request based on defaults. Dispatches server request to appropriate 81 * method and returns a response 82 * 83 * @param mixed $request 84 * @return mixed 85 */ 86 public function handle($request = false); 87 88 /** 89 * Return a server definition array 90 * 91 * Returns a server definition array as created using 92 * {@link * Zend_Server_Reflection}. Can be used for server introspection, 93 * documentation, or persistence. 94 * 95 * @access public 96 * @return array 97 */ 98 public function getFunctions(); 99 100 /** 101 * Load server definition 102 * 103 * Used for persistence; loads a construct as returned by {@link getFunctions()}. 104 * 105 * @param array $array 106 * @return void 107 */ 108 public function loadFunctions($definition); 109 110 /** 111 * Set server persistence 112 * 113 * @todo Determine how to implement this 114 * @param int $mode 115 * @return void 116 */ 117 public function setPersistence($mode); 118} 119