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

Breadcrumb

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

function LazyObjectRegistry::getClassResetters

3 calls to LazyObjectRegistry::getClassResetters()
LazyGhostTrait::createLazyGhost in vendor/symfony/var-exporter/LazyGhostTrait.php
Creates a lazy-loading ghost instance.
LazyProxyTrait::createLazyProxy in vendor/symfony/var-exporter/LazyProxyTrait.php
Creates a lazy-loading virtual proxy.
LazyProxyTrait::__unserialize in vendor/symfony/var-exporter/LazyProxyTrait.php

File

vendor/symfony/var-exporter/Internal/LazyObjectRegistry.php, line 50

Class

LazyObjectRegistry
Stores the state of lazy objects and caches related reflection information.

Namespace

Symfony\Component\VarExporter\Internal

Code

public static function getClassResetters($class) {
    $classProperties = [];
    if ((self::$classReflectors[$class] ??= new \ReflectionClass($class))->isInternal()) {
        $propertyScopes = [];
    }
    else {
        $propertyScopes = Hydrator::$propertyScopes[$class] ??= Hydrator::getPropertyScopes($class);
    }
    foreach ($propertyScopes as $key => [
        $scope,
        $name,
        $readonlyScope,
    ]) {
        $propertyScopes[$k = "\x00{$scope}\x00{$name}"] ?? $propertyScopes[$k = "\x00*\x00{$name}"] ?? ($k = $name);
        if ($k === $key && "\x00{$class}\x00lazyObjectState" !== $k) {
            $classProperties[$readonlyScope ?? $scope][$name] = $key;
        }
    }
    $resetters = [];
    foreach ($classProperties as $scope => $properties) {
        $resetters[] = \Closure::bind(static function ($instance, $skippedProperties) use ($properties) {
            foreach ($properties as $name => $key) {
                if (!\array_key_exists($key, $skippedProperties)) {
                    unset($instance->{$name});
                }
            }
        }, null, $scope);
    }
    return $resetters;
}

API Navigation

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