/usr/share/php/DeepCopy/Reflection/ReflectionHelper.php is in php-deepcopy 1.5.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | <?php
namespace DeepCopy\Reflection;
class ReflectionHelper
{
/**
* Retrieves all properties (including private ones), from object and all its ancestors.
*
* Standard \ReflectionClass->getProperties() does not return private properties from ancestor classes.
*
* @author muratyaman@gmail.com
* @see http://php.net/manual/en/reflectionclass.getproperties.php
*
* @param \ReflectionClass $ref
* @return \ReflectionProperty[]
*/
public static function getProperties(\ReflectionClass $ref)
{
$props = $ref->getProperties();
$propsArr = array();
foreach ($props as $prop) {
$f = $prop->getName();
$propsArr[$f] = $prop;
}
if ($parentClass = $ref->getParentClass()) {
$parentPropsArr = self::getProperties($parentClass);
if (count($parentPropsArr) > 0) {
$propsArr = array_merge($parentPropsArr, $propsArr);
}
}
return $propsArr;
}
}
|