Commit 6453cb7e by sn

D::printClassesforFunction

1 parent fd4337ff
Showing with 47 additions and 0 deletions
......@@ -341,6 +341,53 @@ class D {
}
}
/**
*
* @param object|classname $param_class
* @param string $param_fncname
* @param bool $param_onlyReturn
* @return array
*/
public static function printClassesforFunction($param_class, $param_fncname, $param_onlyReturn, $param_print=true, $param_force=false, $param_htmlentities=false) {
if(is_object($param_class)) {
$classname = get_class($param_class);
} else if(class_exists($param_class)) {
$classname = $param_class;
}
$result = array();
do {
$methods = get_class_methods($classname);
// D::show($methods, $classname);
if(array_search($param_fncname, $methods)) {
$result[] = array($classname => $param_fncname);
}
} while ($classname = get_parent_class($classname));
if(empty($result)) {
return D::printClassesforFunction($param_class, '__call', $param_onlyReturn);
}
if($param_onlyReturn) {
return $result;
} else {
// D::show($result, $param_fncname);
self::printCurrentFunction($param_print,"<br>______________________<br>");
$string_show = "<br /><b>printClassesforFunction(".$param_fncname.")</b><br />";
$string_show .= "<pre>";
if($param_htmlentities){
$param_val=self::htmlencode_arrayvalues($result);
}
self::new_echo($string_show.print_r($result, true).'"</pre>"', $param_print, $param_force);
return $result;
}
}
public static function backtrace($class=null, $param_print=true, $param_force=false) {
self::printCurrentFunction($param_print);
//echo '<h1>backtrace('.$class.')</h1>';
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!