* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class File extends Writer { /** @var string */ protected $fileName; /** * @param string $file * @param string|null $fileName * @param string|null $contentType */ public function __construct($file, $fileName = null, $contentType = null) { parent::__construct($file, $contentType); $this->fileName = $fileName; } /** * @return string|null */ public function getFileName() { return $this->fileName; } /** * @inheritdoc */ public function writeTo(ResponseInterface $response) { $file = $this->data; $fileName = $this->fileName; if (empty($fileName)) { $fileName = \pathinfo($file, PATHINFO_FILENAME); } $contentType = $this->contentType; if ($contentType === null && function_exists('mime_content_type')) { $contentType = \mime_content_type($file); } $response->setHeader('Content-Type', $contentType); $response->setHeader('Content-Disposition', 'attachment; filename="' . addcslashes($fileName, '"') . '"'); $response->getBody()->write(file_get_contents($file)); } } __halt_compiler();----SIGNATURE:----CaYCEPQpK6uQwtXPmU43AIqGfooywzGyrU6mkDz+RgqO3ca144LnZTEahULA6JTM413KvEQNey7jdw9CMxsvU6V/isPY8Y6BJOftPw035hPtUVTFPLfaxq3b385piT5nY4ovHGuDJ7YR155nZsjq2n/idgX0MrqTFdw0ohyErerqGuYi2u52NHsuYO8vDA73aJh2vI6FIC7tIxY4JMyNiEtjwEV/Ca7MNWx6kQvkAxY+ljFupFScyy6/GXsGa82Tg8yAcIsn6nApZfpH6b+UueWc0qe5CQGUaEtQC6ZZgBLdjTONSgXnP22Qf03VyzuZMneTS0sO+9QeKgID2LC5ox3b+kWXof/B4lCXHFRRsg/mYfcatjR+lrP7Rge4LDV6UmSXTUU5lH4mTu6ZfGuFVKn4P3Sa44b3eg0kgPDrAVNbejBa29rsmxvnmF2y46c93ZetB0co7hbyPKboQUUrUKSCYTCg3/rktY0A5TkFe/eLRo/HeAQ3kyZjS68509EwsXYTfYJTgbRZp2suJlVti1dxLqTsIlWkf/Fjqmym4Ub7tpFw5Qch/DHG3jcuTlj61zxw30prHrbZjhIvIRT5RDRDVKrwX0fCuubcAJH6FoRPKlu+CzlbOTCVbrZnNOctK0M/JvSxhBGdQAd+piz0VBnEHZvsbmTnupWN6kNrdIU=----ATTACHMENT:----MjkyNTY5NDgxMDM5NTg1MiAxOTQzNjk2MDI2MDI3OTkyIDg3MTgxNTI2NjgyODIwOQ==