Created
February 11, 2014 15:10
-
-
Save azakordonets/8936645 to your computer and use it in GitHub Desktop.
Get private property from instance of the class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function getProtectedProperty($class, $propertyName) | |
{ | |
$reflectObj = new \ReflectionObject($class); | |
$extensions = $reflectObj->getProperty($propertyName); | |
$extensions->setAccessible(true); | |
return $extensions->getValue($class); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment