Abstract Server implementation

 Methods

Overload to accessors of SMD object

__call(string $method, array $args) : mixed

Parameters

$method

string

$args

array

Returns

mixed

Constructor

__construct() 
Inherited

Setup server description

inherited_from \Zend\Server\AbstractServer::__construct()

Attach a function or callback to the server

addFunction(string | array | \Zend\Json\Server\callable $function, string $namespace) : \Zend\Json\Server\Server

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

Parameters

$function

stringarray\Zend\Json\Server\callable

Valid PHP callback

$namespace

string

Ignored

Exceptions

\Zend\Json\Server\Exception\InvalidArgumentException if function invalid or not callable

Returns

Indicate fault response

fault(string $fault, int $code, mixed $data) : \Zend\Json\Server\Error

Parameters

$fault

string

$code

int

$data

mixed

Returns

Returns a list of registered methods

getFunctions() : \Zend\Server\Definition
Inherited

Returns an array of method definitions.

inherited_from \Zend\Server\AbstractServer::getFunctions()

Returns

Get JSON-RPC request object

getRequest() : \Zend\Json\Server\Request

Get response object

getResponse() : \Zend\Json\Server\Response

Retrieve return response flag

getReturnResponse() : bool

Returns

bool

Retrieve SMD object

getServiceMap() : \Zend\Json\Server\Smd

Handle request

handle(\Zend\Json\Server\Request $request) : null | \Zend\Json\Server\Response

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

Exceptions

\Zend\Json\Server\Exception\InvalidArgumentException

Returns

Load function definitions

loadFunctions(array | \Zend\Server\Definition $definition) : void

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

Parameters

$definition

array\Zend\Server\Definition

Exceptions

\Zend\Json\Server\Exception\InvalidArgumentException

Register a class with the server

setClass(string $class, string $namespace, mixed $argv) : \Zend\Json\Server\Server

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

string

$namespace

string

Ignored

$argv

mixed

Ignored

Returns

Set server persistence

setPersistence(int $mode) : void

Parameters

$mode

int

Set request object

setRequest(\Zend\Json\Server\Request $request) : \Zend\Json\Server\Server

Set response object

setResponse(\Zend\Json\Server\Response $response) : \Zend\Json\Server\Server

Set return response flag

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

If true, handle() will return the response instead of automatically sending it back to the requesting client.

The response is always available via getResponse().

Parameters

$flag

bool

Returns

Add service method to service map

_addMethodServiceMap(\Zend\Server\Method\Definition $method) : void

Parameters

Build callback for method signature

_buildCallback(\Zend\Server\Reflection\AbstractFunction $reflection) : \Zend\Server\Method\Callback
Inherited

inherited_from \Zend\Server\AbstractServer::_buildCallback()

Parameters

Returns

Build a method signature

_buildSignature(\Zend\Server\Reflection\AbstractFunction $reflection, null | string | object $class) : \Zend\Server\Method\Definition
Inherited

inherited_from \Zend\Server\AbstractServer::_buildSignature()

Parameters

$class

nullstringobject

Exceptions

\Zend\Server\Exception\RuntimeException on duplicate entry

Returns

Dispatch method

_dispatch(\Zend\Server\Method\Definition $invokable, array $params) : mixed
Inherited

inherited_from \Zend\Server\AbstractServer::_dispatch()

Parameters

$params

array

Returns

mixed

Translate PHP type to JSON type

_fixType(string $type) : string

Parameters

$type

string

Returns

string

Get default params from signature

_getDefaultParams(array $args, array $params) : array

Parameters

$args

array

$params

array

Returns

array

Get method param type

_getParams(\Zend\Server\Method\Definition $method) : string | array

Parameters

Returns

stringarray

Set response state

_getReadyResponse() : \Zend\Json\Server\Response

Get method return type

_getReturnType(\Zend\Server\Method\Definition $method) : string | array

Parameters

Returns

stringarray

Retrieve list of allowed SMD methods for proxying

_getSmdMethods() : array

Returns

array

Internal method for handling request

_handle() : void

check whether array is associative or not

isAssociative(array $array) : bool

Parameters

$array

array

Returns

bool

 Properties

 

Inherited from Zend\Server\AbstractServer

$overwriteExistingMethods : bool

 

Request object

$request : \Zend\Json\Server\Request

 

Response object

$response : \Zend\Json\Server\Response

 

Flag: whether or not to auto-emit the response

$returnResponse : bool

 

SMD object

$serviceMap : \Zend\Json\Server\Smd

 

SMD class accessors

$smdMethods : array

 

$table

$table : \Zend\Server\Definition
Inherited

inherited_from \Zend\Server\AbstractServer::$$table

 Constants

 

VERSION_1

VERSION_1 

 

VERSION_2

VERSION_2