API Documentation

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 license@zend.com so we can send you a copy immediately.

category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Json  
version
$Id: Server.php 24461 2011-09-11 19:25:08Z padraic $  

\Zend_Json_Server

Zend_Server_Abstract

Extends from
\Zend_Server_Abstract
category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Json  
version
$Id: Abstract.php 23775 2011-03-01 17:25:24Z ralph $  

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'
Flag; allow overwriting existing methods when creating server definition

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

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

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

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

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

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
stringarray
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
stringarray
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

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 {@link getFunctions()}.

Parameters
Name Type Description
$definition array|\Zend_Server_Definition
methodpubliclowerCase(  $value, string $key ) : string
static

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
Details
deprecated
 
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 DocBlox 0.13.3.