public function getSecure($name = '')
    {
        $result = '';
        $cookie = Craft::$app->request->cookies->get($name);
        if ($cookie !== null) {
            try {
                $data = Craft::$app->security->validateData($cookie->value);
            } catch (InvalidConfigException $e) {
                Craft::error(
                    'Error getting secure cookie: '.$e->getMessage(),
                    __METHOD__
                );
                $data = false;
            } catch (Exception $e) {
                Craft::error(
                    'Error getting secure cookie: '.$e->getMessage(),
                    __METHOD__
                );
                $data = false;
            }
            if ($cookie
                && !empty($cookie->value)
                && $data !== false
            ) {
                $result = unserialize(base64_decode($data), ['allowed_classes' => false]);
            }
        }

        return $result;
    }
public function getSecure($name = '')
    {
        $result = '';
        $cookie = Craft::$app->request->cookies->get($name);
        if ($cookie !== null) {
            try {
                $data = Craft::$app->security->validateData($cookie->value);
            } catch (InvalidConfigException $e) {
                Craft::error(
                    'Error getting secure cookie: '.$e->getMessage(),
                    __METHOD__
                );
                $data = false;
            } catch (Exception $e) {
                Craft::error(
                    'Error getting secure cookie: '.$e->getMessage(),
                    __METHOD__
                );
                $data = false;
            }
            if ($cookie
                && !empty($cookie->value)
                && $data !== false
            ) {
                $result = unserialize(base64_decode($data), ['allowed_classes' => false]);
            }
        }

        return $result;
    }
public function getSecure ( $ name = '' ) { $ result = '' ; $ cookie = Craft :: $ app -> request -> cookies -> get ( $ name ) ; if ( $ cookie !== null ) { try { $ data = Craft :: $ app -> security -> validateData ( $ cookie -> value ) ; } catch ( InvalidConfigException $ e ) { Craft :: error ( 'Error getting secure cookie: ' . $ e -> getMessage ( ) , __METHOD__ ) ; $ data = false ; } catch ( Exception $ e ) { Craft :: error ( 'Error getting secure cookie: ' . $ e -> getMessage ( ) , __METHOD__ ) ; $ data = false ; } if ( $ cookie && ! empty ( $ cookie -> value ) && $ data !== false ) { $ result = unserialize ( base64_decode ( $ data ) , [ 'allowed_classes' => false ] ) ; } } return $ result ; }
Get a secure cookie

@param string $name

@return mixed
Get a secure cookie