Extension.php 3.0 KB

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