/framework/vendor/zend/Zend/Server/Reflection/Prototype.php

http://zoop.googlecode.com/ · PHP · 103 lines · 35 code · 9 blank · 59 comment · 4 complexity · 6b8cfb6ea1e97548c959a1eee60803ad MD5 · raw file

  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-2010 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_Reflection_ReturnValue
  22. */
  23. require_once 'Zend/Server/Reflection/ReturnValue.php';
  24. /**
  25. * Zend_Server_Reflection_Parameter
  26. */
  27. require_once 'Zend/Server/Reflection/Parameter.php';
  28. /**
  29. * Method/Function prototypes
  30. *
  31. * Contains accessors for the return value and all method arguments.
  32. *
  33. * @category Zend
  34. * @package Zend_Server
  35. * @subpackage Reflection
  36. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  37. * @license http://framework.zend.com/license/new-bsd New BSD License
  38. * @version $Id: Prototype.php 20096 2010-01-06 02:05:09Z bkarwin $
  39. */
  40. class Zend_Server_Reflection_Prototype
  41. {
  42. /**
  43. * Constructor
  44. *
  45. * @param Zend_Server_Reflection_ReturnValue $return
  46. * @param array $params
  47. * @return void
  48. */
  49. public function __construct(Zend_Server_Reflection_ReturnValue $return, $params = null)
  50. {
  51. $this->_return = $return;
  52. if (!is_array($params) && (null !== $params)) {
  53. require_once 'Zend/Server/Reflection/Exception.php';
  54. throw new Zend_Server_Reflection_Exception('Invalid parameters');
  55. }
  56. if (is_array($params)) {
  57. foreach ($params as $param) {
  58. if (!$param instanceof Zend_Server_Reflection_Parameter) {
  59. require_once 'Zend/Server/Reflection/Exception.php';
  60. throw new Zend_Server_Reflection_Exception('One or more params are invalid');
  61. }
  62. }
  63. }
  64. $this->_params = $params;
  65. }
  66. /**
  67. * Retrieve return type
  68. *
  69. * @return string
  70. */
  71. public function getReturnType()
  72. {
  73. return $this->_return->getType();
  74. }
  75. /**
  76. * Retrieve the return value object
  77. *
  78. * @access public
  79. * @return Zend_Server_Reflection_ReturnValue
  80. */
  81. public function getReturnValue()
  82. {
  83. return $this->_return;
  84. }
  85. /**
  86. * Retrieve method parameters
  87. *
  88. * @return array Array of {@link Zend_Server_Reflection_Parameter}s
  89. */
  90. public function getParameters()
  91. {
  92. return $this->_params;
  93. }
  94. }