public static function toArray($value)
    {
        $data = [];

        $cookies = $value ? explode(';', $value) : [];
        foreach ($cookies as $cookie) {
            list($name, $value) = explode('=', $cookie);
            $name = trim($name);
            $value = urldecode($value);
            if (!isset($data[$name])) {
                $data[$name] = $value;
            }
        }
        return $data;
    }