/framework/vendor/zend/Zend/Reflection/Property.php

http://zoop.googlecode.com/ · PHP · 68 lines · 28 code · 3 blank · 37 comment · 3 complexity · 5c799e1c7732e9e8f504c6ca9b9cde6e 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: Property.php 20096 2010-01-06 02:05:09Z bkarwin $
  20. */
  21. /**
  22. * @todo implement line numbers
  23. * @category Zend
  24. * @package Zend_Reflection
  25. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  26. * @license http://framework.zend.com/license/new-bsd New BSD License
  27. */
  28. class Zend_Reflection_Property extends ReflectionProperty
  29. {
  30. /**
  31. * Get declaring class reflection object
  32. *
  33. * @return Zend_Reflection_Class
  34. */
  35. public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class')
  36. {
  37. $phpReflection = parent::getDeclaringClass();
  38. $zendReflection = new $reflectionClass($phpReflection->getName());
  39. if (!$zendReflection instanceof Zend_Reflection_Class) {
  40. require_once 'Zend/Reflection/Exception.php';
  41. throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class');
  42. }
  43. unset($phpReflection);
  44. return $zendReflection;
  45. }
  46. /**
  47. * Get docblock comment
  48. *
  49. * @param string $reflectionClass
  50. * @return Zend_Reflection_Docblock|false False if no docblock defined
  51. */
  52. public function getDocComment($reflectionClass = 'Zend_Reflection_Docblock')
  53. {
  54. $docblock = parent::getDocComment();
  55. if (!$docblock) {
  56. return false;
  57. }
  58. $r = new $reflectionClass($docblock);
  59. if (!$r instanceof Zend_Reflection_Docblock) {
  60. require_once 'Zend/Reflection/Exception.php';
  61. throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Docblock');
  62. }
  63. return $r;
  64. }
  65. }