Json/Server.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-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

Package: Zend\Json
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

>VConstant  VERSION_1 = '1.0'
>VConstant  VERSION_2 = '2.0'

Properties

>VPropertyprotectedbool $_autoEmitResponse = true
Flag: whether or not to auto-emit the response
Default valuetrueDetails
Type
bool
>VPropertyprotectedbool $_overwriteExistingMethods = true

Flag; allow overwriting existing methods when creating server definition

Default valuetrueDetails
Type
bool
>VPropertyprotected\Zend_Json_Server_Request $_request
Request object
>VPropertyprotected\Zend_Json_Server_Response $_response
Response object
>VPropertyprotected\Zend_Json_Server_Smd $_serviceMap
SMD object
>VPropertyprotectedarray $_smdMethods
SMD class accessors
Details
Type
array
>VPropertyprotected\Zend_Server_Description $_table
Details
Type
\Zend_Server_Description
>VPropertyprotectedarray $magic_methods = array('__call', '__clone', '__construct', '__destruct', '__get', '__isset', '__set', '__set_state', '__sleep', '__tostring', '__unset', '__wakeup')
staticinherited

List of PHP magic methods (lowercased)

Inherited from: \Zend_Server_Abstract::$$magic_methods
Default valuearray('__call', '__clone', '__construct', '__destruct', '__get', '__isset', '__set', '__set_state', '__sleep', '__tostring', '__unset', '__wakeup')Details
Type
array
Inherited_from
\Zend_Server_Abstract::$$magic_methods  

Methods

methodpublic__call(string $method, array $args) : mixed

Overload to accessors of SMD object

Parameters
NameTypeDescription
$methodstring
$argsarray
Returns
TypeDescription
mixed
methodpublic__construct() : void
inherited

Constructor

Inherited from: \Zend_Server_Abstract::__construct()

Setup server description

methodprotected_addMethodServiceMap(\Zend_Server_Reflection_Function $method) : void

Add service method to service map

Parameters
NameTypeDescription
$method\Zend_Server_Reflection_Function
methodprotected_buildCallback(\Zend_Server_Reflection_Function_Abstract $reflection) : \Zend_Server_Method_Callback
inherited

Build callback for method signature

Inherited from: \Zend_Server_Abstract::_buildCallback()
Parameters
NameTypeDescription
$reflection\Zend_Server_Reflection_Function_Abstract
Returns
TypeDescription
\Zend_Server_Method_Callback
methodprotected_buildSignature(\Zend_Server_Reflection_Function_Abstract $reflection, null | string | object $class = null) : \Zend_Server_Method_Definition
inherited

Build a method signature

Inherited from: \Zend_Server_Abstract::_buildSignature()
Parameters
NameTypeDescription
$reflection\Zend_Server_Reflection_Function_Abstract
$classnull | string | object
Returns
TypeDescription
\Zend_Server_Method_Definition
Throws
ExceptionDescription
\Zend_Server_Exceptionon duplicate entry
methodprotected_dispatch(\Zend_Server_Method_Definition $invocable, array $params) : mixed
inherited

Dispatch method

Inherited from: \Zend_Server_Abstract::_dispatch()
Parameters
NameTypeDescription
$invocable\Zend_Server_Method_Definition
$paramsarray
Returns
TypeDescription
mixed
methodprotected_fixType(string $type) : string

Translate PHP type to JSON type

Parameters
NameTypeDescription
$typestring
Returns
TypeDescription
string
methodprotected_getDefaultParams(array $args, array $params) : array

Get default params from signature

Parameters
NameTypeDescription
$argsarray
$paramsarray
Returns
TypeDescription
array
methodprotected_getParams(\Zend_Server_Reflection_Function_Abstract $method) : string | array

Get method param type

Parameters
NameTypeDescription
$method\Zend_Server_Reflection_Function_Abstract
Returns
TypeDescription
string | array
methodprotected_getReadyResponse() : \Zend_Json_Server_Response

Set response state

Returns
TypeDescription
\Zend_Json_Server_Response
methodprotected_getReturnType(\Zend_Server_Reflection_Function_Abstract $method) : string | array

Get method return type

Parameters
NameTypeDescription
$method\Zend_Server_Reflection_Function_Abstract
Returns
TypeDescription
string | array
methodprotected_getSmdMethods() : array

Retrieve list of allowed SMD methods for proxying

Returns
TypeDescription
array
methodprotected_handle() : void

Internal method for handling request

methodpublicaddFunction(string | array $function, string $namespace = '') : \Zend_Json_Server

Attach a function or callback to the server

Namespacing is primarily for xmlrpc, but may be used with other implementations to prevent naming collisions.

Parameters
NameTypeDescription
$functionstring | array

Valid PHP callback

$namespacestring

Ignored

Returns
TypeDescription
\Zend_Json_Server
methodpublicautoEmitResponse() : bool

Will we auto-emit the response?

Returns
TypeDescription
bool
methodpublicfault(string $fault = null, int $code = 404,  $data = null) : false

Indicate fault response

Parameters
NameTypeDescription
$faultstring
$codeint
$data
Returns
TypeDescription
false
methodpublicgetFunctions() : \Zend_Server_Definition
inherited

Returns a list of registered methods

Inherited from: \Zend_Server_Abstract::getFunctions()

Returns an array of method definitions.

Returns
TypeDescription
\Zend_Server_Definition
methodpublicgetRequest() : \Zend_Json_Server_Request

Get JSON-RPC request object

Returns
TypeDescription
\Zend_Json_Server_Request
methodpublicgetResponse() : \Zend_Json_Server_Response

Get response object

Returns
TypeDescription
\Zend_Json_Server_Response
methodpublicgetServiceMap() : \Zend_Json_Server_Smd

Retrieve SMD object

Returns
TypeDescription
\Zend_Json_Server_Smd
methodpublichandle(\Zend_Json_Server_Request $request = false) : null | \Zend_Json_Server_Response

Handle 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

Parameters
NameTypeDescription
$request\Zend_Json_Server_Request
Returns
TypeDescription
null | \Zend_Json_Server_Response
methodpublicloadFunctions(array | \Zend_Server_Definition $definition) : void

Load function definitions

Used for persistence; loads a construct as returned by getFunctions().

Parameters
NameTypeDescription
$definitionarray | \Zend_Server_Definition
methodpubliclowerCase( $value, string $key) : string
staticinherited

Lowercase a string

Inherited from: \Zend_Server_Abstract::lowerCase()

Lowercase's a string by reference

Parameters
NameTypeDescription
$value
$keystring
Returns
TypeDescription
stringLower cased string
methodpublicsetAutoEmitResponse(bool $flag) : \Zend_Json_Server

Set flag indicating whether or not to auto-emit response

Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_Json_Server
methodpublicsetClass(string $class, string $namespace = '', mixed $argv = null) : \Zend_Json_Server

Register 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.

Parameters
NameTypeDescription
$classstring
$namespacestring

Ignored

$argvmixed

Ignored

Returns
TypeDescription
\Zend_Json_Server
methodpublicsetPersistence(int $mode) : void

Set server persistence

Parameters
NameTypeDescription
$modeint
methodpublicsetRequest(\Zend_Json_Server_Request $request) : \Zend_Json_Server

Set request object

Parameters
NameTypeDescription
$request\Zend_Json_Server_Request
Returns
TypeDescription
\Zend_Json_Server
methodpublicsetResponse(\Zend_Json_Server_Response $response) : \Zend_Json_Server

Set response object

Parameters
NameTypeDescription
$response\Zend_Json_Server_Response
Returns
TypeDescription
\Zend_Json_Server
Documentation was generated by phpDocumentor 2.0.0a12.