mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENH Allow subclasses to be defined for backtrace filtered functions.
This commit is contained in:
parent
2b0df58176
commit
d448622ff4
@ -81,9 +81,9 @@ class Backtrace
|
|||||||
$match = false;
|
$match = false;
|
||||||
if (!empty($frame['class'])) {
|
if (!empty($frame['class'])) {
|
||||||
foreach ($ignoredArgs as $fnSpec) {
|
foreach ($ignoredArgs as $fnSpec) {
|
||||||
if (is_array($fnSpec) &&
|
if (is_array($fnSpec)
|
||||||
('*' == $fnSpec[0] || $frame['class'] == $fnSpec[0]) &&
|
&& self::matchesFilterableClass($frame['class'], $fnSpec[0])
|
||||||
$frame['function'] == $fnSpec[1]
|
&& $frame['function'] == $fnSpec[1]
|
||||||
) {
|
) {
|
||||||
$match = true;
|
$match = true;
|
||||||
break;
|
break;
|
||||||
@ -202,4 +202,13 @@ class Backtrace
|
|||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the filterable class is wildcard, of if the class name is the filterable class, or a subclass of it,
|
||||||
|
* or implements it.
|
||||||
|
*/
|
||||||
|
private static function matchesFilterableClass(string $className, string $filterableClass): bool
|
||||||
|
{
|
||||||
|
return $filterableClass === '*' || $className === $filterableClass || is_subclass_of($className, $filterableClass);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user