public function matchHeader($name, $pattern = null)
    {
        if (isset($this->getHeaders()[$name])) {
            if (!empty($pattern)) {
                if ($this->matchValue($this->getHeaders()[$name], $pattern)) {
                    return $this->getHeaders()[$name];
                }
            } else {
                if (empty($this->getHeaders()[$name])) {
                    return true;
                } else {
                    return $this->getHeaders()[$name];
                }
            }
        } elseif ($pattern == '?') {
            // in case of optional pattern we just return true
            return true;
        }

        return false;
    }