mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT: Improved performance of Object::uninherited_static()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84159 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
70dc433d38
commit
81eeef25e8
@ -270,24 +270,18 @@ abstract class Object {
|
||||
}
|
||||
|
||||
if(!isset(self::$cached_uninherited_statics[$class][$name]) || $uncached) {
|
||||
$classRef = new ReflectionClass($class);
|
||||
$classProps = $classRef->getStaticProperties();
|
||||
$classRef = new ReflectionClass($class);
|
||||
$classProp = $classRef->getStaticPropertyValue($name, null);
|
||||
|
||||
$parentClass = get_parent_class($class);
|
||||
if($parentClass) {
|
||||
$parentRef = new ReflectionClass($parentClass);
|
||||
$parentProps = $parentRef->getStaticProperties();
|
||||
|
||||
$uninheritedBuiltIn = isset($classProps[$name])
|
||||
&& (!isset($parentProps[$name])
|
||||
|| $classProps[$name] != $parentProps[$name]) ? $classProps[$name] : null;
|
||||
} else {
|
||||
$uninheritedBuiltIn = isset($classProps[$name]) ? $classProps[$name] : null;
|
||||
$parentRef = new ReflectionClass($parentClass);
|
||||
$parentProp = $parentRef->getStaticPropertyValue($name, null);
|
||||
if($parentProp == $classProp) $classProp = null;
|
||||
}
|
||||
|
||||
|
||||
self::$cached_uninherited_statics[$class][$name] = true;
|
||||
self::$uninherited_statics[$class][$name] = $uninheritedBuiltIn;
|
||||
self::$uninherited_statics[$class][$name] = $classProp;
|
||||
}
|
||||
|
||||
return self::$uninherited_statics[$class][$name];
|
||||
|
Loading…
x
Reference in New Issue
Block a user