|
1
|
|
|
<?php |
|
2
|
|
|
namespace Romm\ConfigurationObject\Legacy\Reflection; |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* This file is part of the TYPO3 CMS project. |
|
6
|
|
|
* |
|
7
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
8
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
9
|
|
|
* of the License, or any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* For the full copyright and license information, please read the |
|
12
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
13
|
|
|
* |
|
14
|
|
|
* The TYPO3 project - inspiring people to share! |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Extended version of the ReflectionMethod |
|
19
|
|
|
*/ |
|
20
|
|
|
class MethodReflection extends \ReflectionMethod |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* @var DocCommentParser An instance of the doc comment parser |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $docCommentParser; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Returns the declaring class |
|
29
|
|
|
* |
|
30
|
|
|
* @return ClassReflection The declaring class |
|
31
|
|
|
*/ |
|
32
|
|
|
public function getDeclaringClass() |
|
33
|
|
|
{ |
|
34
|
|
|
return new ClassReflection(parent::getDeclaringClass()->getName()); |
|
|
|
|
|
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Replacement for the original getParameters() method which makes sure |
|
39
|
|
|
* that \TYPO3\CMS\Extbase\Reflection\ParameterReflection objects are returned instead of the |
|
40
|
|
|
* original ReflectionParameter instances. |
|
41
|
|
|
* |
|
42
|
|
|
* @return ParameterReflection[] Parameter reflection objects of the parameters of this method |
|
43
|
|
|
*/ |
|
44
|
|
|
public function getParameters() |
|
45
|
|
|
{ |
|
46
|
|
|
$extendedParameters = []; |
|
47
|
|
|
foreach (parent::getParameters() as $parameter) { |
|
48
|
|
|
$extendedParameters[] = new ParameterReflection([$this->getDeclaringClass()->getName(), $this->getName()], $parameter->getName()); |
|
|
|
|
|
|
49
|
|
|
} |
|
50
|
|
|
return $extendedParameters; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Checks if the doc comment of this method is tagged with |
|
55
|
|
|
* the specified tag |
|
56
|
|
|
* |
|
57
|
|
|
* @param string $tag Tag name to check for |
|
58
|
|
|
* @return bool TRUE if such a tag has been defined, otherwise FALSE |
|
59
|
|
|
*/ |
|
60
|
|
|
public function isTaggedWith($tag) |
|
61
|
|
|
{ |
|
62
|
|
|
$result = $this->getDocCommentParser()->isTaggedWith($tag); |
|
63
|
|
|
return $result; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Returns an array of tags and their values |
|
68
|
|
|
* |
|
69
|
|
|
* @return array Tags and values |
|
70
|
|
|
*/ |
|
71
|
|
|
public function getTagsValues() |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->getDocCommentParser()->getTagsValues(); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Returns the values of the specified tag |
|
78
|
|
|
* |
|
79
|
|
|
* @param string $tag Tag name to check for |
|
80
|
|
|
* @return array Values of the given tag |
|
81
|
|
|
*/ |
|
82
|
|
|
public function getTagValues($tag) |
|
83
|
|
|
{ |
|
84
|
|
|
return $this->getDocCommentParser()->getTagValues($tag); |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Returns the description part of the doc comment |
|
89
|
|
|
* |
|
90
|
|
|
* @return string Doc comment description |
|
91
|
|
|
*/ |
|
92
|
|
|
public function getDescription() |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->getDocCommentParser()->getDescription(); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Returns an instance of the doc comment parser and |
|
99
|
|
|
* runs the parse() method. |
|
100
|
|
|
* |
|
101
|
|
|
* @return DocCommentParser |
|
102
|
|
|
*/ |
|
103
|
|
|
protected function getDocCommentParser() |
|
104
|
|
|
{ |
|
105
|
|
|
if (!is_object($this->docCommentParser)) { |
|
106
|
|
|
$this->docCommentParser = new DocCommentParser(); |
|
107
|
|
|
$this->docCommentParser->parseDocComment($this->getDocComment()); |
|
108
|
|
|
} |
|
109
|
|
|
return $this->docCommentParser; |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|