Created
February 20, 2014 08:42
-
-
Save azakordonets/9109340 to your computer and use it in GitHub Desktop.
SetPrivateProperty.php
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 setProtectedProperty($class, $propertyName, $setValue) | |
{ | |
$reflectObj = new \ReflectionObject($class); | |
$extensions = $reflectObj->getProperty($propertyName); | |
$extensions->setAccessible(true); | |
$extensions->setValue($class, $setValue); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment