lithium\storage\session\strategy\Encrypt::write()
Write encryption method.
Parameters
-
mixed
$data
The data to be encrypted.
-
array
$options
Options for this method.
Returns
stringReturns 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)) {
if ($this->_mcrypt) {
$payload = $this->_bcEncrypt($futureData);
} else {
$payload = $this->_encrypt($futureData);
}
}
$class::write('__encrypted', $payload, ['strategies' => false] + $options);
return $payload;
}