Interface.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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_Server
  17. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. */
  20. /**
  21. * Zend_Server_Interface
  22. *
  23. * @category Zend
  24. * @package Zend_Server
  25. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  26. * @license http://framework.zend.com/license/new-bsd New BSD License
  27. * @version $Id: Interface.php 2504 2011-12-28 07:35:29Z liu21st $
  28. */
  29. interface Zend_Server_Interface
  30. {
  31. /**
  32. * Attach a function as a server method
  33. *
  34. * Namespacing is primarily for xmlrpc, but may be used with other
  35. * implementations to prevent naming collisions.
  36. *
  37. * @param string $function
  38. * @param string $namespace
  39. * @param null|array Optional array of arguments to pass to callbacks at
  40. * dispatch.
  41. * @return void
  42. */
  43. public function addFunction($function, $namespace = '');
  44. /**
  45. * Attach a class to a server
  46. *
  47. * The individual implementations should probably allow passing a variable
  48. * number of arguments in, so that developers may define custom runtime
  49. * arguments to pass to server methods.
  50. *
  51. * Namespacing is primarily for xmlrpc, but could be used for other
  52. * implementations as well.
  53. *
  54. * @param mixed $class Class name or object instance to examine and attach
  55. * to the server.
  56. * @param string $namespace Optional namespace with which to prepend method
  57. * names in the dispatch table.
  58. * methods in the class will be valid callbacks.
  59. * @param null|array Optional array of arguments to pass to callbacks at
  60. * dispatch.
  61. * @return void
  62. */
  63. public function setClass($class, $namespace = '', $argv = null);
  64. /**
  65. * Generate a server fault
  66. *
  67. * @param mixed $fault
  68. * @param int $code
  69. * @return mixed
  70. */
  71. public function fault($fault = null, $code = 404);
  72. /**
  73. * Handle a request
  74. *
  75. * Requests may be passed in, or the server may automagically determine the
  76. * request based on defaults. Dispatches server request to appropriate
  77. * method and returns a response
  78. *
  79. * @param mixed $request
  80. * @return mixed
  81. */
  82. public function handle($request = false);
  83. /**
  84. * Return a server definition array
  85. *
  86. * Returns a server definition array as created using
  87. * {@link * Zend_Server_Reflection}. Can be used for server introspection,
  88. * documentation, or persistence.
  89. *
  90. * @access public
  91. * @return array
  92. */
  93. public function getFunctions();
  94. /**
  95. * Load server definition
  96. *
  97. * Used for persistence; loads a construct as returned by {@link getFunctions()}.
  98. *
  99. * @param array $array
  100. * @return void
  101. */
  102. public function loadFunctions($definition);
  103. /**
  104. * Set server persistence
  105. *
  106. * @todo Determine how to implement this
  107. * @param int $mode
  108. * @return void
  109. */
  110. public function setPersistence($mode);
  111. }