Updates the data.

Data is a readable stream resource.

@param resource|string $data

@return string
327302
public function put($data)
    {
        file_put_contents($this->path, $data);
        clearstatcache(true, $this->path);

        return $this->getETag();
    }
1205135
public function write($data)
    {

        if (is_resource($data)) {
            return (bool)stream_copy_to_stream($data, $this->resource());
        }

        $isStream = $data instanceof Stream;

        if (!$isStream && Type::isStringable($data)) {
            return (bool)fwrite($this->resource(), $data);
        }

        if (!$isStream) {
            throw new TypeException('Unsupported data type in write(): ' . Type::of($data));
        }

        $dataResource = $data->resource();

        if (is_resource($dataResource)) {
            return $this->write($dataResource);
        }

        $resource = $this->resource();

        $bytes = 0;

        foreach ($data as $chunk) {
            $bytes += fwrite($resource, $chunk);
        }

        return (bool)$bytes;

    }
430888
public function setData($data)
    {
        $this->data = $data instanceof Data ? $data : new Data($data);

        return $this;
    }
439428
public function refresh(Data $data)
    {
        if ($data->isFresh()) {
            return $data;
        }

        return $this->find($data->id(true), $data);
    }
178565
private function createStream(string $data = '')
    {
        $stream = fopen('php://temp', 'w+b');
        fwrite($stream, $data);
        rewind($stream);

        return $stream;
    }
577322
public function postRaw($data)
    {
        $this->content = $data;
        $url = $this->url;
        if (!empty($this->replaceParams)) {
            $url = self::buildUri($url, $this->replaceParams);
        }
        $this->adapter->setResponseTimeout($this->getResponseTimeout());
        $this->adapter->setConnectTimeout($this->getConnectTimeout());

        return $this->adapter->post(
            $url,
            array(
                self::HEADERS => $this->headers,
                self::CONTENT => $this->content,
            )
        );
    }
675048
public function updateIf($data)
    {
        $updated = false;
        foreach ($data as $key => $val) {
            if ($val) {
                $this->{$key} = $val;
                $updated = true;
            }
        }

        if ($updated) {
            $this->save();
        }

        return $this;
    }
952290
public function prepend($data) {
        if ($this->exist()) {
            return $this->write($data.$this->read());
        }
        return $this->write($data);
    }
313918
public function update($data = array()) {
    foreach ($data as $key => $value) {
      $this->{$key} = $value;
    }

    $postData = array();
    foreach (static::$properties as $name) {
      $postData[$name] = $this->data[$name];
    }

    $this->client->put(static::$path . '/' . $this->id(), $postData);

    return $this;
  }
310345
public function update(array $data)
    {
        $this->attributes = new Collection(array_merge($this->attributes->toArray(), $data));

        return $this->save();
    }
460921
public function updateOrInsert($data)
    {
        if ($this->first()) {
            return $this->update($data);
        } else {
            return $this->insert($data);
        }
    }
860879
protected function update(Data $data)
    {
        $this->__before('update', $data);
        $data->validate();

        if (!$this->doUpdate($data)) {
            return false;
        }

        $this->pack([], $data);
        $this->__after('update', $data);

        return true;
    }
1207321
public function update(array $data)
    {
        $template = Basecamp::templates()->update($this->id, $data);

        $this->setAttributes($template);

        return $template;
    }
647792
public function processUpdate(array $data)
	{
		$set = $this->formatCmd('set');

		$data[$set] = isset($data[$set]) ? $data[$set] : [];

		foreach ($data as $index => $value) {

			if (substr($index, 0, 1) !== $this->cmd) {
				$data[$set][$index] = $value;
				unset($data[$index]);
				continue;
			}

			$ckey = substr($index, 1);

			if ($ckey === 'unset') {
				$data[$index] = array_fill_keys(array_values((array) $value), '');
			} elseif (in_array($ckey, ['setOnInsert', 'addToSet', 'push'])) {
				$data[$index] = $this->processData($value);
			}
		}

		if (empty($data[$set])) {
			unset($data[$set]);
		} else {
			$data[$set] = $this->processData($data[$set]);
		}

		return $data;
	}
1153520
public function update($data)
    {
        // Error if hash is already calculated.
        if ($this->hash) {
            throw new \LogicException('You may not add more data to a '
                . 'complete tree hash.');
        }

        // Buffer incoming data.
        $this->buffer .= $data;

        // When there is more than a MB of data, create a checksum.
        while (strlen($this->buffer) >= self::MB) {
            $data = substr($this->buffer, 0, self::MB);
            $this->buffer = substr($this->buffer, self::MB) ?: '';
            $this->checksums[] = hash($this->algorithm, $data, true);
        }

        return $this;
    }
178655
public function update_all($data)
    {
        $data = $this->trigger('before_update', $data);
        $result = $this->_database->set($data)
                           ->update($this->_table);
        $this->trigger('after_update', array($data, $result));

        return $result;
    }
1245510
public function update($data, $object)
	{
		$updated = $object->update($data);

		// @todo: Double Check that we should be returning updated not object
		if( ! $updated)
		{
			return new Payload($object , 'not_updated');
		}

		return new Payload($object, 'updated');
	}