function LazyGhostTrait::__serialize
File
-
vendor/
symfony/ var-exporter/ LazyGhostTrait.php, line 311
Class
Namespace
Symfony\Component\VarExporterCode
public function __serialize() : array {
$class = self::class;
if ((Registry::$parentMethods[$class] ??= Registry::getParentMethods($class))['serialize']) {
$properties = parent::__serialize();
}
else {
$this->initializeLazyObject();
$properties = (array) $this;
}
unset($properties["\x00{$class}\x00lazyObjectState"]);
if (Registry::$parentMethods[$class]['serialize'] || !Registry::$parentMethods[$class]['sleep']) {
return $properties;
}
$scope = get_parent_class($class);
$data = [];
foreach (parent::__sleep() as $name) {
$value = $properties[$k = $name] ?? $properties[$k = "\x00*\x00{$name}"] ?? $properties[$k = "\x00{$class}\x00{$name}"] ?? $properties[$k = "\x00{$scope}\x00{$name}"] ?? ($k = null);
if (null === $k) {
trigger_error(\sprintf('serialize(): "%s" returned as member variable from __sleep() but does not exist', $name), \E_USER_NOTICE);
}
else {
$data[$k] = $value;
}
}
return $data;
}