Modifies a property and clears the cache.

@param object $user
@param mixed  $newValue
@param string $property
172698
public function modifyProperty($user, $newValue, $property = self::LOGIN_PROPERTY)
    {
        $this->checkProperty($property, true);

        $propertyObject = $this->properties[$property];
        if (is_string($propertyObject)) {
            $this->properties[$property] = $propertyObject = new ReflectionProperty($user, $propertyObject);
        }

        $propertyObject->setAccessible(true);
        $propertyObject->setValue($user, $newValue);

        $oid = spl_object_hash($user);
        if (!array_key_exists($oid, $this->lazyValueCache)) {
            $this->lazyValueCache[$oid] = array();
        }

        $this->lazyValueCache[$oid][$property] = $newValue;
    }
287174
public function getPropertyValue($user, $property = self::LOGIN_PROPERTY, $strict = false)
    {
        if ($this->checkProperty($property, $strict)) {
            $oid = spl_object_hash($user);
            if (null !== $cacheHit = $this->resolveCache($oid, $property)) {
                return $cacheHit;
            }

            if (is_string($this->properties[$property])) {
                $this->properties[$property] = new ReflectionProperty($user, $this->properties[$property]);
            }
            $this->properties[$property]->setAccessible(true);

            return $this->lazyValueCache[$oid][$property] = $this->properties[$property]->getValue($user);
        }
    }
299065
public function fill($newValue): self
    {
        foreach ($this->values as $index => $value) {
            $this->values[$index] = $newValue;
        }

        return $this;
    }
1201818
public function append($newvalue) : void
    {
        $index = count((array)$this);
        $this->offsetSet($index, $newvalue);
    }
684767
public function adjustRoundingError($property, $new, $tolerance = 0.01)
    {
        $this->validateProperty($property);

        $old  = $this->get($property);
        $diff = Price::round($new - $old);

        if (abs($diff) <= abs($tolerance)) {
            $price = Price
                ::create()
                ->setGross($diff)
                ->setNet($diff)
                ->setTax(0)
                ->setTaxPercent(key($this->perTaxRate))
            ;

            $this->addPrice($price);
        }

        return $this;
    }
370054
public void updateChangeLog(final Principal user, final Verb verb, final PropertyKey key, final Object previousValue, final Object newValue) {

		if ((Settings.ChangelogEnabled.getValue() || Settings.UserChangelogEnabled.getValue()) && key != null) {

			final String name = key.jsonName();

			if (!hiddenPropertiesInAuditLog.contains(name) && !(key.isUnvalidated() || key.isReadOnly())) {

				final JsonObject obj = new JsonObject();

				obj.add("time",     toElement(System.currentTimeMillis()));
				obj.add("userId",   toElement(user.getUuid()));
				obj.add("userName", toElement(user.getName()));
				obj.add("verb",     toElement(verb));
				obj.add("key",      toElement(key.jsonName()));
				obj.add("prev",     toElement(previousValue));
				obj.add("val",      toElement(newValue));

				if (Settings.ChangelogEnabled.getValue()) {
					changeLog.append(obj.toString());
					changeLog.append("\n");
				}

				if (Settings.UserChangelogEnabled.getValue()) {

					// remove user for user-centric logging to reduce redundancy
					obj.remove("userId");
					obj.remove("userName");

					// add target to identify change event
					obj.add("target", toElement(getUuid()));

					appendUserChangelog(user.getUuid(), obj.toString());
				}
			}
		}
	}
1327629
public static void setProperty2(Object newValue, Object object, String property) {
        setProperty(object, property, newValue);
    }
1331175
function (name, newValue) {
		var property = this.getProperty(name);
		if (!property) {
			this.initProperty(name, newValue);
		}
		else {
			property.set(newValue);
		}
	}
406655
public function setProperty($propertyName, $propertyValue)
    {
        Validate::isString($propertyName, 'propertyName');
        Validate::notNull($propertyValue, 'propertyValue');

        $this->_customProperties[strtolower($propertyName)] = $propertyValue;
    }
878207
public static function hijackProperty($object, $propertyName, $newValue)
    {
        Utils::bindAndCall(function () use ($object, $propertyName, $newValue) {
            $object->$propertyName = $newValue;
        }, $object);
    }
340137
public void replace(V oldValue, V newValue) {
		if (values.contains(oldValue)) {
			int index = values.indexOf(oldValue);
			values.remove(oldValue);
			values.add(index, newValue);
			
			if (oldValue instanceof JsonEntity) {
				((JsonEntity)oldValue).removePropertyChangeListener(propListener);
			}
			
			if (newValue instanceof JsonEntity) {
				((JsonEntity)newValue).removePropertyChangeListener(propListener);
			}
			
			firePropertyChange("#" + index, oldValue, newValue);
		}
	}
194346
public function offsetSet($key, $newval)
    {
        if ($def = in_array($key, array_keys($this->keys))) {
            parent::offsetSet($key, $newval);
        } else {
            throw new UnexpectedValueException($key.' is not defined in metadata definition '.get_class($this).'.');
        }
    }
436232
function setProperty(property, newValue) {
            var originalValue;

            if (newValue != originalValue) {
                originalValue = this[property];
                this[property] = newValue;

                this.dispatch('change:' + property, {
                    originalValue : originalValue,
                    newValue      : newValue
                });
            }

            return this;
        }
26000
public function updateTenancy(Authenticatable $user, TenantParticipantContract $owner, TenantParticipantContract $creator)
    {
        $this->user          = $user;
        $this->tenantOwner   = $owner;
        $this->tenantCreator = $creator;

        return $this;
    }
1370647
public static function update($itemid, $newvalue) {
        require_capability('moodle/tag:manage', context_system::instance());
        $tag = core_tag_tag::get($itemid, '*', MUST_EXIST);
        $tag->update(array('rawname' => $newvalue));
        return new self($tag);
    }
693335
public function replace($oldValue, $newValue)
    {
        if (!is_string($oldValue)) {
            throw new UnexpectedTypeException($oldValue, 'string', 'oldValue');
        }
        if (empty($oldValue)) {
            return;
        }
        if (!is_string($newValue) && null !== $newValue) {
            throw new UnexpectedTypeException($newValue, 'string or null', 'newValue');
        }

        $key = array_search($oldValue, $this->values, true);
        if (false !== $key) {
            if (empty($newValue)) {
                unset($this->values[$key]);
            } else {
                $this->values[$key] = $newValue;
            }
        }
    }
492390
private static <T> void  setIfNew(Property<T> prop, T newValue)
  {
    if(!Objects.equals(prop.getValue(), newValue))
    {
      prop.setValue(newValue);
    }
  }