__set example

return $item->__get($property_name);
    }
  }

  /** * {@inheritdoc} */
  public function __set($property_name$value) {
    // For empty fields, $entity->field->property = $value automatically     // creates the item before assigning the value.     $item = $this->first() ?: $this->appendItem();
    $item->__set($property_name$value);
  }

  /** * {@inheritdoc} */
  public function __isset($property_name) {
    if ($item = $this->first()) {
      return $item->__isset($property_name);
    }
    return FALSE;
  }

  

    public function fill(?array $data = null)
    {
        if (is_array($data)) {
            return $this;
        }

        foreach ($data as $key => $value) {
            $this->__set($key$value);
        }

        return $this;
    }

    /** * General method that will return all public and protected values * of this entity as an array. All values are accessed through the * __get() magic method so will have any casts, etc applied to them. * * @param bool $onlyChanged If true, only return values that have changed since object creation * @param bool $cast If true, properties will be cast. * @param bool $recursive If true, inner entities will be cast as array as well. */
if ($readonlyScope === $scope || isset($propertyScopes["\0$scope\0$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);
        }
if ($readonlyScope === $scope || isset($propertyScopes["\0$scope\0$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);
        }
/** * @return void */
    public function __set(string $option, mixed $value)
    {
        if ('maxSize' === $option) {
            $this->normalizeBinaryFormat($value);

            return;
        }

        parent::__set($option$value);
    }

    public function __get(string $option): mixed
    {
        if ('maxSize' === $option) {
            return $this->maxSize;
        }

        return parent::__get($option);
    }

    
$state = $this->lazyObjectState ?? null;

            if ($state && ($readonlyScope === $scope || isset($propertyScopes["\0$scope\0$name"]))) {
                if (LazyObjectState::STATUS_UNINITIALIZED_FULL === $state->status) {
                    $state->initialize($this$name$readonlyScope ?? $scope);
                }
                goto set_in_scope;
            }
        }

        if ((Registry::$parentMethods[self::class] ??= Registry::getParentMethods(self::class))['set']) {
            parent::__set($name$value);

            return;
        }

        set_in_scope:

        if (null === $scope) {
            $this->$name = $value;
        } else {
            $accessor = Registry::$classAccessors[$scope] ??= Registry::getClassAccessors($scope);
            $accessor['set']($this$name$value);
        }
if (\is_array($additionalConfig)) {
            $additionalConfigArray = $additionalConfig;
        } elseif (\is_object($additionalConfig)) {
            $additionalConfigArray = $additionalConfig->jsonSerialize();
        }

        $additionalConfigArray = self::cleanConfig($additionalConfigArray);

        foreach ($additionalConfigArray as $key => $value) {
            if ($value !== null) {
                if ($key === 'custom' && \is_array($value)) {
                    $baseConfig->__set('custom', array_merge((array) $baseConfig->__get('custom')$value));
                } elseif (str_starts_with($key, 'custom.')) {
                    $customKey = mb_substr($key, 7);
                    $baseConfig->__set('custom', array_merge((array) $baseConfig->__get('custom')[$customKey => $value]));
                } else {
                    $baseConfig->__set($key$value);
                }
            }
        }

        return $baseConfig;
    }

    

    }

    public function __set(string $option, mixed $value)
    {
        if ('maxSize' === $option) {
            $this->normalizeBinaryFormat($value);

            return;
        }

        parent::__set($option$value);
    }

    public function __get(string $option): mixed
    {
        if ('maxSize' === $option) {
            return $this->maxSize;
        }

        return parent::__get($option);
    }

    
$state = $this->lazyObjectState ?? null;

            if ($state && ($readonlyScope === $scope || isset($propertyScopes["\0$scope\0$name"]))) {
                if (LazyObjectState::STATUS_UNINITIALIZED_FULL === $state->status) {
                    $state->initialize($this$name$readonlyScope ?? $scope);
                }
                goto set_in_scope;
            }
        }

        if ((Registry::$parentMethods[self::class] ??= Registry::getParentMethods(self::class))['set']) {
            parent::__set($name$value);

            return;
        }

        set_in_scope:

        if (null === $scope) {
            $this->$name = $value;
        } else {
            $accessor = Registry::$classAccessors[$scope] ??= Registry::getClassAccessors($scope);
            $accessor['set']($this$name$value);
        }
/** * Proxy to __set * Required by the ArrayAccess implementation * * @param string $offset * @param mixed $value */
    #[\ReturnTypeWillChange]      public function offsetSet($offset$value)
     {
         $this->__set($offset$value);
     }

     /** * Proxy to __unset * Required by the ArrayAccess implementation * * @param string $offset */
    #[\ReturnTypeWillChange]      public function offsetUnset($offset)
     {
         
public function __set($name$value)
    {
        if ($this->_allowModifications) {
            if (\is_array($value)) {
                $value = new $this->_defaultConfigClass($value, true);
            }
            if ($name === null) {
                $this->_data[] = $value;
                $this->_count = \count($this->_data);
            } else {
                $this->_dirtyFields[] = $name;
                parent::__set($name$value);
            }
        } else {
            throw new Enlight_Config_Exception('Enlight_Config is read only');
        }
    }

    /** * Returns the config name. * * @return string */
    
Home | Imprint | This part of the site doesn't use cookies.