D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
tattooscyy
/
test
/
vendor
/
myclabs
/
deep-copy
/
src
/
DeepCopy
/
Reflection
/
Filename :
ReflectionHelper.php
back
Copy
<?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) { $propertyName = $prop->getName(); $propsArr[$propertyName] = $prop; } if ($parentClass = $ref->getParentClass()) { $parentPropsArr = self::getProperties($parentClass); foreach ($propsArr as $key => $property) { $parentPropsArr[$key] = $property; } return $parentPropsArr; } return $propsArr; } }