Abstract Server implementation

package Default
inherited_from \Zend\Server\AbstractServer

 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

Attach a function or callback to the server

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

Parameters

$function

stringarraycallable

Valid PHP callback

$namespace

string

Ignored

Exceptions

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

Returns

\Zend\Json\Server\Server

Indicate fault response

fault(string $fault = null, integer $code = 404, mixed $data = null) : \Zend\Json\Server\Error

Parameters

$fault

string

$code

integer

$data

mixed

Returns

\Zend\Json\Server\Error

Returns a list of registered methods

getFunctions() : \Zend\Server\Definition
Inherited

Returns an array of method definitions.

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

Returns

\Zend\Server\Definition

Get JSON-RPC request object

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

Returns

\Zend\Json\Server\Request

Get response object

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

Returns

\Zend\Json\Server\Response

Retrieve return response flag

getReturnResponse() : boolean

Returns

boolean

Retrieve SMD object

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

Returns

\Zend\Json\Server\Smd

Handle request

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

Parameters

$request

\Zend\Json\Server\Request

Exceptions

\Zend\Json\Server\Exception\InvalidArgumentException

Returns

null\Zend\Json\Server\Response

Load function definitions

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

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 = null) : \Zend\Json\Server\Server

Parameters

$class

string

$namespace

string

Ignored

$argv

mixed

Ignored

Returns

\Zend\Json\Server\Server

setPersistence()

setPersistence($mode) 

Parameters

$mode

Set request object

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

Parameters

$request

\Zend\Json\Server\Request

Returns

\Zend\Json\Server\Server

Set response object

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

Parameters

$response

\Zend\Json\Server\Response

Returns

\Zend\Json\Server\Server

Set return response flag

setReturnResponse(boolean $flag = true) : \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

boolean

Returns

\Zend\Json\Server\Server

Add service method to service map

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

Parameters

$method

\Zend\Server\Method\Definition

Build callback for method signature

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

Parameters

$reflection

\Zend\Server\Reflection\AbstractFunction

Returns

\Zend\Server\Method\Callback

Build a method signature

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

Parameters

$reflection

\Zend\Server\Reflection\AbstractFunction

$class

nullstringobject

Exceptions

\Zend\Server\Exception\RuntimeException on duplicate entry

Returns

\Zend\Server\Method\Definition

Dispatch method

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

Parameters

$invokable

\Zend\Server\Method\Definition

$params

array

Returns

mixed

Translate PHP type to JSON type

_fixType(string $type) : string
inherited_from \Zend\Server\AbstractServer::_fixType()

Parameters

$type

string

Returns

string

Map PHP type to protocol type

_fixType(string $type) : string
Inherited

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

$method

\Zend\Server\Method\Definition

Returns

stringarray

Set response state

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

Returns

\Zend\Json\Server\Response

Get method return type

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

Parameters

$method

\Zend\Server\Method\Definition

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) : boolean

Parameters

$array

array

Returns

boolean

 Properties

 

Inherited from Zend\Server\AbstractServer

$overwriteExistingMethods : boolean

Default

true
inherited_from \Zend\Server\AbstractServer::overwriteExistingMethods
 

Flag; whether or not overwriting existing methods is allowed

$overwriteExistingMethods : boolean

Default

false
 

Request object

$request : \Zend\Json\Server\Request

Default

 

Response object

$response : \Zend\Json\Server\Response

Default

 

Flag: whether or not to auto-emit the response

$returnResponse : boolean

Default

false
 

SMD object

$serviceMap : \Zend\Json\Server\Smd

Default

 

SMD class accessors

$smdMethods : array

Default

 

$table

$table : \Zend\Server\Definition

Default

 Constants

 

VERSION_1

VERSION_1 = '1.0' 
 

VERSION_2

VERSION_2 = '2.0'