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  * @see Zend_Reflection_Class
0024  */
0025 // require_once 'Zend/Reflection/Class.php';
0026 
0027 /**
0028  * @see Zend_Reflection_Function
0029  */
0030 // require_once 'Zend/Reflection/Function.php';
0031 
0032 /**
0033  * @category   Zend
0034  * @package    Zend_Reflection
0035  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0036  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0037  */
0038 class Zend_Reflection_Extension extends ReflectionExtension
0039 {
0040     /**
0041      * Get extension function reflection objects
0042      *
0043      * @param  string $reflectionClass Name of reflection class to use
0044      * @return array Array of Zend_Reflection_Function objects
0045      */
0046     public function getFunctions($reflectionClass = 'Zend_Reflection_Function')
0047     {
0048         $phpReflections  = parent::getFunctions();
0049         $zendReflections = array();
0050         while ($phpReflections && ($phpReflection = array_shift($phpReflections))) {
0051             $instance = new $reflectionClass($phpReflection->getName());
0052             if (!$instance instanceof Zend_Reflection_Function) {
0053                 // require_once 'Zend/Reflection/Exception.php';
0054                 throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Function');
0055             }
0056             $zendReflections[] = $instance;
0057             unset($phpReflection);
0058         }
0059         unset($phpReflections);
0060         return $zendReflections;
0061     }
0062 
0063     /**
0064      * Get extension class reflection objects
0065      *
0066      * @param  string $reflectionClass Name of reflection class to use
0067      * @return array Array of Zend_Reflection_Class objects
0068      */
0069     public function getClasses($reflectionClass = 'Zend_Reflection_Class')
0070     {
0071         $phpReflections  = parent::getClasses();
0072         $zendReflections = array();
0073         while ($phpReflections && ($phpReflection = array_shift($phpReflections))) {
0074             $instance = new $reflectionClass($phpReflection->getName());
0075             if (!$instance instanceof Zend_Reflection_Class) {
0076                 // require_once 'Zend/Reflection/Exception.php';
0077                 throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class');
0078             }
0079             $zendReflections[] = $instance;
0080             unset($phpReflection);
0081         }
0082         unset($phpReflections);
0083         return $zendReflections;
0084     }
0085 }