From an architectural point of view, I think that reflection should be avoided if possible, but take a look at ReflectionClass->getMethods() if you think you know what you're doing.
<?php
class A {
public function x() { }
public function y() { }
}
class B extends A {
public function a() { }
public function b() { }
public function x() { } // <-- defined here
}
$r = new ReflectionClass('B');
print_r($r->getMethods());
?>
You will get a list of methods defined by B
and A
, along with the class that last defined it. This is the output:
Array
(
[0] => ReflectionMethod Object
(
[name] => a
[class] => B
)
[1] => ReflectionMethod Object
(
[name] => b
[class] => B
)
[2] => ReflectionMethod Object
(
[name] => x
[class] => B
)
[3] => ReflectionMethod Object
(
[name] => y
[class] => A
)
)