public static function assignProperty($object, $property, $value)
    {
        $refl = new \ReflectionObject($object);
        $prop = $refl->getProperty($property);
        $prop->setAccessible(true);
        $prop->setValue($object, $value);

        return $value;
    }
public static function assignProperty($object, $property, $value)
    {
        $refl = new \ReflectionObject($object);
        $prop = $refl->getProperty($property);
        $prop->setAccessible(true);
        $prop->setValue($object, $value);

        return $value;
    }
public static function assignProperty ( $ object , $ property , $ value ) { $ refl = new \ ReflectionObject ( $ object ) ; $ prop = $ refl -> getProperty ( $ property ) ; $ prop -> setAccessible ( true ) ; $ prop -> setValue ( $ object , $ value ) ; return $ value ; }
Assign the value of a property of an object, bypassing visibility restrictions.

@param object $object
@param string $property property name
@param mixed  $value

@return mixed Value of $object->property
Assign the value of a property of an object bypassing visibility restrictions .