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-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Json
- Version
- $Id: Server.php 25085 2012-11-06 21:11:41Z rob $
\Zend_Json_Server
Zend_Server_Abstract
- Parent(s)
- \Zend_Server_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Version
- $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
Constants
Properties

bool $_autoEmitResponse = trueFlag: whether or not to auto-emit the response
trueDetails- Type
- bool

bool $_overwriteExistingMethods = truetrueDetails- Type
- bool

array $magic_methods = array('__call', '__clone', '__construct', '__destruct', '__get', '__isset', '__set', '__set_state', '__sleep', '__tostring', '__unset', '__wakeup')array('__call', '__clone', '__construct', '__destruct', '__get', '__isset', '__set', '__set_state', '__sleep', '__tostring', '__unset', '__wakeup')Details- Type
- array
- Inherited_from
- \Zend_Server_Abstract::$$magic_methods
Methods

__call(string $method, array $args) : mixedOverload to accessors of SMD object
| Name | Type | Description |
|---|---|---|
| $method | string | |
| $args | array |
| Type | Description |
|---|---|
| mixed |

_addMethodServiceMap(\Zend_Server_Reflection_Function $method) : voidAdd service method to service map
| Name | Type | Description |
|---|---|---|
| $method | \Zend_Server_Reflection_Function |

_buildCallback(\Zend_Server_Reflection_Function_Abstract $reflection) : \Zend_Server_Method_CallbackBuild callback for method signature
Inherited from: \Zend_Server_Abstract::_buildCallback()| Name | Type | Description |
|---|---|---|
| $reflection | \Zend_Server_Reflection_Function_Abstract |
| Type | Description |
|---|---|
| \Zend_Server_Method_Callback |

_buildSignature(\Zend_Server_Reflection_Function_Abstract $reflection, null | string | object $class = null) : \Zend_Server_Method_Definition
| Name | Type | Description |
|---|---|---|
| $reflection | \Zend_Server_Reflection_Function_Abstract | |
| $class | null | string | object |
| Type | Description |
|---|---|
| \Zend_Server_Method_Definition |
| Exception | Description |
|---|---|
| \Zend_Server_Exception | on duplicate entry |

_dispatch(\Zend_Server_Method_Definition $invocable, array $params) : mixed
| Name | Type | Description |
|---|---|---|
| $invocable | \Zend_Server_Method_Definition | |
| $params | array |
| Type | Description |
|---|---|
| mixed |

_fixType(string $type) : stringTranslate PHP type to JSON type
| Name | Type | Description |
|---|---|---|
| $type | string |
| Type | Description |
|---|---|
| string |

_getDefaultParams(array $args, array $params) : arrayGet default params from signature
| Name | Type | Description |
|---|---|---|
| $args | array | |
| $params | array |
| Type | Description |
|---|---|
| array |

_getParams(\Zend_Server_Reflection_Function_Abstract $method) : string | arrayGet method param type
| Name | Type | Description |
|---|---|---|
| $method | \Zend_Server_Reflection_Function_Abstract |
| Type | Description |
|---|---|
| string | array |

_getReadyResponse() : \Zend_Json_Server_ResponseSet response state
| Type | Description |
|---|---|
| \Zend_Json_Server_Response |

_getReturnType(\Zend_Server_Reflection_Function_Abstract $method) : string | arrayGet method return type
| Name | Type | Description |
|---|---|---|
| $method | \Zend_Server_Reflection_Function_Abstract |
| Type | Description |
|---|---|
| string | array |

_getSmdMethods() : arrayRetrieve list of allowed SMD methods for proxying
| Type | Description |
|---|---|
| array |

addFunction(string | array $function, string $namespace = '') : \Zend_Json_ServerAttach a function or callback to the server
Namespacing is primarily for xmlrpc, but may be used with other implementations to prevent naming collisions.
| 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) : falseIndicate fault response
| Name | Type | Description |
|---|---|---|
| $fault | string | |
| $code | int | |
| $data |
| Type | Description |
|---|---|
| false |

getFunctions() : \Zend_Server_Definition
Returns an array of method definitions.
| Type | Description |
|---|---|
| \Zend_Server_Definition |

getRequest() : \Zend_Json_Server_RequestGet JSON-RPC request object
| Type | Description |
|---|---|
| \Zend_Json_Server_Request |

getResponse() : \Zend_Json_Server_ResponseGet response object
| Type | Description |
|---|---|
| \Zend_Json_Server_Response |

getServiceMap() : \Zend_Json_Server_SmdRetrieve SMD object
| Type | Description |
|---|---|
| \Zend_Json_Server_Smd |

handle(\Zend_Json_Server_Request $request = false) : null | \Zend_Json_Server_ResponseHandle request
Requests may be passed in, or the server may automagically determine the request based on defaults. Dispatches server request to appropriate method and returns a response
| Name | Type | Description |
|---|---|---|
| $request | \Zend_Json_Server_Request |
| Type | Description |
|---|---|
| null | \Zend_Json_Server_Response |

loadFunctions(array | \Zend_Server_Definition $definition) : voidLoad function definitions
Used for persistence; loads a construct as returned by getFunctions().
| Name | Type | Description |
|---|---|---|
| $definition | array | \Zend_Server_Definition |

lowerCase( $value, string $key) : string
Lowercase's a string by reference
| Name | Type | Description |
|---|---|---|
| $value | ||
| $key | string |
| Type | Description |
|---|---|
| string | Lower cased string |

setAutoEmitResponse(bool $flag) : \Zend_Json_ServerSet flag indicating whether or not to auto-emit response
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_Json_Server |

setClass(string $class, string $namespace = '', mixed $argv = null) : \Zend_Json_ServerRegister a class with the 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.
| Name | Type | Description |
|---|---|---|
| $class | string | |
| $namespace | string | Ignored |
| $argv | mixed | Ignored |
| Type | Description |
|---|---|
| \Zend_Json_Server |

setRequest(\Zend_Json_Server_Request $request) : \Zend_Json_ServerSet request object
| Name | Type | Description |
|---|---|---|
| $request | \Zend_Json_Server_Request |
| Type | Description |
|---|---|
| \Zend_Json_Server |

setResponse(\Zend_Json_Server_Response $response) : \Zend_Json_ServerSet response object
| Name | Type | Description |
|---|---|---|
| $response | \Zend_Json_Server_Response |
| Type | Description |
|---|---|
| \Zend_Json_Server |