ZipStream\ZipStream::sendHttpHeaders PHP Method

sendHttpHeaders() protected method

Send HTTP headers for this stream.
protected sendHttpHeaders ( ) : void
return void
    protected function sendHttpHeaders()
    {
        // grab options
        $opt = $this->opt;
        // grab content type from options
        $content_type = 'application/x-zip';
        if (isset($opt[self::OPTION_CONTENT_TYPE])) {
            $content_type = $this->opt[self::OPTION_CONTENT_TYPE];
        }
        // grab content disposition
        $disposition = 'attachment';
        if (isset($opt[self::OPTION_CONTENT_DISPOSITION])) {
            $disposition = $opt[self::OPTION_CONTENT_DISPOSITION];
        }
        if ($this->output_name) {
            $disposition .= "; filename=\"{$this->output_name}\"";
        }
        $headers = array('Content-Type' => $content_type, 'Content-Disposition' => $disposition, 'Pragma' => 'public', 'Cache-Control' => 'public, must-revalidate', 'Content-Transfer-Encoding' => 'binary');
        $call = $this->opt[self::OPTION_HTTP_HEADER_CALLBACK];
        foreach ($headers as $key => $val) {
            $call("{$key}: {$val}");
        }
    }