File indexing completed on 2024-05-12 06:02:55

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Reflection
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0019  * @version    $Id$
0020  */
0021 
0022 /**
0023  * @todo       implement line numbers
0024  * @category   Zend
0025  * @package    Zend_Reflection
0026  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0027  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0028  */
0029 class Zend_Reflection_Property extends ReflectionProperty
0030 {
0031     /**
0032      * Get declaring class reflection object
0033      *
0034      * @return Zend_Reflection_Class
0035      */
0036     public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class')
0037     {
0038         $phpReflection  = parent::getDeclaringClass();
0039         $zendReflection = new $reflectionClass($phpReflection->getName());
0040         if (!$zendReflection instanceof Zend_Reflection_Class) {
0041             // require_once 'Zend/Reflection/Exception.php';
0042             throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class');
0043         }
0044         unset($phpReflection);
0045         return $zendReflection;
0046     }
0047 
0048     /**
0049      * Get docblock comment
0050      *
0051      * @param  string $reflectionClass
0052      * @return Zend_Reflection_Docblock|false False if no docblock defined
0053      */
0054     public function getDocComment($reflectionClass = 'Zend_Reflection_Docblock')
0055     {
0056         $docblock = parent::getDocComment();
0057         if (!$docblock) {
0058             return false;
0059         }
0060 
0061         $r = new $reflectionClass($docblock);
0062         if (!$r instanceof Zend_Reflection_Docblock) {
0063             // require_once 'Zend/Reflection/Exception.php';
0064             throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Docblock');
0065         }
0066         return $r;
0067     }
0068 }