1 | <?php |
||
24 | class MethodReflection implements Reflection, ResultConvertible |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * @var \Zend\Code\Reflection\MethodReflection |
||
29 | */ |
||
30 | private $reflection; |
||
31 | |||
32 | |||
33 | /** |
||
34 | * @param $class |
||
35 | * @param string $name |
||
36 | */ |
||
37 | public function __construct($class, $name = null) |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | public function getIdentityName() |
||
46 | { |
||
47 | $template = '%s\\%s::%s'; |
||
48 | $assembleContent = sprintf( |
||
49 | $template, |
||
50 | $this->getNamespaceName(), |
||
51 | $this->getDeclaringClassName(), |
||
52 | $this->getName() |
||
53 | ); |
||
54 | |||
55 | return $assembleContent; |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function getName() |
||
65 | |||
66 | /** |
||
67 | * @return string |
||
68 | */ |
||
69 | public function getNamespaceName() |
||
70 | { |
||
71 | $declaringClass = $this->reflection->getDeclaringClass(); |
||
72 | return $declaringClass->getNamespaceName(); |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * @return string |
||
77 | */ |
||
78 | public function getDeclaringClassName() |
||
79 | { |
||
80 | $declaringClass = $this->reflection->getDeclaringClass(); |
||
81 | return $declaringClass->name; |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public function getLineRange() |
||
88 | { |
||
89 | $startLine = $this->reflection->getStartLine(); |
||
90 | $endLine = $this->reflection->getEndLine(); |
||
91 | |||
92 | return new LineRange($startLine, $endLine); |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | public function convertToResult(LineResultSelectable $selector) |
||
102 | |||
103 | /** |
||
104 | * @return string |
||
105 | */ |
||
106 | public function __toString() |
||
110 | |||
111 | } |
||
112 |