Json/Server.php
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 [email protected] 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
- Version
- $Id$
\Zend_Json_Server
Package: Zend_Json
Zend_Server_Abstract
- Parent(s)
- \Zend_Server_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties
bool $_autoEmitResponse = true
Flag: whether or not to auto-emit the response
Default value
true
Details- Type
- bool
bool $_overwriteExistingMethods = true
Flag; allow overwriting existing methods when creating server definition
Default value
true
Details- Type
- bool
Methods
__call(string $method, array $args) : mixed
Overload to accessors of SMD object
Parameters
Returns
Name | Type | Description |
---|---|---|
$method | string | |
$args | array |
Type | Description |
---|---|
mixed |
_addMethodServiceMap(\Zend_Server_Reflection_Function $method) : void
Add service method to service map
Parameters
Name | Type | Description |
---|---|---|
$method | \Zend_Server_Reflection_Function |
_fixType(string $type) : string
Translate PHP type to JSON type
Parameters
Returns
Name | Type | Description |
---|---|---|
$type | string |
Type | Description |
---|---|
string |
_getDefaultParams(array $args, array $params) : array
Get default params from signature
Parameters
Returns
Name | Type | Description |
---|---|---|
$args | array | |
$params | array |
Type | Description |
---|---|
array |
_getParams(\Zend_Server_Reflection_Function_Abstract $method) : string | array
Get method param type
Parameters
Returns
Name | Type | Description |
---|---|---|
$method | \Zend_Server_Reflection_Function_Abstract |
Type | Description |
---|---|
string | array |
_getReadyResponse() : \Zend_Json_Server_Response
Set response state
Returns
Type | Description |
---|---|
\Zend_Json_Server_Response |
_getReturnType(\Zend_Server_Reflection_Function_Abstract $method) : string | array
Get method return type
Parameters
Returns
Name | Type | Description |
---|---|---|
$method | \Zend_Server_Reflection_Function_Abstract |
Type | Description |
---|---|
string | array |
_getSmdMethods() : array
Retrieve list of allowed SMD methods for proxying
Returns
Type | Description |
---|---|
array |
addFunction(string | array $function, string $namespace = '') : \Zend_Json_Server
Attach a function or callback to the server
Parameters
Returns
Name | Type | Description |
---|---|---|
$function | string | array | Valid PHP callback |
$namespace | string | Ignored |
Type | Description |
---|---|
\Zend_Json_Server |
fault(string $fault = null, int $code = 404, $data = null) : false
Indicate fault response
Parameters
Returns
Name | Type | Description |
---|---|---|
$fault | string | |
$code | int | |
$data |
Type | Description |
---|---|
false |
getRequest() : \Zend_Json_Server_Request
Get JSON-RPC request object
Returns
Type | Description |
---|---|
\Zend_Json_Server_Request |
getResponse() : \Zend_Json_Server_Response
Get response object
Returns
Type | Description |
---|---|
\Zend_Json_Server_Response |
getServiceMap() : \Zend_Json_Server_Smd
Retrieve SMD object
Returns
Type | Description |
---|---|
\Zend_Json_Server_Smd |
handle(\Zend_Json_Server_Request $request = false) : null | \Zend_Json_Server_Response
Handle request
Parameters
Returns
Name | Type | Description |
---|---|---|
$request | \Zend_Json_Server_Request |
Type | Description |
---|---|
null | \Zend_Json_Server_Response |
loadFunctions(array | \Zend_Server_Definition $definition) : void
Load function definitions
Parameters
Name | Type | Description |
---|---|---|
$definition | array | \Zend_Server_Definition |
setAutoEmitResponse(bool $flag) : \Zend_Json_Server
Set flag indicating whether or not to auto-emit response
Parameters
Returns
Name | Type | Description |
---|---|---|
$flag | bool |
Type | Description |
---|---|
\Zend_Json_Server |
setClass(string $class, string $namespace = '', mixed $argv = null) : \Zend_Json_Server
Register a class with the server
Parameters
Returns
Name | Type | Description |
---|---|---|
$class | string | |
$namespace | string | Ignored |
$argv | mixed | Ignored |
Type | Description |
---|---|
\Zend_Json_Server |
setRequest(\Zend_Json_Server_Request $request) : \Zend_Json_Server
Set request object
Parameters
Returns
Name | Type | Description |
---|---|---|
$request | \Zend_Json_Server_Request |
Type | Description |
---|---|
\Zend_Json_Server |
setResponse(\Zend_Json_Server_Response $response) : \Zend_Json_Server
Set response object
Parameters
Returns
Name | Type | Description |
---|---|---|
$response | \Zend_Json_Server_Response |
Type | Description |
---|---|
\Zend_Json_Server |