public function fetch(string $name)
{
if (!isset($_COOKIE[$name])) {
return null;
}
try {
$stored = $_COOKIE[$name];
$config = self::getConfig($stored);
$decrypted = Crypto::decrypt($stored, $this->key, $config->ENCODING);
if (empty($decrypted)) {
return null;
}
return \json_decode($decrypted->getString(), true);
} catch (InvalidMessage $e) {
return null;
}
}