Server Interface

package Default

 Methods

Attach a function as a server method

addFunction(string $function, string $namespace = '') : void

Namespacing is primarily for xmlrpc, but may be used with other implementations to prevent naming collisions.

Parameters

$function

string

$namespace

string

Generate a server fault

fault(mixed $fault = null, integer $code = 404) : mixed

Parameters

$fault

mixed

$code

integer

Returns

mixed

Return a server definition array

getFunctions() : array

Returns a server definition array as created using \Reflection. Can be used for server introspection, documentation, or persistence.

Returns

array

Returns last produced response.

getResponse() : string | object

Returns

stringobjectContent of last response, or response object that implements __toString() methods.

Returns auto-response flag of the server.

getReturnResponse() : boolean

Returns

boolean$flag Current status.

Handle a request

handle(mixed $request = false) : mixed

Requests may be passed in, or the server may automatically determine the request based on defaults. Dispatches server request to appropriate method and returns a response

Parameters

$request

mixed

Returns

mixed

Load server definition

loadFunctions(array $definition) : void

Used for persistence; loads a construct as returned by \getFunctions().

Parameters

$definition

array

Attach a class to a server

setClass(mixed $class, string $namespace = '', $argv = null) : void

The individual implementations should probably allow passing a variable number of arguments in, so that developers may define custom runtime arguments to pass to server methods.

Namespacing is primarily for xmlrpc, but could be used for other implementations as well.

Parameters

$class

mixed

Class name or object instance to examine and attach to the server.

$namespace

string

Optional namespace with which to prepend method names in the dispatch table. methods in the class will be valid callbacks.

$argv

Set server persistence

setPersistence(integer $mode) : void
todo Determine how to implement this

Parameters

$mode

integer

Sets auto-response flag for the server.

setReturnResponse(boolean $flag = true) : \Zend\Server\Server

To unify all servers, default behavior should be to auto-emit response.

Parameters

$flag

boolean

Returns

\Zend\Server\ServerSelf instance.