<?php
namespace Engine\Mvc\Response; class FileDownload extends GeneralAbstract { protected $filename = null; protected $filesize = null; public $compressionMethod = null; protected function initialize($body, array $headersArr) { $this->body = new Components\Body($body); $this->headers = new Components\Headers($headersArr); $this->headers->append("Cache-Control", "must-revalidate, no-store, no-cache"); $this->generateDownloadHeaders(); if ($this->body->hasContent()) { $this->setFilesize(strlen($this->body->get())); } } public function setFilename($filename) { $this->filename = $filename; $this->headers->append('Content-Disposition', sprintf('attachment; filename="%s";', $this->filename)); } public function setFilesize($filesize) { $this->filesize = $filesize; $this->headers->append('Content-Length', $this->filesize); } protected function generateDownloadHeaders() { } } 