/framework/vendor/zend/Zend/Reflection/Docblock/Tag/Return.php

http://zoop.googlecode.com/ · PHP · 72 lines · 26 code · 6 blank · 40 comment · 4 complexity · 4bb22746528e89cf3091ed9ae171f9fb 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_Reflection
  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. * @version $Id: Return.php 20096 2010-01-06 02:05:09Z bkarwin $
  20. */
  21. /** Zend_Reflection_Docblock_Tag */
  22. require_once 'Zend/Reflection/Docblock/Tag.php';
  23. /**
  24. * @category Zend
  25. * @package Zend_Reflection
  26. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  27. * @license http://framework.zend.com/license/new-bsd New BSD License
  28. */
  29. class Zend_Reflection_Docblock_Tag_Return extends Zend_Reflection_Docblock_Tag
  30. {
  31. /**
  32. * @var string
  33. */
  34. protected $_type = null;
  35. /**
  36. * Constructor
  37. *
  38. * @param string $tagDocblockLine
  39. * @return void
  40. */
  41. public function __construct($tagDocblockLine)
  42. {
  43. if (!preg_match('#^@(\w+)\s+([\w|\\\]+)(?:\s+(.*))?#', $tagDocblockLine, $matches)) {
  44. require_once 'Zend/Reflection/Exception.php';
  45. throw new Zend_Reflection_Exception('Provided docblock line is does not contain a valid tag');
  46. }
  47. if ($matches[1] != 'return') {
  48. require_once 'Zend/Reflection/Exception.php';
  49. throw new Zend_Reflection_Exception('Provided docblock line is does not contain a valid @return tag');
  50. }
  51. $this->_name = 'return';
  52. $this->_type = $matches[2];
  53. if (isset($matches[3])) {
  54. $this->_description = $matches[3];
  55. }
  56. }
  57. /**
  58. * Get return variable type
  59. *
  60. * @return string
  61. */
  62. public function getType()
  63. {
  64. return $this->_type;
  65. }
  66. }