This file is indexed.

/usr/share/php/ApiGen/Reflection/TokenReflection/ReflectionFactory.php is in php-apigen 4.1.2-1ubuntu2.

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
136
137
138
139
140
141
<?php

/**
 * This file is part of the ApiGen (http://apigen.org)
 *
 * For the full copyright and license information, please view
 * the file license.md that was distributed with this source code.
 */

namespace ApiGen\Reflection\TokenReflection;

use ApiGen\Configuration\Configuration;
use ApiGen\Parser\ParserResult;
use ApiGen\Reflection\ReflectionBase;
use ApiGen\Reflection\ReflectionClass;
use ApiGen\Reflection\ReflectionConstant;
use ApiGen\Reflection\ReflectionExtension;
use ApiGen\Reflection\ReflectionFunction;
use ApiGen\Reflection\ReflectionMethod;
use ApiGen\Reflection\ReflectionMethodMagic;
use ApiGen\Reflection\ReflectionParameter;
use ApiGen\Reflection\ReflectionParameterMagic;
use ApiGen\Reflection\ReflectionProperty;
use ApiGen\Reflection\ReflectionPropertyMagic;
use RuntimeException;
use TokenReflection\IReflectionClass;
use TokenReflection\IReflectionConstant;
use TokenReflection\IReflectionExtension;
use TokenReflection\IReflectionFunction;
use TokenReflection\IReflectionMethod;
use TokenReflection\IReflectionParameter;
use TokenReflection\IReflectionProperty;


class ReflectionFactory
{

	/**
	 * @var Configuration
	 */
	private $configuration;

	/**
	 * @var ParserResult
	 */
	private $parserResult;


	public function __construct(Configuration $configuration, ParserResult $parserResult)
	{
		$this->configuration = $configuration;
		$this->parserResult = $parserResult;
	}


	/**
	 * @param IReflectionClass|IReflectionConstant|IReflectionFunction $tokenReflection
	 * @return ReflectionClass|ReflectionConstant|ReflectionMethod
	 */
	public function createFromReflection($tokenReflection)
	{
		$reflection = $this->createByReflectionType($tokenReflection);
		return $this->setDependencies($reflection);
	}


	/**
	 * @return ReflectionMethodMagic
	 */
	public function createMethodMagic(array $settings)
	{
		$reflection = new ReflectionMethodMagic($settings);
		return $this->setDependencies($reflection);
	}


	/**
	 * @return ReflectionParameterMagic
	 */
	public function createParameterMagic(array $settings)
	{
		$reflection = new ReflectionParameterMagic($settings);
		return $this->setDependencies($reflection);
	}


	/**
	 * @return ReflectionPropertyMagic
	 */
	public function createPropertyMagic(array $settings)
	{
		$reflection = new ReflectionPropertyMagic($settings);
		return $this->setDependencies($reflection);

	}


	/**
	 * @param IReflectionClass|IReflectionConstant|IReflectionMethod $reflection
	 * @return ReflectionClass|ReflectionConstant|ReflectionMethod
	 */
	private function createByReflectionType($reflection)
	{
		if ($reflection instanceof IReflectionClass) {
			return new ReflectionClass($reflection);

		} elseif ($reflection instanceof IReflectionConstant) {
			return new ReflectionConstant($reflection);

		} elseif ($reflection instanceof IReflectionMethod) {
			return new ReflectionMethod($reflection);

		} elseif ($reflection instanceof IReflectionProperty) {
			return new ReflectionProperty($reflection);

		} elseif ($reflection instanceof IReflectionParameter) {
			return new ReflectionParameter($reflection);

		} elseif ($reflection instanceof IReflectionFunction) {
			return new ReflectionFunction($reflection);

		} elseif ($reflection instanceof IReflectionExtension) {
			return new ReflectionExtension($reflection);
		}

		throw new RuntimeException('Invalid reflection class type ' . get_class($reflection));
	}


	/**
	 * @return ReflectionBase
	 */
	private function setDependencies(ReflectionBase $reflection)
	{
		$reflection->setConfiguration($this->configuration);
		$reflection->setParserResult($this->parserResult);
		$reflection->setReflectionFactory($this);
		return $reflection;
	}

}