Jelajahi Sumber

Added docblock introspection to Zend_Reflection_Property

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15410 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 16 tahun lalu
induk
melakukan
3600359ca2
1 mengubah file dengan 21 tambahan dan 0 penghapusan
  1. 21 0
      library/Zend/Reflection/Property.php

+ 21 - 0
library/Zend/Reflection/Property.php

@@ -44,4 +44,25 @@ class Zend_Reflection_Property extends ReflectionProperty
         unset($phpReflection);
         return $zendReflection;
     }
+
+    /**
+     * Get docblock comment
+     * 
+     * @param  string $reflectionClass 
+     * @return Zend_Reflection_Docblock|false False if no docblock defined
+     */
+    public function getDocComment($reflectionClass = 'Zend_Reflection_Docblock')
+    {
+        $docblock = parent::getDocComment();
+        if (!$docblock) {
+            return false;
+        }
+
+        $r = new $reflectionClass($docblock);
+        if (!$r instanceof Zend_Reflection_Docblock) {
+            require_once 'Zend/Reflection/Exception.php';
+            throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Docblock');
+        }
+        return $r;
+    }
 }