/** * Constructor. * * @access public * @param string $file File path * @param array $options Options */ public function __construct($file, array $options = []) { $this->fileSystem = $this->getFileSystem(); if ($this->fileSystem->exists($file) === false || $this->fileSystem->isReadable($file) === false) { throw new RuntimeException(vsprintf("%s(): File [ %s ] is not readable.", [__METHOD__, $file])); } $this->filePath = $file; $this->fileSize = $this->fileSystem->size($file); $this->options = $options + ['file_name' => basename($file), 'disposition' => 'attachment', 'content_type' => $this->fileSystem->mime($file) ?: 'application/octet-stream', 'callback' => null]; }