|
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 /** |
|
23 * @todo implement line numbers |
|
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_Property extends ReflectionProperty |
|
30 { |
|
31 /** |
|
32 * Get declaring class reflection object |
|
33 * |
|
34 * @return Zend_Reflection_Class |
|
35 */ |
|
36 public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class') |
|
37 { |
|
38 $phpReflection = parent::getDeclaringClass(); |
|
39 $zendReflection = new $reflectionClass($phpReflection->getName()); |
|
40 if (!$zendReflection instanceof Zend_Reflection_Class) { |
|
41 require_once 'Zend/Reflection/Exception.php'; |
|
42 throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class'); |
|
43 } |
|
44 unset($phpReflection); |
|
45 return $zendReflection; |
|
46 } |
|
47 |
|
48 /** |
|
49 * Get docblock comment |
|
50 * |
|
51 * @param string $reflectionClass |
|
52 * @return Zend_Reflection_Docblock|false False if no docblock defined |
|
53 */ |
|
54 public function getDocComment($reflectionClass = 'Zend_Reflection_Docblock') |
|
55 { |
|
56 $docblock = parent::getDocComment(); |
|
57 if (!$docblock) { |
|
58 return false; |
|
59 } |
|
60 |
|
61 $r = new $reflectionClass($docblock); |
|
62 if (!$r instanceof Zend_Reflection_Docblock) { |
|
63 require_once 'Zend/Reflection/Exception.php'; |
|
64 throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Docblock'); |
|
65 } |
|
66 return $r; |
|
67 } |
|
68 } |