function LazyObjectState::reset
1 call to LazyObjectState::reset()
- LazyObjectState::initialize in vendor/
symfony/ var-exporter/ Internal/ LazyObjectState.php
File
-
vendor/
symfony/ var-exporter/ Internal/ LazyObjectState.php, line 70
Class
- LazyObjectState
- Keeps the state of lazy objects.
Namespace
Symfony\Component\VarExporter\InternalCode
public function reset($instance) : void {
$class = $instance::class;
$propertyScopes = Hydrator::$propertyScopes[$class] ??= Hydrator::getPropertyScopes($class);
$skippedProperties = $this->skippedProperties;
$properties = (array) $instance;
foreach ($propertyScopes as $key => [
$scope,
$name,
$readonlyScope,
]) {
$propertyScopes[$k = "\x00{$scope}\x00{$name}"] ?? $propertyScopes[$k = "\x00*\x00{$name}"] ?? ($k = $name);
if ($k === $key && (null !== $readonlyScope || !\array_key_exists($k, $properties))) {
$skippedProperties[$k] = true;
}
}
foreach (LazyObjectRegistry::$classResetters[$class] as $reset) {
$reset($instance, $skippedProperties);
}
foreach ((array) $instance as $name => $value) {
if ("\x00" !== ($name[0] ?? '') && !\array_key_exists($name, $skippedProperties)) {
unset($instance->{$name});
}
}
$this->status = self::STATUS_UNINITIALIZED_FULL;
}