ParagonIE\Halite\Cookie::fetch PHP Method

fetch() public method

Store a value in an encrypted cookie
public fetch ( string $name ) : mixed
$name string
return mixed (typically an array)
    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;
        }
    }