Rest/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_Rest  
Subpackage
Server  
Version
$Id: Server.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Rest_Server

Package: Zend\Rest\Server

Implements
\Zend_Server_Interface
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

Propertyprotectedarray $_args = array()

Class Constructor Args

Default valuearray()Details
Type
array
Propertyprotectedstring $_encoding = 'UTF-8'

<p>Encoding</p>
Default value'UTF-8'Details
Type
string
Propertyprotectedarray $_functions = array()

<p>An array of Zend_Server_Reflect_Method</p>
Default valuearray()Details
Type
array
Propertyprotectedarray $_headers = array()

<p>Array of headers to send</p>
Default valuearray()Details
Type
array
Propertyprotectedstring $_method =

<p>Current Method</p>
Details
Type
string
Propertyprotected\Zend_Server_Reflection $_reflection = null

Default valuenullDetails
Type
\Zend_Server_Reflection
Propertyprotectedboolean $_returnResponse = false

Whether or not {@link handle()} should send output or return the response.

<p>Defaults to false</p>
Default valuefalseDetails
Type
boolean
Propertyprotectedarray $magicMethods = array('__construct', '__destruct', '__get', '__set', '__call', '__sleep', '__wakeup', '__isset', '__unset', '__tostring', '__clone', '__set_state')
static

<p>PHP's Magic Methods, these are ignored</p>
Default valuearray('__construct', '__destruct', '__get', '__set', '__call', '__sleep', '__wakeup', '__isset', '__unset', '__tostring', '__clone', '__set_state')Details
Type
array

Methods

methodpublic__construct() : void

Constructor

methodprotected_callObjectMethod(string $class, array $args) : mixed

Call an instance method of an object

Parameters
Name Type Description
$class string
$args array
Returns
Type Description
mixed
Throws
Exception Description
\Zend_Rest_Server_Exception For invalid class name
methodprotected_callStaticMethod(string $class, array $args) : mixed

Call a static class method and return the result

Parameters
Name Type Description
$class string
$args array
Returns
Type Description
mixed
methodprotected_handleScalar(string | int | boolean $value) : string

Handle a single value

Parameters
Name Type Description
$value string | int | boolean

Result value

Returns
Type Description
string XML Response
methodprotected_handleStruct(array | object $struct) : string

Handle an array or object result

Parameters
Name Type Description
$struct array | object

Result Value

Returns
Type Description
string XML Response
methodprotected_structValue(mixed $struct, \DOMDocument $dom, \DOMElement $parent) : void

Recursively iterate through a struct

Recursively iterates through an associative array or object's properties to build XML response.

Parameters
Name Type Description
$struct mixed
$dom \DOMDocument
$parent \DOMElement
methodpublicaddFunction(string $function, string $namespace = '') : void

Implement Zend_Server_Interface::addFunction()

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

Parameters
Name Type Description
$function string

Function Name

$namespace string

Function namespace (unused)

methodpublicfault( $exception = null, int $code = null) : \DOMDocument

Implement Zend_Server_Interface::fault()

Creates XML error response, returning DOMDocument with response.

Parameters
Name Type Description
$exception
$code int

Error Code

Returns
Type Description
\DOMDocument
methodpublicgetEncoding() : string

Get XML encoding

Returns
Type Description
string
methodpublicgetFunctions() : array

Implement Zend_Server_Interface::getFunctions()

Returns a server definition array as created using Zend_Server_Reflection. Can be used for server introspection, documentation, or persistence.

Returns
Type Description
array An array of Zend_Server_Reflection_Method's
methodpublicgetHeaders() : array

Retrieve any HTTP extra headers set by the server

Returns
Type Description
array
methodpublichandle(array $request = false) : string | void

Implement Zend_Server_Interface::handle()

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 array
Returns
Type Description
string | void
Throws
Exception Description
\Zend_Rest_Server_Exception
methodpublicloadFunctions(array $functions) : void

Implement Zend_Server_Interface::loadFunctions()

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

Parameters
Name Type Description
$functions array
Details
Todo
Implement  
methodpubliclowerCase(string $value, string $key) : string
static

Lowercase a string

Lowercase's a string by reference

Parameters
Name Type Description
$value string
$key string
Returns
Type Description
string Lower cased string
methodpublicreturnResponse(boolean $flag = null) : boolean | \Zend_Rest_Server

Whether or not to return a response

If called without arguments, returns the value of the flag. If called with an argument, sets the flag.

When 'return response' is true, handle() will not send output, but will instead return the response from the dispatched function/method.

Parameters
Name Type Description
$flag boolean
Returns
Type Description
boolean | \Zend_Rest_Server Returns Zend_Rest_Server when used to set the flag; returns boolean flag value otherwise.
methodpublicsetClass(string $classname, string $namespace = '', array $argv = array()) : void

Implement Zend_Server_Interface::setClass()

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
$classname string

Class name

$namespace string

Class namespace (unused)

$argv array

An array of Constructor Arguments

methodpublicsetEncoding(string $encoding) : \Zend_Rest_Server

Set XML encoding

Parameters
Name Type Description
$encoding string
Returns
Type Description
\Zend_Rest_Server
methodpublicsetPersistence(int $mode) : void

Implement Zend_Server_Interface::setPersistence()

Parameters
Name Type Description
$mode int
Details
Todo
Implement  
Documentation was generated by phpDocumentor 2.0.0a8.