Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LazyObjectState.php

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\Internal

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal