Json/Server/Smd/Service.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Json  

\Zend_Json_Server_Smd_Service

Package: Zend_Json\Server
Create Service Mapping Description for a method
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Version
$Id$  

Properties

>VPropertyprotected$_envelope = \Zend_Json_Server_Smd::ENV_JSONRPC_1
Default value\Zend_Json_Server_Smd::ENV_JSONRPC_1Details
Type
n/a
>VPropertyprotectedarray $_envelopeTypes = array(\Zend_Json_Server_Smd::ENV_JSONRPC_1, \Zend_Json_Server_Smd::ENV_JSONRPC_2)
Allowed envelope types
Default valuearray(\Zend_Json_Server_Smd::ENV_JSONRPC_1, \Zend_Json_Server_Smd::ENV_JSONRPC_2)Details
Type
array
>VPropertyprotected$_name
Details
Type
n/a
>VPropertyprotectedstring $_nameRegex = '/^[a-z][a-z0-9._]+$/i'
Regex for names
Default value'/^[a-z][a-z0-9._]+$/i'Details
Type
string
>VPropertyprotectedarray $_paramMap = 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')
Mapping of parameter types to JSON-RPC types
Default valuearray('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')Details
Type
array
>VPropertyprotectedarray $_paramOptionTypes = array('name' => 'is_string', 'optional' => 'is_bool', 'default' => null, 'description' => 'is_string')
Parameter option types
Default valuearray('name' => 'is_string', 'optional' => 'is_bool', 'default' => null, 'description' => 'is_string')Details
Type
array
>VPropertyprotectedarray $_params = array()
Service params
Default valuearray()Details
Type
array
>VPropertyprotected$_return
Details
Type
n/a
>VPropertyprotected$_target
Details
Type
n/a
>VPropertyprotected$_transport = 'POST'
Default value'POST'Details
Type
n/a
>VPropertyprotectedarray $_transportTypes = array('POST')
Allowed transport types
Default valuearray('POST')Details
Type
array

Methods

methodpublic__construct(string | array $spec) : void

Constructor

Parameters
NameTypeDescription
$specstring | array
Throws
ExceptionDescription
\Zend_Json_Server_Exceptionif no name provided
methodpublic__toString() : string

Cast to string

Returns
TypeDescription
string
methodprotected_validateParamType(string $type,  $isReturn = false) : true

Validate parameter type

Parameters
NameTypeDescription
$typestring
$isReturn
Returns
TypeDescription
true
Throws
ExceptionDescription
\Zend_Json_Server_Exception
methodpublicaddParam(string | array $type, array $options = array(), int | null $order = null) : \Zend_Json_Server_Smd_Service

Add a parameter to the service

Parameters
NameTypeDescription
$typestring | array
$optionsarray
$orderint | null
Returns
TypeDescription
\Zend_Json_Server_Smd_Service
methodpublicaddParams(array $params) : \Zend_Json_Server_Smd_Service

Add params

Each param should be an array, and should include the key 'type'.
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
\Zend_Json_Server_Smd_Service
methodpublicgetEnvelope() : string

Get envelope type

Returns
TypeDescription
string
methodpublicgetName() : string

Retrieve name

Returns
TypeDescription
string
methodpublicgetParams() : array

Get all parameters

Returns all params in specified order.
Returns
TypeDescription
array
methodpublicgetReturn() : string | array

Get return type

Returns
TypeDescription
string | array
methodpublicgetTarget() : string

Get service target

Returns
TypeDescription
string
methodpublicgetTransport() : string

Get transport

Returns
TypeDescription
string
methodpublicsetEnvelope(string $envelopeType) : \Zend_Json_Server_Smd_Service

Set envelope type

Parameters
NameTypeDescription
$envelopeTypestring
Returns
TypeDescription
\Zend_Json_Server_Smd_Service
methodpublicsetName(string $name) : \Zend_Json_Server_Smd_Service

Set service name

Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
\Zend_Json_Server_Smd_Service
Throws
ExceptionDescription
\Zend_Json_Server_Exception
methodpublicsetOptions(array $options) : \Zend_Json_Server_Smd_Service

Set object state

Parameters
NameTypeDescription
$optionsarray
Returns
TypeDescription
\Zend_Json_Server_Smd_Service
methodpublicsetParams(array $params) : \Zend_Json_Server_Smd_Service

Overwrite all parameters

Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
\Zend_Json_Server_Smd_Service
methodpublicsetReturn(string | array $type) : \Zend_Json_Server_Smd_Service

Set return type

Parameters
NameTypeDescription
$typestring | array
Returns
TypeDescription
\Zend_Json_Server_Smd_Service
methodpublicsetTarget(string $target) : \Zend_Json_Server_Smd_Service

Set service target

Parameters
NameTypeDescription
$targetstring
Returns
TypeDescription
\Zend_Json_Server_Smd_Service
methodpublicsetTransport(string $transport) : \Zend_Json_Server_Smd_Service

Set Transport

Currently limited to POST
Parameters
NameTypeDescription
$transportstring
Returns
TypeDescription
\Zend_Json_Server_Smd_Service
methodpublictoArray() : array

Cast service description to array

Returns
TypeDescription
array
methodpublictoJson() : string

Return JSON encoding of service

Returns
TypeDescription
string
Documentation was generated by phpDocumentor 2.2.0 .