composer package updates
[openemr.git] / vendor / zendframework / zend-server / src / Server.php
blobd0de05bef46cec22166cedbcd4b63e4004df0870
1 <?php
2 /**
3 * @see https://github.com/zendframework/zend-server for the canonical source repository
4 * @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
5 * @license https://github.com/zendframework/zend-server/blob/master/LICENSE.md New BSD License
6 */
8 namespace Zend\Server;
10 /**
11 * Server Interface
13 interface Server
15 /**
16 * Attach a function as a server method
18 * Namespacing is primarily for xmlrpc, but may be used with other
19 * implementations to prevent naming collisions.
21 * @param string $function
22 * @param string $namespace
23 * @param null|array Optional array of arguments to pass to callback at
24 * dispatch.
25 * @return void
27 public function addFunction($function, $namespace = '');
29 /**
30 * Attach a class to a server
32 * The individual implementations should probably allow passing a variable
33 * number of arguments in, so that developers may define custom runtime
34 * arguments to pass to server methods.
36 * Namespacing is primarily for xmlrpc, but could be used for other
37 * implementations as well.
39 * @param mixed $class Class name or object instance to examine and attach
40 * to the server.
41 * @param string $namespace Optional namespace with which to prepend method
42 * names in the dispatch table.
43 * methods in the class will be valid callbacks.
44 * @param null|array Optional array of arguments to pass to callbacks at
45 * dispatch.
46 * @return void
48 public function setClass($class, $namespace = '', $argv = null);
50 /**
51 * Generate a server fault
53 * @param mixed $fault
54 * @param int $code
55 * @return mixed
57 public function fault($fault = null, $code = 404);
59 /**
60 * Handle a request
62 * Requests may be passed in, or the server may automatically determine the
63 * request based on defaults. Dispatches server request to appropriate
64 * method and returns a response
66 * @param mixed $request
67 * @return mixed
69 public function handle($request = false);
71 /**
72 * Return a server definition array
74 * Returns a server definition array as created using
75 * {@link Reflection}. Can be used for server introspection,
76 * documentation, or persistence.
78 * @return array
80 public function getFunctions();
82 /**
83 * Load server definition
85 * Used for persistence; loads a construct as returned by {@link getFunctions()}.
87 * @param array $definition
88 * @return void
90 public function loadFunctions($definition);
92 /**
93 * Set server persistence
95 * @todo Determine how to implement this
96 * @param int $mode
97 * @return void
99 public function setPersistence($mode);
102 * Sets auto-response flag for the server.
104 * To unify all servers, default behavior should be to auto-emit response.
106 * @param bool $flag
107 * @return Server Self instance.
109 public function setReturnResponse($flag = true);
112 * Returns auto-response flag of the server.
114 * @return bool $flag Current status.
116 public function getReturnResponse();
119 * Returns last produced response.
121 * @return string|object Content of last response, or response object that
122 * implements __toString() methods.
124 public function getResponse();