Server.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  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.
  14. *
  15. * @category Zend
  16. * @package Zend_Amf
  17. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. */
  20. /** Zend_Server_Interface */
  21. require_once 'Zend/Server/Interface.php';
  22. /** Zend_Server_Reflection */
  23. require_once 'Zend/Server/Reflection.php';
  24. /** Zend_Amf_Constants */
  25. require_once 'Zend/Amf/Constants.php';
  26. /** Zend_Amf_Value_MessageBody */
  27. require_once 'Zend/Amf/Value/MessageBody.php';
  28. /** Zend_Amf_Value_MessageHeader */
  29. require_once 'Zend/Amf/Value/MessageHeader.php';
  30. /** Zend_Amf_Value_Messaging_CommandMessage */
  31. require_once 'Zend/Amf/Value/Messaging/CommandMessage.php';
  32. /** Zend_Amf_Parse_TypeLoader */
  33. require_once 'Zend/Amf/Parse/TypeLoader.php';
  34. /**
  35. * An AMF gateway server implementation to allow the connection of the Adobe Flash Player to
  36. * Zend Framework
  37. *
  38. * @todo Make the relection methods cache and autoload.
  39. * @package Zend_Amf
  40. * @subpackage Server
  41. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  42. * @license http://framework.zend.com/license/new-bsd New BSD License
  43. */
  44. class Zend_Amf_Server implements Zend_Server_Interface
  45. {
  46. /**
  47. * Array of dispatchables
  48. * @var array
  49. */
  50. protected $_methods = array();
  51. /**
  52. * Array of directories to search for loading classes dynamically
  53. * @var array
  54. */
  55. protected $_directories = array();
  56. /**
  57. * @var bool Production flag; whether or not to return exception messages
  58. */
  59. protected $_production = true;
  60. /**
  61. * Request processed
  62. * @var null|Zend_Amf_Request
  63. */
  64. protected $_request = null;
  65. /**
  66. * Class to use for responses
  67. * @var null|Zend_Amf_Response
  68. */
  69. protected $_response;
  70. /**
  71. * Dispatch table of name => method pairs
  72. * @var array
  73. */
  74. protected $_table = array();
  75. /**
  76. *
  77. * @var bool session flag; whether or not to add a session to each response.
  78. */
  79. protected $_session = false;
  80. /**
  81. * Namespace allows all AMF calls to not clobber other php session variables
  82. * @var Zend_Session_NameSpace default session namespace zend_amf
  83. */
  84. protected $_sesionNamespace = 'zend_amf';
  85. /**
  86. * Set the default session.name if php_
  87. * @var unknown_type
  88. */
  89. protected $_sessionName = 'PHPSESSID';
  90. /**
  91. * Set production flag
  92. *
  93. * @param bool $flag
  94. * @return Zend_Amf_Server
  95. */
  96. public function setProduction($flag)
  97. {
  98. $this->_production = (bool) $flag;
  99. return $this;
  100. }
  101. /**
  102. * Whether or not the server is in production
  103. *
  104. * @return bool
  105. */
  106. public function isProduction()
  107. {
  108. return $this->_production;
  109. }
  110. /**
  111. * @param namespace of all incoming sessions defaults to Zend_Amf
  112. * @return Zend_Amf_Server
  113. */
  114. public function setSession($namespace = 'Zend_Amf')
  115. {
  116. require_once 'Zend/Session.php';
  117. $this->_session = true;
  118. $this->_sesionNamespace = new Zend_Session_Namespace($namespace);
  119. return $this;
  120. }
  121. /**
  122. * Whether of not the server is using sessions
  123. * @return bool
  124. */
  125. public function isSession()
  126. {
  127. return $this->_session;
  128. }
  129. /**
  130. * Loads a remote class or method and executes the function and returns
  131. * the result
  132. *
  133. * @param string $method Is the method to execute
  134. * @param mixed $param values for the method
  135. * @return mixed $response the result of executing the method
  136. * @throws Zend_Amf_Server_Exception
  137. */
  138. protected function _dispatch($method, $params = null, $source = null)
  139. {
  140. if($source) {
  141. if(($mapped = Zend_Amf_Parse_TypeLoader::getMappedClassName($source)) !== false) {
  142. $source = $mapped;
  143. }
  144. }
  145. $qualifiedName = empty($source) ? $method : $source.".".$method;
  146. if (!isset($this->_table[$qualifiedName])) {
  147. // if source is null a method that was not defined was called.
  148. if ($source) {
  149. $classPath = array();
  150. $path = explode('.', $source);
  151. $className = array_pop($path);
  152. $uriclasspath = implode('/', $path);
  153. // Take the user supplied directories and add the unique service path to the end.
  154. foreach ($this->_directories as $dir) {
  155. $classPath[] = $dir . $uriclasspath;
  156. }
  157. require_once('Zend/Loader.php');
  158. try {
  159. Zend_Loader::loadClass($className, $classPath);
  160. } catch (Exception $e) {
  161. require_once 'Zend/Amf/Server/Exception.php';
  162. throw new Zend_Amf_Server_Exception('Class "' . $className . '" does not exist');
  163. }
  164. // Add the new loaded class to the server.
  165. $this->setClass($className, $source);
  166. } else {
  167. require_once 'Zend/Amf/Server/Exception.php';
  168. throw new Zend_Amf_Server_Exception('Method "' . $method . '" does not exist');
  169. }
  170. }
  171. $info = $this->_table[$qualifiedName];
  172. $argv = $info->getInvokeArguments();
  173. if (0 < count($argv)) {
  174. $params = array_merge($params, $argv);
  175. }
  176. if ($info instanceof Zend_Server_Reflection_Function) {
  177. $func = $info->getName();
  178. $return = call_user_func_array($func, $params);
  179. } elseif ($info instanceof Zend_Server_Reflection_Method) {
  180. // Get class
  181. $class = $info->getDeclaringClass()->getName();
  182. if ('static' == $info->isStatic()) {
  183. // for some reason, invokeArgs() does not work the same as
  184. // invoke(), and expects the first argument to be an object.
  185. // So, using a callback if the method is static.
  186. $return = call_user_func_array(array($class, $info->getName()), $params);
  187. } else {
  188. // Object methods
  189. try {
  190. $object = $info->getDeclaringClass()->newInstance();
  191. } catch (Exception $e) {
  192. require_once 'Zend/Amf/Server/Exception.php';
  193. throw new Zend_Amf_Server_Exception('Error instantiating class ' . $class . ' to invoke method ' . $info->getName(), 621);
  194. }
  195. $return = $info->invokeArgs($object, $params);
  196. }
  197. } else {
  198. require_once 'Zend/Amf/Server/Exception.php';
  199. throw new Zend_Amf_Server_Exception('Method missing implementation ' . get_class($info));
  200. }
  201. return $return;
  202. }
  203. /**
  204. * Handles each of the 11 different command message types.
  205. *
  206. * A command message is a flex.messaging.messages.CommandMessage
  207. *
  208. * @see Zend_Amf_Value_Messaging_CommandMessage
  209. * @param Zend_Amf_Value_Messaging_CommandMessage $message
  210. * @return Zend_Amf_Value_Messaging_AcknowledgeMessage
  211. */
  212. protected function _loadCommandMessage(Zend_Amf_Value_Messaging_CommandMessage $message)
  213. {
  214. switch($message->operation) {
  215. case Zend_Amf_Value_Messaging_CommandMessage::CLIENT_PING_OPERATION :
  216. require_once 'Zend/Amf/Value/Messaging/AcknowledgeMessage.php';
  217. $return = new Zend_Amf_Value_Messaging_AcknowledgeMessage($message);
  218. break;
  219. default :
  220. require_once 'Zend/Amf/Server/Exception.php';
  221. throw new Zend_Amf_Server_Exception('CommandMessage::' . $message->operation . ' not implemented');
  222. break;
  223. }
  224. return $return;
  225. }
  226. /**
  227. * Takes the deserialized AMF request and performs any operations.
  228. *
  229. * @todo should implement and SPL observer pattern for custom AMF headers
  230. * @todo implement AMF header authentication
  231. * @param Zend_Amf_Request $request
  232. * @return Zend_Amf_Response
  233. * @throws Zend_Amf_server_Exception|Exception
  234. */
  235. protected function _handle(Zend_Amf_Request $request)
  236. {
  237. // Get the object encoding of the request.
  238. $objectEncoding = $request->getObjectEncoding();
  239. // create a response object to place the output from the services.
  240. $response = $this->getResponse();
  241. // set reponse encoding
  242. $response->setObjectEncoding($objectEncoding);
  243. $responseBody = $request->getAmfBodies();
  244. // Iterate through each of the service calls in the AMF request
  245. foreach($responseBody as $body)
  246. {
  247. try {
  248. if ($objectEncoding == Zend_Amf_Constants::AMF0_OBJECT_ENCODING) {
  249. // AMF0 Object Encoding
  250. $targetURI = $body->getTargetURI();
  251. // Split the target string into its values.
  252. $source = substr($targetURI, 0, strrpos($targetURI, '.'));
  253. if ($source) {
  254. // Break off method name from namespace into source
  255. $method = substr(strrchr($targetURI, '.'), 1);
  256. $return = $this->_dispatch($method, $body->getData(), $source);
  257. } else {
  258. // Just have a method name.
  259. $return = $this->_dispatch($targetURI, $body->getData());
  260. }
  261. } else {
  262. // AMF3 read message type
  263. $message = $body->getData();
  264. if ($message instanceof Zend_Amf_Value_Messaging_CommandMessage) {
  265. // async call with command message
  266. $return = $this->_loadCommandMessage($message);
  267. } elseif ($message instanceof Zend_Amf_Value_Messaging_RemotingMessage) {
  268. require_once 'Zend/Amf/Value/Messaging/AcknowledgeMessage.php';
  269. $return = new Zend_Amf_Value_Messaging_AcknowledgeMessage($message);
  270. $return->body = $this->_dispatch($message->operation, $message->body, $message->source);
  271. } else {
  272. // Amf3 message sent with netConnection
  273. $targetURI = $body->getTargetURI();
  274. // Split the target string into its values.
  275. $source = substr($targetURI, 0, strrpos($targetURI, '.'));
  276. if ($source) {
  277. // Break off method name from namespace into source
  278. $method = substr(strrchr($targetURI, '.'), 1);
  279. $return = $this->_dispatch($method, $body->getData(), $source);
  280. } else {
  281. // Just have a method name.
  282. $return = $this->_dispatch($targetURI, $body->getData());
  283. }
  284. }
  285. }
  286. $responseType = Zend_AMF_Constants::RESULT_METHOD;
  287. } catch (Exception $e) {
  288. switch ($objectEncoding) {
  289. case Zend_Amf_Constants::AMF0_OBJECT_ENCODING :
  290. $return = array(
  291. 'description' => ($this->isProduction()) ? '' : $e->getMessage(),
  292. 'detail' => ($this->isProduction()) ? '' : $e->getTraceAsString(),
  293. 'line' => ($this->isProduction()) ? 0 : $e->getLine(),
  294. 'code' => $e->getCode(),
  295. );
  296. break;
  297. case Zend_Amf_Constants::AMF3_OBJECT_ENCODING :
  298. require_once 'Zend/Amf/Value/Messaging/ErrorMessage.php';
  299. $return = new Zend_Amf_Value_Messaging_ErrorMessage($message);
  300. $return->faultString = $this->isProduction() ? '' : $e->getMessage();
  301. $return->faultCode = $e->getCode();
  302. $return->faultDetail = $this->isProduction() ? '' : $e->getTraceAsString();
  303. break;
  304. }
  305. $responseType = Zend_AMF_Constants::STATUS_METHOD;
  306. }
  307. $responseURI = $body->getResponseURI() . $responseType;
  308. $newBody = new Zend_Amf_Value_MessageBody($responseURI, null, $return);
  309. $response->addAmfBody($newBody);
  310. }
  311. // Add a session header to the body if session is requested.
  312. if($this->isSession()) {
  313. $currentID = session_id();
  314. $joint = "?";
  315. if(isset($_SERVER['QUERY_STRING'])) {
  316. if(!strpos($_SERVER['QUERY_STRING'], $currentID) !== FALSE) {
  317. if(strrpos($_SERVER['QUERY_STRING'], "?") !== FALSE) {
  318. $joint = "&";
  319. }
  320. }
  321. }
  322. // create a new AMF message header with the session id as a variable.
  323. $sessionValue = $joint . $this->_sessionName . "=" . $currentID;
  324. $sessionHeader = new Zend_Amf_Value_MessageHeader("AppendToGatewayUrl", false, $sessionValue);
  325. $response->addAmfHeader($sessionHeader);
  326. }
  327. // serialize the response and return serialized body.
  328. $response->finalize();
  329. }
  330. /**
  331. * Handle an AMF call from the gateway.
  332. *
  333. * @param null|Zend_Amf_Request $request Optional
  334. * @return Zend_Amf_Response
  335. */
  336. public function handle($request = null)
  337. {
  338. // Check if request was passed otherwise get it from the server
  339. if (is_null($request) || !$request instanceof Zend_Amf_Request) {
  340. $request = $this->getRequest();
  341. } else {
  342. $this->setRequest($request);
  343. }
  344. if ($this->isSession()) {
  345. // Check if a session is being sent from the amf call
  346. if (isset($_COOKIE[$this->_sessionName])) {
  347. session_id($_COOKIE[$this->_sessionName]);
  348. }
  349. }
  350. // Check for errors that may have happend in deserialization of Request.
  351. try {
  352. // Take converted PHP objects and handle service call.
  353. // Serialize to Zend_Amf_response for output stream
  354. $this->_handle($request);
  355. $response = $this->getResponse();
  356. } catch (Exception $e) {
  357. // Handle any errors in the serialization and service calls.
  358. require_once 'Zend/Amf/Server/Exception.php';
  359. throw new Zend_Amf_Server_Exception('Handle error: ' . $e->getMessage() . ' ' . $e->getLine());
  360. }
  361. // Return the Amf serialized output string
  362. return $response;
  363. }
  364. /**
  365. * Set request object
  366. *
  367. * @param string|Zend_Amf_Request $request
  368. * @return Zend_Amf_Server
  369. */
  370. public function setRequest($request)
  371. {
  372. if (is_string($request) && class_exists($request)) {
  373. $request = new $request();
  374. if (!$request instanceof Zend_Amf_Request) {
  375. require_once 'Zend/Amf/Server/Exception.php';
  376. throw new Zend_Amf_Server_Exception('Invalid request class');
  377. }
  378. } elseif (!$request instanceof Zend_Amf_Request) {
  379. require_once 'Zend/Amf/Server/Exception.php';
  380. throw new Zend_Amf_Server_Exception('Invalid request object');
  381. }
  382. $this->_request = $request;
  383. return $this;
  384. }
  385. /**
  386. * Return currently registered request object
  387. *
  388. * @return null|Zend_Amf_Request
  389. */
  390. public function getRequest()
  391. {
  392. if (null === $this->_request) {
  393. require_once 'Zend/Amf/Request/Http.php';
  394. $this->setRequest(new Zend_Amf_Request_Http());
  395. }
  396. return $this->_request;
  397. }
  398. /**
  399. * Public access method to private Zend_Amf_Server_Response refrence
  400. *
  401. * @param string|Zend_Amf_Server_Response $response
  402. * @return Zend_Amf_Server
  403. */
  404. public function setResponse($response)
  405. {
  406. if (is_string($response) && class_exists($response)) {
  407. $response = new $response();
  408. if (!$response instanceof Zend_Amf_Response) {
  409. require_once 'Zend/Amf/Server/Exception.php';
  410. throw new Zend_Amf_Server_Exception('Invalid response class');
  411. }
  412. } elseif (!$response instanceof Zend_Amf_Response) {
  413. require_once 'Zend/Amf/Server/Exception.php';
  414. throw new Zend_Amf_Server_Exception('Invalid response object');
  415. }
  416. $this->_response = $response;
  417. return $this;
  418. }
  419. /**
  420. * get a refrence to the Zend_Amf_response instance
  421. *
  422. * @return Zend_Amf_Server_Response
  423. */
  424. public function getResponse()
  425. {
  426. if (null === ($response = $this->_response)) {
  427. require_once 'Zend/Amf/Response/Http.php';
  428. $this->setResponse(new Zend_Amf_Response_Http());
  429. }
  430. return $this->_response;
  431. }
  432. /**
  433. * Attach a class or object to the server
  434. *
  435. * Class may be either a class name or an instantiated object. Reflection
  436. * is done on the class or object to determine the available public
  437. * methods, and each is attached to the server as and available method. If
  438. * a $namespace has been provided, that namespace is used to prefix
  439. * AMF service call.
  440. *
  441. * @param string|object $class
  442. * @param string $namespace Optional
  443. * @param mixed $arg Optional arguments to pass to a method
  444. * @return Zend_Amf_Server
  445. * @throws Zend_Amf_Server_Exception on invalid input
  446. */
  447. public function setClass($class, $namespace = '', $argv = null)
  448. {
  449. if (is_string($class) && !class_exists($class)){
  450. require_once 'Zend/Amf/Server/Exception.php';
  451. throw new Zend_Amf_Server_Exception('Invalid method or class');
  452. } elseif (!is_string($class) && !is_object($class)) {
  453. require_once 'Zend/Amf/Server/Exception.php';
  454. throw new Zend_Amf_Server_Exception('Invalid method or class; must be a classname or object');
  455. }
  456. $argv = null;
  457. if (2 < func_num_args()) {
  458. $argv = array_slice(func_get_args(), 2);
  459. }
  460. // Use the class name as the name space by default.
  461. if ($namespace == '') {
  462. $namespace = is_object($class) ? get_class($class) : $class;
  463. }
  464. $this->_methods[] = Zend_Server_Reflection::reflectClass($class, $argv, $namespace);
  465. $this->_buildDispatchTable();
  466. return $this;
  467. }
  468. /**
  469. * Attach a function to the server
  470. *
  471. * Additional arguments to pass to the function at dispatch may be passed;
  472. * any arguments following the namespace will be aggregated and passed at
  473. * dispatch time.
  474. *
  475. * @param string|array $function Valid callback
  476. * @param string $namespace Optional namespace prefix
  477. * @return Zend_Amf_Server
  478. * @throws Zend_Amf_Server_Exception
  479. */
  480. public function addFunction($function, $namespace = '')
  481. {
  482. if (!is_string($function) && !is_array($function)) {
  483. require_once 'Zend/Amf/Server/Exception.php';
  484. throw new Zend_Amf_Server_Exception('Unable to attach function');
  485. }
  486. $argv = null;
  487. if (2 < func_num_args()) {
  488. $argv = array_slice(func_get_args(), 2);
  489. }
  490. $function = (array) $function;
  491. foreach ($function as $func) {
  492. if (!is_string($func) || !function_exists($func)) {
  493. require_once 'Zend/Amf/Server/Exception.php';
  494. throw new Zend_Amf_Server_Exception('Unable to attach function');
  495. }
  496. $this->_methods[] = Zend_Server_Reflection::reflectFunction($func, $argv, $namespace);
  497. }
  498. $this->_buildDispatchTable();
  499. return $this;
  500. }
  501. /**
  502. * Creates an array of directories in which services can reside.
  503. *
  504. * @param string $dir
  505. */
  506. public function addDirectory($dir)
  507. {
  508. $this->_directories[] = $dir;
  509. }
  510. /**
  511. * Returns an array of directories that can hold services.
  512. *
  513. * @return array
  514. */
  515. public function getDirectory()
  516. {
  517. return $this->_directories;
  518. }
  519. /**
  520. * (Re)Build the dispatch table
  521. *
  522. * The dispatch table consists of a an array of method name =>
  523. * Zend_Server_Reflection_Function_Abstract pairs
  524. *
  525. * @return void
  526. */
  527. protected function _buildDispatchTable()
  528. {
  529. $table = array();
  530. foreach ($this->_methods as $key => $dispatchable) {
  531. if ($dispatchable instanceof Zend_Server_Reflection_Function_Abstract) {
  532. $ns = $dispatchable->getNamespace();
  533. $name = $dispatchable->getName();
  534. $name = empty($ns) ? $name : $ns . '.' . $name;
  535. if (isset($table[$name])) {
  536. require_once 'Zend/Amf/Server/Exception.php';
  537. throw new Zend_Amf_Server_Exception('Duplicate method registered: ' . $name);
  538. }
  539. $table[$name] = $dispatchable;
  540. continue;
  541. }
  542. if ($dispatchable instanceof Zend_Server_Reflection_Class) {
  543. foreach ($dispatchable->getMethods() as $method) {
  544. $ns = $method->getNamespace();
  545. $name = $method->getName();
  546. $name = empty($ns) ? $name : $ns . '.' . $name;
  547. if (isset($table[$name])) {
  548. require_once 'Zend/Amf/Server/Exception.php';
  549. throw new Zend_Amf_Server_Exception('Duplicate method registered: ' . $name);
  550. }
  551. $table[$name] = $method;
  552. continue;
  553. }
  554. }
  555. }
  556. $this->_table = $table;
  557. }
  558. /**
  559. * Raise a server fault
  560. *
  561. * Unimplemented
  562. *
  563. * @param string|Exception $fault
  564. * @return void
  565. */
  566. public function fault($fault = null, $code = 404)
  567. {
  568. }
  569. /**
  570. * Returns a list of registered methods
  571. *
  572. * Returns an array of dispatchables (Zend_Server_Reflection_Function,
  573. * _Method, and _Class items).
  574. *
  575. * @return array
  576. */
  577. public function getFunctions()
  578. {
  579. return $this->_table;
  580. }
  581. /**
  582. * Set server persistence
  583. *
  584. * Unimplemented
  585. *
  586. * @param mixed $mode
  587. * @return void
  588. */
  589. public function setPersistence($mode)
  590. {
  591. }
  592. /**
  593. * Load server definition
  594. *
  595. * Unimplemented
  596. *
  597. * @param array $definition
  598. * @return void
  599. */
  600. public function loadFunctions($definition)
  601. {
  602. }
  603. /**
  604. * Map ActionScript classes to PHP classes
  605. *
  606. * @param string $asClass
  607. * @param string $phpClass
  608. * @return Zend_Amf_Server
  609. */
  610. public function setClassMap($asClass, $phpClass)
  611. {
  612. require_once 'Zend/Amf/Parse/TypeLoader.php';
  613. Zend_Amf_Parse_TypeLoader::setMapping($asClass, $phpClass);
  614. return $this;
  615. }
  616. /**
  617. * List all available methods
  618. *
  619. * Returns an array of method names.
  620. *
  621. * @return array
  622. */
  623. public function listMethods()
  624. {
  625. return array_keys($this->_table);
  626. }
  627. }