Files
kulakpos_web/vendor/symfony/var-exporter/Internal/LazyObjectState.php
eko54r 1228c52538
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m36s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 42s
Build, Push and Deploy / deploy-production (push) Has been skipped
update after stop build
2026-04-18 16:10:57 +07:00

49 lines
1.2 KiB
PHP

<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\VarExporter\Internal;
/**
* Keeps the state of lazy objects.
*
* As a micro-optimization, this class uses no type declarations.
*
* @internal
*/
class LazyObjectState
{
public ?\Closure $initializer = null;
public object $realInstance;
public object $cloneInstance;
public function __clone()
{
if (isset($this->cloneInstance)) {
try {
$this->realInstance = $this->cloneInstance;
} finally {
unset($this->cloneInstance);
}
} elseif (isset($this->realInstance)) {
$this->realInstance = clone $this->realInstance;
}
}
public function __get($name)
{
if ('realInstance' !== $name) {
throw new \BadMethodCallException(\sprintf('No such property "%s::$%s"', self::class, $name));
}
return $this->realInstance = ($this->initializer)();
}
}