Create Service Mapping Description for a method

todo Revised method regex to allow NS; however, should SMD be revised to strip PHP NS instead when attaching functions?
package Default

 Methods

Constructor

__construct(string|array $spec) 

Parameters

$spec

stringarray

Exceptions

\Zend\Json\Server\Exception\InvalidArgumentException if no name provided

Cast to string

__toString() : string

Returns

string

Add a parameter to the service

addParam(string|array $type, array $options = array(), integer|null $order = null) : \Zend\Json\Server\Smd\Service

Parameters

$type

stringarray

$options

array

$order

integernull

Exceptions

\Zend\Json\Server\Exception\InvalidArgumentException

Returns

\Zend\Json\Server\Smd\Service

Add params

addParams(array $params) : \Zend\Json\Server\Smd\Service

Each param should be an array, and should include the key 'type'.

Parameters

$params

array

Returns

\Zend\Json\Server\Smd\Service

Get envelope type

getEnvelope() : string

Returns

string

Retrieve name

getName() : string

Returns

string

Get all parameters

getParams() : array

Returns all params in specified order.

Returns

array

Get return type

getReturn() : string | array

Returns

stringarray

Get service target

getTarget() : string

Returns

string

Get transport

getTransport() : string

Returns

string

Set envelope type

setEnvelope(string $envelopeType) : \Zend\Json\Server\Smd\Service

Parameters

$envelopeType

string

Exceptions

\Zend\Json\Server\Exception\InvalidArgumentException

Returns

\Zend\Json\Server\Smd\Service

Set service name

setName(string $name) : \Zend\Json\Server\Smd\Service

Parameters

$name

string

Exceptions

\Zend\Json\Server\Exception\InvalidArgumentException

Returns

\Zend\Json\Server\Smd\Service

Set object state

setOptions(array $options) : \Zend\Json\Server\Smd\Service

Parameters

$options

array

Returns

\Zend\Json\Server\Smd\Service

Overwrite all parameters

setParams(array $params) : \Zend\Json\Server\Smd\Service

Parameters

$params

array

Returns

\Zend\Json\Server\Smd\Service

Set return type

setReturn(string|array $type) : \Zend\Json\Server\Smd\Service

Parameters

$type

stringarray

Exceptions

\Zend\Json\Server\Exception\InvalidArgumentException

Returns

\Zend\Json\Server\Smd\Service

Set service target

setTarget(string $target) : \Zend\Json\Server\Smd\Service

Parameters

$target

string

Returns

\Zend\Json\Server\Smd\Service

Set Transport

setTransport(string $transport) : \Zend\Json\Server\Smd\Service

Currently limited to POST

Parameters

$transport

string

Exceptions

\Zend\Json\Server\Exception\InvalidArgumentException

Returns

\Zend\Json\Server\Smd\Service

Cast service description to array

toArray() : array

Returns

array

Return JSON encoding of service

toJson() : string

Returns

string

Validate parameter type

_validateParamType(string $type, boolean $isReturn = false) : string

Parameters

$type

string

$isReturn

boolean

Exceptions

\Zend\Json\Server\Exception\InvalidArgumentException

Returns

string

 Properties

 

$envelope

$envelope 

Default

\Zend\Json\Server\Smd::ENV_JSONRPC_1
 

Allowed envelope types

$envelopeTypes : array

Default

array(\Zend\Json\Server\Smd::ENV_JSONRPC_1, \Zend\Json\Server\Smd::ENV_JSONRPC_2)
 

$name

$name 

Default

 

Regex for names

$nameRegex : string

Default

'/^(?!^rpc\.)[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff\.\\\]*$/'
 

Mapping of parameter types to JSON-RPC types

$paramMap : array

Default

array('any' => 'any', 'arr' => 'array', 'array' => 'array', 'assoc' => 'object', 'bool' => 'boolean', 'boolean' => 'boolean', 'dbl' => 'float', 'double' => 'float', 'false' => 'boolean', 'float' => 'float', 'hash' => 'object', 'integer' => 'integer', 'int' => 'integer', 'mixed' => 'any', 'nil' => 'null', 'null' => 'null', 'object' => 'object', 'string' => 'string', 'str' => 'string', 'struct' => 'object', 'true' => 'boolean', 'void' => 'null')
 

Parameter option types

$paramOptionTypes : array

Default

array('name' => 'is_string', 'optional' => 'is_bool', 'default' => null, 'description' => 'is_string')
 

Service params

$params : array

Default

array()
 

$return

$return 

Default

 

$target

$target 

Default

 

$transport

$transport 

Default

'POST'
 

Allowed transport types

$transportTypes : array

Default

array('POST')