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

Breadcrumb

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

function LazyProxyTrait::__set

File

vendor/symfony/var-exporter/LazyProxyTrait.php, line 173

Class

LazyProxyTrait

Namespace

Symfony\Component\VarExporter

Code

public function __set($name, $value) : void {
    $propertyScopes = Hydrator::$propertyScopes[$this::class] ??= Hydrator::getPropertyScopes($this::class);
    $scope = null;
    $instance = $this;
    if ([
        $class,
        ,
        $readonlyScope,
    ] = $propertyScopes[$name] ?? null) {
        $scope = Registry::getScope($propertyScopes, $class, $name, $readonlyScope);
        if ($readonlyScope === $scope || isset($propertyScopes["\x00{$scope}\x00{$name}"])) {
            if ($state = $this->lazyObjectState ?? null) {
                $instance = $state->realInstance ??= ($state->initializer)();
            }
            goto set_in_scope;
        }
    }
    if ($state = $this->lazyObjectState ?? null) {
        $instance = $state->realInstance ??= ($state->initializer)();
    }
    elseif ((Registry::$parentMethods[self::class] ??= Registry::getParentMethods(self::class))['set']) {
        parent::__set($name, $value);
        return;
    }
    set_in_scope:
    if (null === $scope) {
        $instance->{$name} = $value;
    }
    else {
        $accessor = Registry::$classAccessors[$scope] ??= Registry::getClassAccessors($scope);
        $accessor['set']($instance, $name, $value);
    }
}

API Navigation

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