function LazyObjectState::initialize
File
-
vendor/
symfony/ var-exporter/ Internal/ LazyObjectState.php, line 46
Class
- LazyObjectState
- Keeps the state of lazy objects.
Namespace
Symfony\Component\VarExporter\InternalCode
public function initialize($instance, $propertyName, $propertyScope) {
if (self::STATUS_UNINITIALIZED_FULL !== $this->status) {
return $this->status;
}
$this->status = self::STATUS_INITIALIZED_PARTIAL;
try {
if ($defaultProperties = array_diff_key(LazyObjectRegistry::$defaultProperties[$instance::class], $this->skippedProperties)) {
PublicHydrator::hydrate($instance, $defaultProperties);
}
($this->initializer)($instance);
} catch (\Throwable $e) {
$this->status = self::STATUS_UNINITIALIZED_FULL;
$this->reset($instance);
throw $e;
}
return $this->status = self::STATUS_INITIALIZED_FULL;
}