web/lib/Zend/Reflection/Extension.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     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: Extension.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    20  */
       
    21 
       
    22 /**
       
    23  * @see Zend_Reflection_Class
       
    24  */
       
    25 require_once 'Zend/Reflection/Class.php';
       
    26 
       
    27 /**
       
    28  * @see Zend_Reflection_Function
       
    29  */
       
    30 require_once 'Zend/Reflection/Function.php';
       
    31 
       
    32 /**
       
    33  * @category   Zend
       
    34  * @package    Zend_Reflection
       
    35  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    36  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    37  */
       
    38 class Zend_Reflection_Extension extends ReflectionExtension
       
    39 {
       
    40     /**
       
    41      * Get extension function reflection objects
       
    42      *
       
    43      * @param  string $reflectionClass Name of reflection class to use
       
    44      * @return array Array of Zend_Reflection_Function objects
       
    45      */
       
    46     public function getFunctions($reflectionClass = 'Zend_Reflection_Function')
       
    47     {
       
    48         $phpReflections  = parent::getFunctions();
       
    49         $zendReflections = array();
       
    50         while ($phpReflections && ($phpReflection = array_shift($phpReflections))) {
       
    51             $instance = new $reflectionClass($phpReflection->getName());
       
    52             if (!$instance instanceof Zend_Reflection_Function) {
       
    53                 require_once 'Zend/Reflection/Exception.php';
       
    54                 throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Function');
       
    55             }
       
    56             $zendReflections[] = $instance;
       
    57             unset($phpReflection);
       
    58         }
       
    59         unset($phpReflections);
       
    60         return $zendReflections;
       
    61     }
       
    62 
       
    63     /**
       
    64      * Get extension class reflection objects
       
    65      *
       
    66      * @param  string $reflectionClass Name of reflection class to use
       
    67      * @return array Array of Zend_Reflection_Class objects
       
    68      */
       
    69     public function getClasses($reflectionClass = 'Zend_Reflection_Class')
       
    70     {
       
    71         $phpReflections  = parent::getClasses();
       
    72         $zendReflections = array();
       
    73         while ($phpReflections && ($phpReflection = array_shift($phpReflections))) {
       
    74             $instance = new $reflectionClass($phpReflection->getName());
       
    75             if (!$instance instanceof Zend_Reflection_Class) {
       
    76                 require_once 'Zend/Reflection/Exception.php';
       
    77                 throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class');
       
    78             }
       
    79             $zendReflections[] = $instance;
       
    80             unset($phpReflection);
       
    81         }
       
    82         unset($phpReflections);
       
    83         return $zendReflections;
       
    84     }
       
    85 }