public function isSecure()
    {
        if ($proto = (string) $this->header->get('x_forwarded_proto')) {
            return in_array(strtolower(current(explode(',', $proto))), ['https', 'on', 'ssl', '1']);
        }

        return strtolower($this->server->get('HTTPS')) == 'on' || $this->server->get('HTTPS') == 1;
    }