PageRenderTime 52ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/zendframework/zendframework/library/Zend/Server/Reflection/ReflectionReturnValue.php

https://bitbucket.org/pcelta/zf2
PHP | 99 lines | 34 code | 10 blank | 55 comment | 4 complexity | e8d401b66a7850e2831b284795d35be7 MD5 | raw file
  1. <?php
  2. /**
  3. * Zend Framework (http://framework.zend.com/)
  4. *
  5. * @link http://github.com/zendframework/zf2 for the canonical source repository
  6. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  7. * @license http://framework.zend.com/license/new-bsd New BSD License
  8. * @package Zend_Server
  9. */
  10. namespace Zend\Server\Reflection;
  11. /**
  12. * Return value reflection
  13. *
  14. * Stores the return value type and description
  15. *
  16. * @category Zend
  17. * @package Zend_Server
  18. * @subpackage Zend_Server_Reflection
  19. */
  20. class ReflectionReturnValue
  21. {
  22. /**
  23. * Return value type
  24. * @var string
  25. */
  26. protected $type;
  27. /**
  28. * Return value description
  29. * @var string
  30. */
  31. protected $description;
  32. /**
  33. * Constructor
  34. *
  35. * @param string $type Return value type
  36. * @param string $description Return value type
  37. */
  38. public function __construct($type = 'mixed', $description = '')
  39. {
  40. $this->setType($type);
  41. $this->setDescription($description);
  42. }
  43. /**
  44. * Retrieve parameter type
  45. *
  46. * @return string
  47. */
  48. public function getType()
  49. {
  50. return $this->type;
  51. }
  52. /**
  53. * Set parameter type
  54. *
  55. * @param string|null $type
  56. * @throws Exception\InvalidArgumentException
  57. * @return void
  58. */
  59. public function setType($type)
  60. {
  61. if (!is_string($type) && (null !== $type)) {
  62. throw new Exception\InvalidArgumentException('Invalid parameter type');
  63. }
  64. $this->type = $type;
  65. }
  66. /**
  67. * Retrieve parameter description
  68. *
  69. * @return string
  70. */
  71. public function getDescription()
  72. {
  73. return $this->description;
  74. }
  75. /**
  76. * Set parameter description
  77. *
  78. * @param string|null $description
  79. * @throws Exception\InvalidArgumentException
  80. * @return void
  81. */
  82. public function setDescription($description)
  83. {
  84. if (!is_string($description) && (null !== $description)) {
  85. throw new Exception\InvalidArgumentException('Invalid parameter description');
  86. }
  87. $this->description = $description;
  88. }
  89. }