Process saving the value to memory.

@param  string  $name
@param  mixed   $userId
@param  mixed   $value
@param  bool    $isNew

@return void
339899
protected function saving($name, $userId, $value = null, $isNew = true)
    {
        $meta = $this->getModel()->search($name, $userId)->first();

        if (is_null($value) || $value === ':to-be-deleted:') {
            !is_null($meta) && $meta->delete();
            return;
        }

        if (true === $isNew && is_null($meta)) {
            $meta = $this->getModel();

            $meta->name    = $name;
            $meta->user_id = $userId;
        }

        $meta->value = serialize($value);
        $meta->save();
    }
560188
public function set($name, $value)
	{
		if ( $value === null ) {
			unset($this->settings[$name]);
		}
		else {
			$this->settings[$name] = $value;
		}

		$this->store();
	}
92521
private function dumpNull(&$value, $name): void
  {
    if ($this->scalarReferences)
    {
      list($id, $ref) = $this->isReference($value);
    }
    else
    {
      $id  = null;
      $ref = null;
    }

    $this->writer->writeNull($id, $ref, $name);
  }
2266
public function setValue($name, $value) {
        $this->_states[count($this->_states) - 1][1][$name] = $value;
    }
1049378
protected function processNodePropertyObject($name, $value, array &$properties)
    {
        if (!empty($value->type) || !empty($value->lang)) {
            $properties[$name]->values[] = $value;

            // @type = @id
        } elseif (!empty($value->id)) {
            $properties[$name]->values[] = $value->id;
        }
    }
350097
private function _make(&$value, $index, $userdata)
    {
        list($entity, $attribute) = $userdata;

        $value = entity($entity)->findByAttribute($attribute, $value);
    }
357644
public function saveSubscription(int $userId = null) : void
    {
        $json = \file_get_contents('php://input');

        if (!$json)
        {
            return;
        }

        $data = \json_decode($json, true);

        if (!$data || empty($data['endpoint']) || empty($data['publicKey']) || empty($data['authToken']))
        {
            return;
        }

        $row = $this->subscriptionTable->findActive()->where('endpoint', $data['endpoint'])->fetch();

        switch ($this->request->getMethod()) {
            case 'POST':
            case 'PUT':
            {
                if ($row)
                {
                    $row->update([
                        'user_id' => $userId ?: $row->user_id ?: null,
                        'key' => $data['publicKey'],
                        'token' => $data['authToken'],
                        'encoding' => $data['contentEncoding']
                    ]);
                    
                    return;
                }

                $row = $this->subscriptionTable->insert([
                    'user_id' => $userId,
                    'endpoint' => $data['endpoint'],
                    'key' => $data['publicKey'],
                    'token' => $data['authToken'],
                    'encoding' => $data['contentEncoding']
                ]);

                $this->sendNotification($row, 'Notifications enabled!', true);

                return;
            }
            case 'DELETE':
            {
                if ($row)
                {
                    $row->update([
                        'active' => 0
                    ]);
                }

                return;
            }
            default:
                throw new \Nette\Application\BadRequestException();
        }
    }
627636
public static function set(string $name, $value, string $namespace = '*'): void
    {
        self::initialize();
        $_SESSION[$namespace][$name] = $value;
    }
93163
private function dumpArray(array &$value, $name): void
  {
    list($id, $ref) = $this->isReference($value);

    if ($ref===null)
    {
      $this->writer->writeArrayOpen($id, $name);

      foreach ($value as $key => &$item)
      {
        $this->recursiveDump($item, $key);
      }

      $this->writer->writeArrayClose($id, $name);
    }
    else
    {
      $this->writer->writeArrayReference($ref, $name);
    }
  }
1134008
public function set($name, $value)
    {
        if ($name == 'id') {
            throw new InvalidCallException('Setting read-only property: ' . get_class($this) . '::' . $name);
        }
        $this->_states[$name] = $value;
        $this->save();
    }
45026
public function set($name, $value)
    {
        if (!is_numeric($value)) {
            throw new NotNumerical($name, $value);
        }
        $this->statistics[$name] = $value;
    }
278275
public function saveRecord (MapElement $map, $ownerId, $ownerSiteId, $fieldId, $isNew)
	{
		$record = null;

		if (!$isNew)
		{
			$record = MapRecord::findOne($map->id);

			if (!$record)
				throw new \Exception('Invalid map ID: ' . $map->id);
		}

		if ($record === null)
		{
			$record = new MapRecord();

			$record->id          = $map->id;
			$record->ownerId     = $ownerId;
			$record->ownerSiteId = $ownerSiteId;
			$record->fieldId     = $fieldId;
		}

		$record->lat     = $map->lat;
		$record->lng     = $map->lng;
		$record->zoom    = $map->zoom;
		$record->address = $map->address;
		$record->parts   = $map->parts;

		$this->_populateMissingData($record);

		$record->save(false);
	}
270733
protected function saveUserMultipleValue($value, int $user_id)
    {
        $previous = get_user_meta($user_id, $this->getName(), false);

        if (is_null($value) || empty($value)) {
            delete_user_meta($user_id, $this->getName());
        } elseif (empty($previous) && is_array($value)) {
            array_walk($value, function ($val) use ($user_id) {
                add_user_meta($user_id, $this->getName(), $val, false);
            });
        } else {
            delete_user_meta($user_id, $this->getName());

            array_walk($value, function ($val) use ($user_id) {
                add_user_meta($user_id, $this->getName(), $val, false);
            });
        }
    }
371121
public function setUserSetting(string $identifier, string $value): void
    {
        $this->userSettingService->setUserSetting($identifier, $value);
    }
1227269
public function iUpdateTheARecordWithTheValue(string $name, string $domain, string $value = null): void
    {
        $parameters = [
            'name' => $name,
            'domain' => $domain,
            '--value' => $value,
            '--adapter' => 'fake',
            '--params' => ['fake'],
        ];

        $input = new ArrayInput(array_filter($parameters));
        $input->setInteractive(false);

        $this->command->run($input, new NullOutput());
    }
214071
public function afterSave(bool $isNew)
    {
        if ($isNew) {
            Craft::$app->db->createCommand()
                ->insert('{{%contactform_submissions}}', [
                    'id'        => $this->id,
                    'form'      => $this->form,
                    'subject'   => $this->subject,
                    'fromName'  => $this->fromName,
                    'fromEmail' => $this->fromEmail,
                    'message'   => $this->message,
                ])
                ->execute();
        } else {
            Craft::$app->db->createCommand()
                ->update('{{%contactform_submissions}}', [
                    'form'      => $this->form,
                    'subject'   => $this->subject,
                    'fromName'  => $this->fromName,
                    'fromEmail' => $this->fromEmail,
                    'message'   => $this->message,
                ], ['id' => $this->id])
                ->execute();
        }

        parent::afterSave($isNew);
    }
416858
public function addHeader(string $name, string $value): void
    {
        parent::addHeader($name, $value);
    }