public function getCookie($key, $domain = '-')
    {
        $domain = strtolower($domain);
        if ($key === null) {
            $cookies = [];
        }
        while (true) {
            if (isset($this->_cookies[$domain])) {
                foreach ($this->_cookies[$domain] as $path => $list) {
                    if ($key === null) {
                        $cookies = array_merge($list, $cookies);
                    } else {
                        if (isset($list[$key])) {
                            return rawurldecode($list[$key]['value']);
                        }
                    }
                }
            }
            if (($pos = strpos($domain, '.', 1)) === false) {
                break;
            }
            $domain = substr($domain, $pos);
        }
        return $key === null ? $cookies : null;
    }