Json/Server.php

Show: inherited
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 [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

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

Constant  VERSION_1 = '1.0'
Constant  VERSION_2 = '2.0'

Properties

Propertyprotectedbool $_autoEmitResponse = true

Flag: whether or not to auto-emit the response

Default valuetrueDetails
Type
bool
Propertyprotectedbool $_overwriteExistingMethods = true
<p>Flag; allow overwriting existing methods when creating server definition</p>

Default valuetrueDetails
Type
bool
Propertyprotected\Zend_Json_Server_Request $_request =

Request object

Propertyprotected\Zend_Json_Server_Response $_response =

Response object

Propertyprotected\Zend_Json_Server_Smd $_serviceMap =

SMD object

Details
Type
\Zend_Json_Server_Smd
Propertyprotectedarray $_smdMethods =

SMD class accessors

Details
Type
array
Propertyprotected\Zend_Server_Description $_table =

Details
Type
\Zend_Server_Description
Propertyprotectedarray $magic_methods = array('__call', '__clone', '__construct', '__destruct', '__get', '__isset', '__set', '__set_state', '__sleep', '__tostring', '__unset', '__wakeup')
staticinherited

<p>List of PHP magic methods (lowercased)</p> 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
Name Type Description
$method string
$args array
Returns
Type Description
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
Name Type Description
$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
Name Type Description
$reflection \Zend_Server_Reflection_Function_Abstract
Returns
Type Description
\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
Name Type Description
$reflection \Zend_Server_Reflection_Function_Abstract
$class null | string | object
Returns
Type Description
\Zend_Server_Method_Definition
Throws
Exception Description
\Zend_Server_Exception on duplicate entry
methodprotected_dispatch(\Zend_Server_Method_Definition $invocable, array $params) : mixed
inherited

Dispatch method

Inherited from: \Zend_Server_Abstract::_dispatch()
Parameters
Name Type Description
$invocable \Zend_Server_Method_Definition
$params array
Returns
Type Description
mixed
methodprotected_fixType(string $type) : string

Translate PHP type to JSON type

Parameters
Name Type Description
$type string
Returns
Type Description
string
methodprotected_getDefaultParams(array $args, array $params) : array

Get default params from signature

Parameters
Name Type Description
$args array
$params array
Returns
Type Description
array
methodprotected_getParams(\Zend_Server_Reflection_Function_Abstract $method) : string | array

Get method param type

Parameters
Name Type Description
$method \Zend_Server_Reflection_Function_Abstract
Returns
Type Description
string | array
methodprotected_getReadyResponse() : \Zend_Json_Server_Response

Set response state

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

Get method return type

Parameters
Name Type Description
$method \Zend_Server_Reflection_Function_Abstract
Returns
Type Description
string | array
methodprotected_getSmdMethods() : array

Retrieve list of allowed SMD methods for proxying

Returns
Type Description
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
Name Type Description
$function string | array

Valid PHP callback

$namespace string

Ignored

Returns
Type Description
\Zend_Json_Server
methodpublicautoEmitResponse() : bool

Will we auto-emit the response?

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

Indicate fault response

Parameters
Name Type Description
$fault string
$code int
$data
Returns
Type Description
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
Type Description
\Zend_Server_Definition
methodpublicgetRequest() : \Zend_Json_Server_Request

Get JSON-RPC request object

Returns
Type Description
\Zend_Json_Server_Request
methodpublicgetResponse() : \Zend_Json_Server_Response

Get response object

Returns
Type Description
\Zend_Json_Server_Response
methodpublicgetServiceMap() : \Zend_Json_Server_Smd

Retrieve SMD object

Returns
Type Description
\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
Name Type Description
$request \Zend_Json_Server_Request
Returns
Type Description
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
Name Type Description
$definition array | \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
Name Type Description
$value
$key string
Returns
Type Description
string Lower cased string
methodpublicsetAutoEmitResponse(bool $flag) : \Zend_Json_Server

Set flag indicating whether or not to auto-emit response

Parameters
Name Type Description
$flag bool
Returns
Type Description
\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
Name Type Description
$class string
$namespace string

Ignored

$argv mixed

Ignored

Returns
Type Description
\Zend_Json_Server
methodpublicsetPersistence(int $mode) : void

Set server persistence

Parameters
Name Type Description
$mode int
methodpublicsetRequest(\Zend_Json_Server_Request $request) : \Zend_Json_Server

Set request object

Parameters
Name Type Description
$request \Zend_Json_Server_Request
Returns
Type Description
\Zend_Json_Server
methodpublicsetResponse(\Zend_Json_Server_Response $response) : \Zend_Json_Server

Set response object

Parameters
Name Type Description
$response \Zend_Json_Server_Response
Returns
Type Description
\Zend_Json_Server
Documentation was generated by phpDocumentor 2.0.0a8.