Server Interface

 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, int $code) : mixed

Parameters

$fault

mixed

$code

int

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() : bool

Returns

bool$flag Current status.

Handle a request

handle(mixed $request) : 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, null | array $argv) : 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

nullarray

Optional array of arguments to pass to callbacks at dispatch.

Set server persistence

setPersistence(int $mode) : void

todo Determine how to implement this

Parameters

$mode

int

Sets auto-response flag for the server.

setReturnResponse(bool $flag) : \Zend\Server\Server

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

Parameters

$flag

bool

Returns

\Zend\Server\ServerSelf instance.