You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
482 B
24 lines
482 B
<?php
|
|
|
|
namespace DeepCopy\Filter;
|
|
|
|
use DeepCopy\Reflection\ReflectionHelper;
|
|
|
|
/**
|
|
* @final
|
|
*/
|
|
class SetNullFilter implements Filter
|
|
{
|
|
/**
|
|
* Sets the object property to null.
|
|
*
|
|
* {@inheritdoc}
|
|
*/
|
|
public function apply($object, $property, $objectCopier)
|
|
{
|
|
$reflectionProperty = ReflectionHelper::getProperty($object, $property);
|
|
|
|
$reflectionProperty->setAccessible(true);
|
|
$reflectionProperty->setValue($object, null);
|
|
}
|
|
}
|
|
|