Skip to content

Instantly share code, notes, and snippets.

@l3l0
Created January 13, 2014 10:10
Show Gist options
  • Save l3l0/8397625 to your computer and use it in GitHub Desktop.
Save l3l0/8397625 to your computer and use it in GitHub Desktop.
<?php
private function setPrivateProperty($object, $propertyName, $value)
{
$reflection = new \ReflectionObject($object);
$property = $reflection->getProperty($propertyName);
$property->setAccessible(true);
$property->setValue($object, $value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment