Files
huangjingfen/pro_v3.5.1/vendor/topthink/think-swoole/src/concerns/ModifyProperty.php
panchengyong 7acbf45ff7 new files
2026-03-07 22:29:07 +08:00

19 lines
474 B
PHP
Executable File

<?php
namespace think\swoole\concerns;
use ReflectionObject;
trait ModifyProperty
{
protected function modifyProperty($object, $value, $property = 'app')
{
$reflectObject = new ReflectionObject($object);
if ($reflectObject->hasProperty($property)) {
$reflectProperty = $reflectObject->getProperty($property);
$reflectProperty->setAccessible(true);
$reflectProperty->setValue($object, $value);
}
}
}