Store a value in an encrypted cookie

@param string $name
@return mixed|null (typically an array)
@throws InvalidDigestLength
@throws InvalidSignature
@throws CannotPerformOperation
@throws InvalidType
@throws \TypeError
1736
public function fetch(string $name)
    {
        if (!isset($_COOKIE[$name])) {
            return null;
        }
        try {
            /** @var string|array|int|float|bool $stored */
            $stored = $_COOKIE[$name];
            if (!\is_string($stored)) {
                throw new InvalidType('Cookie value is not a string');
            }
            $config = self::getConfig($stored);
            $decrypted = Crypto::decrypt(
                $stored,
                $this->key,
                $config->ENCODING
            );
            return \json_decode($decrypted->getString(), true);
        } catch (InvalidMessage $e) {
            return null;
        }
    }
1309702
public static function set(
        $name,
        $value,
        $expiry = 90,
        $path = null,
        $domain = null,
        $secure = false,
        $httpOnly = true
    ) {
        return self::get_inst()->set($name, $value, $expiry, $path, $domain, $secure, $httpOnly);
    }
412013
public static function put($name, $value, $expiration = 0, $path = '/', $domain = null, $secure = false)
    {
        if ($expiration !== 0) {
            $expiration = time() + ($expiration * 60);
        }

        $value = static::hash($value) . '+' . $value;

        // are we attempting to send a secure cookie over the insecure HTTP.
        if ($secure === true && Config::get('ssl') === false) {
            throw new \RuntimeException("Attempting to set secure cookie over HTTP!");
        }

        static::$jar[$name] = compact('name', 'value', 'expiration', 'path', 'domain', 'secure');

        return true;
    }
969262
public function get($name)
    {
        $this->toString = isset($_COOKIE[$name]) ? $_COOKIE[$name] : "";
        return new InputUtilities($this->toString);
    }
273792
public function get($name)
    {
        $key = mb_strtolower($name);
        foreach ($this->cookies as $cookie) {
            if (mb_strtolower($cookie->getName()) === $key) {
                return $cookie;
            }
        }

        return null;
    }
341972
public function getCookie(string $name = null)
    {
        if ($name === null) {
            return $this->cookies;
        }

        return $this->resolvePath($this->cookies, $name);
    }
834097
public function getCookieParam($name)
    {
        return isset($this->cookies[$name]) ? $this->cookies[$name] : false;
    }
248543
protected function hashClientOptions($name)
    {
        $this->_encOptions = empty($this->clientOptions) ? '' : Json::htmlEncode($this->clientOptions);
        $this->_hashVar = $name . '_' . hash('crc32', $this->_encOptions);
    }
78340
public function getStorage($name)
    {
        $class = sprintf('\\MwbExporter\\Storage\\%sStorage', ucfirst($name));
        if (class_exists($class)) {
            $storage = new $class();

            return $storage;
        }

        throw new \InvalidArgumentException(sprintf('Storage %s not found.', $class));
    }
538586
public function offsetGet($name)
    {
        if (!$this->offsetExists($name)) {
            throw new \InvalidArgumentException(sprintf('Fact "%s" is not defined.', $name));
        }

        $value = $this->values[$name];

        // If the value is already frozen, or if it's not callable, or if it's protected, return the raw value
        if (isset($this->frozen[$name]) || !is_object($value) || $this->protected->contains($value) || !$this->isCallable($value)) {
            return $value;
        }

        // If this is a shared value, resolve, freeze, and return the result
        if ($this->shared->contains($value)) {
            $this->frozen[$name] = true;
            $this->raw[$name]    = $value;

            return $this->values[$name] = $value($this);
        }

        // Otherwise, resolve and return the result
        return $value($this);
    }
262119
public static function set($name, $value, $expire = 0, $path = '/', $domain = '', $secure = '')
	{
		if(!self::$isInit)
		{
			self::init();
		}
		return setcookie($name, $value, is_numeric($expire) ? $expire : self::$expire, '' == $path ? self::$path : $path, '' == $domain ? self::$domain : $domain, '' == $secure ? self::$secure : $secure);
	}
551515
public function get($name)
    {
        $cookie_name = $this->getName($name);
        if (isset($_COOKIE[$cookie_name])) {
            $cookie_value = $this->authcode($_COOKIE[$cookie_name], 'DECODE', $this->_securekey);
            $cookie_value = $this->unpack($cookie_value);
            return isset($cookie_value[0]) ? $cookie_value[0] : null;
        } else {
            return null;
        }
    }
771815
public function getCookie($name)
    {
        if (!$this->_cookies->has($name)) {
            return null;
        }

        $cookie = $this->_cookies->get($name);

        return $this->convertCookieToArray($cookie);
    }
968612
public function getCookie($name)
    {

        $filter = $default = '';

        $cookie = $this->getVar($name, $filter, $default, "cookies");

        //@TODO cookie before return
        return empty($cookie) ? false : $cookie;
    }
155638
public function get($name = '')
    {
        $result = '';
        if (isset($_COOKIE[$name])) {
            $result = $_COOKIE[$name];
        }

        return $result;
    }
1316985
public function &createCookie(string $name)
    {
        $cookie = new Cookie();
        $cookie->setName($name);

        $this->addCookie($cookie);

        return $cookie;
    }
554097
public function getCookie($name = null)
    {
        $cookie  = $_COOKIE;
        $encrypt = $this->vitex->getConfig('cookies.encrypt');
        if ($encrypt) {
            $secret_key = $this->vitex->getConfig('cookies.secret_key');
            foreach ($cookie as &$c) {
                try {
                    $c = Utils::decrypt($c, $secret_key);
                } catch(Exception $e){}
            }
        }
        if ($name === null) {
            return $cookie;
        }
        return isset($cookie[$name]) ? $cookie[$name] : '';
    }