lithium\storage\session\strategy\Encrypt::write()

public method

Write encryption method.

Parameters

  • mixed $data

    The data to be encrypted.

  • array $options

    Options for this method.

Returns

string

Returns the encrypted data that was written.

Source

	public function write($data, array $options = []) {
		$class = $options['class'];

		$futureData = $this->read(null, ['key' => null] + $options) ?: [];
		$futureData = [$options['key'] => $data] + $futureData;

		$payload = null;

		if (!empty($futureData)) {
			$payload = $this->_encrypt($futureData);
		}

		$class::write('__encrypted', $payload, ['strategies' => false] + $options);
		return $payload;
	}