for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Jeskew\Cache;
use JsonSerializable;
use Serializable;
abstract class EncryptedValue implements JsonSerializable, Serializable
{
/** @var string */
private $cipherText;
private $method;
private $initializationVector;
public function __construct($cipherText, $method, $iv)
$this->cipherText = $cipherText;
$this->method = $method;
$this->initializationVector = $iv;
}
public function jsonSerialize()
return [
'cipherText' => $this->cipherText,
'method' => $this->method,
'iv' => base64_encode($this->initializationVector),
];
public function serialize()
return json_encode($this->jsonSerialize());
public function unserialize($serialized)
$data = json_decode($serialized);
$this->cipherText = $data->cipherText;
$this->method = $data->method;
$this->initializationVector = base64_decode($data->iv);
/**
* @return string
*/
public function getCipherText()
return $this->cipherText;
public function getMethod()
return $this->method;
public function getInitializationVector()
return $this->initializationVector;