Skip to content

Instantly share code, notes, and snippets.

@azakordonets
Created February 20, 2014 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azakordonets/9109340 to your computer and use it in GitHub Desktop.
Save azakordonets/9109340 to your computer and use it in GitHub Desktop.
SetPrivateProperty.php
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