Nelius
кипарис во дворе
Вариант без Reflection... вроде работает
Вот мой тестовый скрипт полностью
PHP:
function baseinhert($classname) {
$classes = array_reverse(class_parents($classname));
$classes[] = $classname;
$base_methods = array_reverse(get_class_methods(array_shift($classes)));
foreach ($classes as $key => $val) {
$son_methods = array_reverse(get_class_methods($val));
for ($i=0; $i<count($base_methods); $i++) {
if (array_search($base_methods[$i], $son_methods) < count($base_methods)) { $me[] = $base_methods[$i]; }
}
$base_methods = $me; unset($me);
}
return $base_methods;
}
print '<pre>';
print_r(baseinhert('base_3'));
PHP:
class base {
function a() {}
function c() {}
function d() {}
function z() {}
}
class base_1 extends base {
function a() {}
function b() {}
function g() {}
}
class base_2 extends base_1 {
function b() {}
function z() {}
function c() {}
}
class base_3 extends base_2 {
function c() {}
function z() {}
}
function baseinhert($classname) {
$classes = array_reverse(class_parents($classname));
$classes[] = $classname;
$base_methods = array_reverse(get_class_methods(array_shift($classes)));
print 'BASE METHODS<br>';
print_r($base_methods);
foreach ($classes as $key => $val) {
$son_methods = array_reverse(get_class_methods($val));
print $val.' METHODS<br>';
print_r($son_methods);
for ($i=0; $i<count($base_methods); $i++) {
if (array_search($base_methods[$i], $son_methods) < count($base_methods)) { $me[] = $base_methods[$i]; }
}
$base_methods = $me; unset($me);
print '!OVERLOADED METHODS<br>';
print_r($base_methods);
}
return $base_methods;
}
print '<pre>';
print_r(baseinhert('base_3'));