public function getCookie($name, $deleteIfInvalid = true)
    {
        // Get cookie value
        $value = $this->request->cookies->get($name);

        // Decode if encrypted
        if ($this->config('cookies.encrypt')) {
            $value = \Yee\Http\Util::decodeSecureCookie(
                $value,
                $this->config('cookies.secret_key'),
                $this->config('cookies.cipher'),
                $this->config('cookies.cipher_mode')
            );
            if ($value === false && $deleteIfInvalid) {
                $this->deleteCookie($name);
            }
        }

        return $value;
    }