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.
25 lines
482 B
25 lines
482 B
3 years ago
|
<?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);
|
||
|
}
|
||
|
}
|