Amf/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-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Amf
- Version
- $Id$
Package: Zend_Amf\ServerAn AMF gateway server implementation to allow the connection of the Adobe Flash Player to
Zend Framework
- Implements
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Todo
- Make the reflection methods cache and autoload.
Properties
array $_classAllowed = array()
Array of classes that can be called without being explicitly loaded
Keys are class names.
Default valuearray()
Details- Type
- array
bool $_production = true
Production flag; whether or not to return exception messages
Default valuetrue
Details- Type
- bool
bool $_session = false
session flag; whether or not to add a session to each response.
Default valuefalse
Details- Type
- bool
string $_sessionName = 'PHPSESSID'
Set the default session.name if php_
Default value'PHPSESSID'
Details- Type
- string
array $_table = array()
Dispatch table of name => method pairs
Default valuearray()
Details- Type
- array
Methods
_buildDispatchTable() : void
(Re)Build the dispatch table
The dispatch table consists of a an array of method name =>
Zend_Server_Reflection_Function_Abstract pairs
_checkAcl(string | object $object, string $function) : \unknown_type
Check if the ACL allows accessing the function or method
ParametersName | Type | Description |
---|
$object | string | object | Object or class being accessed |
---|
$function | string | Function or method being accessed |
---|
Returns _dispatch(string $method, $params = null, $source = null) : mixed
Loads a remote class or method and executes the function and returns
the result
ParametersName | Type | Description |
---|
$method | string | Is the method to execute |
---|
$params | | |
---|
$source | | |
---|
ReturnsType | Description |
---|
mixed | $response the result of executing the method |
Throws _errorMessage(int $objectEncoding, string $message, string $description, mixed $detail, int $code, int $line) : \Zend_Amf_Value_Messaging_ErrorMessage | array
Create appropriate error message
ParametersName | Type | Description |
---|
$objectEncoding | int | Current AMF encoding |
---|
$message | string | Message that was being processed when error happened |
---|
$description | string | Error description |
---|
$detail | mixed | Detailed data about the error |
---|
$code | int | Error code |
---|
$line | int | Error line |
---|
Returns _handle(\Zend_Amf_Request $request) : \Zend_Amf_Response
Takes the deserialized AMF request and performs any operations.
ParametersReturnsThrowsDetails- Todo
- should implement and SPL observer pattern for custom AMF headers
- Todo
- DescribeService support
_handleAuth(string $userid, string $password) : boolean
Handle AMF authentication
ParametersName | Type | Description |
---|
$userid | string | |
---|
$password | string | |
---|
Returns addDirectory(string $dir) : void
Creates an array of directories in which services can reside.
TODO: add support for prefixes?
ParametersName | Type | Description |
---|
$dir | string | |
---|
addFunction(string | array $function, string $namespace = '') : \Zend_Amf_Server
Attach a function to the server
Additional arguments to pass to the function at dispatch may be passed;
any arguments following the namespace will be aggregated and passed at
dispatch time.
ParametersName | Type | Description |
---|
$function | string | array | Valid callback |
---|
$namespace | string | Optional namespace prefix |
---|
ReturnsThrowsgetFunctions() : array
Returns a list of registered methods
Returns an array of dispatchables (Zend_Server_Reflection_Function,
_Method, and _Class items).
ReturnslistMethods() : array
List all available methods
Returns an array of method names.
ReturnssetAuth(\Zend_Amf_Auth_Abstract $auth) : \Zend_Amf_Server
Set authentication adapter
If the authentication adapter implements a "getAcl()" method, populate
the ACL of this instance with it (if none exists already).
ParametersReturnssetClass(string | object $class, string $namespace = '', $argv = null) : \Zend_Amf_Server
Attach a class or object to the server
Class may be either a class name or an instantiated object. Reflection
is done on the class or object to determine the available public
methods, and each is attached to the server as and available method. If
a $namespace has been provided, that namespace is used to prefix
AMF service call.
ParametersName | Type | Description |
---|
$class | string | object | |
---|
$namespace | string | Optional |
---|
$argv | | |
---|
ReturnsThrowssetClassMap(string $asClass, string $phpClass) : \Zend_Amf_Server
Map ActionScript classes to PHP classes
ParametersName | Type | Description |
---|
$asClass | string | |
---|
$phpClass | string | |
---|
Returns