7
* This source file is subject to the new BSD license that is bundled
8
* with this package in the file LICENSE.txt.
9
* It is also available through the world-wide-web at this URL:
10
* http://framework.zend.com/license/new-bsd
11
* If you did not receive a copy of the license and are unable to
12
* obtain it through the world-wide-web, please send an email
13
* to license@zend.com so we can send you a copy immediately.
18
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
19
* @license http://framework.zend.com/license/new-bsd New BSD License
22
require_once 'Zend/Amf/Value/Messaging/AcknowledgeMessage.php';
23
require_once 'Zend/Amf/Value/Messaging/AsyncMessage.php';
24
require_once 'Zend/Amf/Value/Messaging/CommandMessage.php';
25
require_once 'Zend/Amf/Value/Messaging/ErrorMessage.php';
26
require_once 'Zend/Amf/Value/Messaging/RemotingMessage.php';
29
* Loads a local class and executes the instantiation of that class.
31
* @todo PHP 5.3 can drastically change this class w/ namespace and the new call_user_func w/ namespace
34
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
35
* @license http://framework.zend.com/license/new-bsd New BSD License
37
final class Zend_Amf_Parse_TypeLoader
40
* @var string callback class
42
public static $callbackClass;
45
* @var array AMF class map
47
public static $classMap = array (
48
'flex.messaging.messages.AcknowledgeMessage' => 'Zend_Amf_Value_Messaging_AcknowledgeMessage',
49
'flex.messaging.messages.ErrorMessage' => 'Zend_Amf_Value_Messaging_AsyncMessage',
50
'flex.messaging.messages.CommandMessage' => 'Zend_Amf_Value_Messaging_CommandMessage',
51
'flex.messaging.messages.ErrorMessage' => 'Zend_Amf_Value_Messaging_ErrorMessage',
52
'flex.messaging.messages.RemotingMessage' => 'Zend_Amf_Value_Messaging_RemotingMessage',
56
* @var array Default class map
58
protected static $_defaultClassMap = array(
59
'flex.messaging.messages.AcknowledgeMessage' => 'Zend_Amf_Value_Messaging_AcknowledgeMessage',
60
'flex.messaging.messages.ErrorMessage' => 'Zend_Amf_Value_Messaging_AsyncMessage',
61
'flex.messaging.messages.CommandMessage' => 'Zend_Amf_Value_Messaging_CommandMessage',
62
'flex.messaging.messages.ErrorMessage' => 'Zend_Amf_Value_Messaging_ErrorMessage',
63
'flex.messaging.messages.RemotingMessage' => 'Zend_Amf_Value_Messaging_RemotingMessage',
67
* Load the mapped class type into a callback.
69
* @param string $className
70
* @return object|false
72
public static function loadType($className)
76
$class = self::getMappedClassName($className);
77
if (!class_exists($class)) {
78
require_once 'Zend/Amf/Exception.php';
79
throw new Zend_Amf_Exception($className .' mapped class '. $class . ' is not defined');
86
* Looks up the supplied call name to its mapped class name
88
* @param string $className
91
public static function getMappedClassName($className)
93
$mappedName = array_search($className, self::$classMap);
99
$mappedName = array_search($className, array_flip(self::$classMap));
109
* Map PHP class names to ActionScript class names
111
* Allows users to map the class names of there action script classes
112
* to the equivelent php class name. Used in deserialization to load a class
113
* and serialiation to set the class name of the returned object.
115
* @param string $asClassName
116
* @param string $phpClassName
119
public static function setMapping($asClassName, $phpClassName)
121
self::$classMap[$asClassName] = $phpClassName;
129
public static function resetMap()
131
self::$classMap = self::$_defaultClassMap;