This file is indexed.

/usr/share/php/ApiGen/Reflection/Extractors/AnnotationPropertyExtractor.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
<?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\Extractors;

use ApiGen\Reflection\ReflectionClass;
use ApiGen\Reflection\ReflectionPropertyMagic;
use ApiGen\Reflection\TokenReflection\ReflectionFactory;


class AnnotationPropertyExtractor
{

	const PATTERN_PROPERTY = '~^(?:([\\w\\\\]+(?:\\|[\\w\\\\]+)*)\\s+)?\\$(\\w+)(?:\\s+(.*))?($)~s';

	/**
	 * @var ReflectionFactory
	 */
	private $reflectionFactory;

	/**
	 * @var ReflectionClass
	 */
	private $reflectionClass;


	public function __construct(ReflectionFactory $reflectionFactory)
	{
		$this->reflectionFactory = $reflectionFactory;
	}


	public function extractFromReflection(ReflectionClass $reflectionClass)
	{
		$this->reflectionClass = $reflectionClass;

		$properties = [];
		foreach (['property', 'property-read', 'property-write'] as $annotationName) {
			if ($reflectionClass->hasAnnotation($annotationName)) {
				foreach ($reflectionClass->getAnnotation($annotationName) as $annotation) {
					$properties += $this->processMagicPropertyAnnotation($annotation, $annotationName);
				};
			}
		}

		return $properties;
	}


	/**
	 * @param string $annotation
	 * @param string $annotationName
	 * @return ReflectionPropertyMagic[]|array
	 */
	private function processMagicPropertyAnnotation($annotation, $annotationName)
	{
		if ( ! preg_match(self::PATTERN_PROPERTY, $annotation, $matches)) {
			return [];
		}

		list(, $typeHint, $name, $shortDescription) = $matches;

		$startLine = $this->getStartLine($annotation);
		$properties = [];
		$properties[$name] = $this->reflectionFactory->createPropertyMagic([
			'name' => $name,
			'typeHint' => $typeHint,
			'shortDescription' => str_replace("\n", ' ', $shortDescription),
			'startLine' => $startLine,
			'endLine' => $startLine + substr_count($annotation, "\n"),
			'readOnly' => ($annotationName === 'property-read'),
			'writeOnly' => ($annotationName === 'property-write'),
			'declaringClass' => $this->reflectionClass
		]);
		return $properties;
	}


	/**
	 * @param string $annotation
	 * @return int
	 */
	private function getStartLine($annotation)
	{
		$doc = $this->reflectionClass->getDocComment();
		$tmp = $annotation;
		if ($delimiter = strpos($annotation, "\n")) {
			$tmp = substr($annotation, 0, $delimiter);
		}
		return $this->reflectionClass->getStartLine() + substr_count(substr($doc, 0, strpos($doc, $tmp)), "\n");
	}

}