Extends
lithium\core\Object
Write strategy method.
Adds an HMAC signature to the data. Note that this will transform the
passed `$data` to an array, and add a `__signature` key with the HMAC-caculated
value.
Parameters
- mixed $data The data to be signed.
- array $options Options for this method.
Returns
array Data & signature.Links
Source
public function write($data, array $options = array()) {
$class = $options['class'];
$futureData = $class::read(null, array('strategies' => false));
$futureData = array($options['key'] => $data) + $futureData;
unset($futureData['__signature']);
$signature = static::_signature($futureData);
$class::write('__signature', $signature, array('strategies' => false) + $options);
return $data;
}