/usr/share/php/ApiGen/ReflectionExtension.php is in php-apigen 2.8.0+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | <?php
/**
* ApiGen 2.8.0 - API documentation generator for PHP 5.3+
*
* Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
* Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
* Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville)
*
* For the full copyright and license information, please view
* the file LICENSE.md that was distributed with this source code.
*/
namespace ApiGen;
/**
* Extension reflection envelope.
*
* Alters TokenReflection\IReflectionExtension functionality for ApiGen.
*/
class ReflectionExtension extends ReflectionBase
{
/**
* Returns a class reflection.
*
* @param string $name Class name
* @return \ApiGen\ReflectionClass|null
*/
public function getClass($name)
{
$class = $this->reflection->getClass($name);
if (null === $class) {
return null;
}
if (isset(self::$parsedClasses[$name])) {
return self::$parsedClasses[$name];
}
return new ReflectionClass($class, self::$generator);
}
/**
* Returns classes defined by this extension.
*
* @return array
*/
public function getClasses()
{
$generator = self::$generator;
$classes = self::$parsedClasses;
return array_map(function(TokenReflection\IReflectionClass $class) use ($generator, $classes) {
return isset($classes[$class->getName()]) ? $classes[$class->getName()] : new ReflectionClass($class, $generator);
}, $this->reflection->getClasses());
}
/**
* Returns a constant reflection.
*
* @param string $name Constant name
* @return \ApiGen\ReflectionConstant|null
*/
public function getConstant($name)
{
return $this->getConstantReflection($name);
}
/**
* Returns a constant reflection.
*
* @param string $name Constant name
* @return \ApiGen\ReflectionConstant|null
*/
public function getConstantReflection($name)
{
$constant = $this->reflection->getConstantReflection($name);
return null === $constant ? null : new ReflectionConstant($constant, self::$generator);
}
/**
* Returns reflections of defined constants.
*
* @return array
*/
public function getConstants()
{
return $this->getConstantReflections();
}
/**
* Returns reflections of defined constants.
*
* @return array
*/
public function getConstantReflections()
{
$generator = self::$generator;
return array_map(function(TokenReflection\IReflectionConstant $constant) use ($generator) {
return new ReflectionConstant($constant, $generator);
}, $this->reflection->getConstantReflections());
}
/**
* Returns a function reflection.
*
* @param string $name Function name
* @return \ApiGen\ReflectionFunction
*/
public function getFunction($name)
{
$function = $this->reflection->getFunction($name);
return null === $function ? null : new ReflectionFunction($function, self::$generator);
}
/**
* Returns functions defined by this extension.
*
* @return array
*/
public function getFunctions()
{
$generator = self::$generator;
return array_map(function(TokenReflection\IReflectionFunction $function) use ($generator) {
return new ReflectionFunction($function, $generator);
}, $this->reflection->getFunctions());
}
/**
* Returns names of functions defined by this extension.
*
* @return array
*/
public function getFunctionNames()
{
return $this->reflection->getFunctionNames();
}
}
|