<?php
/**
* My Reflection_Method class
*/
class My_Reflection_Method extends ReflectionMethod
{
public $visibility = array();
public function __construct($o, $m)
{
parent::__construct($o, $m);
$this->visibility = Reflection::getModifierNames($this->getModifiers());
}
}
/**
* Demo class #1
*
*/
class T {
protected function x() {}
}
/**
* Demo class #2
*
*/
class U extends T {
function x() {}
}
// 输出信息
var_dump(new My_Reflection_Method('U', 'x'));
?>
object(My_Reflection_Method)#1 (3) {
["visibility"]=>
array(1) {
[0]=>
string(6) "public"
}
["name"]=>
string(1) "x"
["class"]=>
string(1) "U"
}