public __construct ( SplFileInfo | string $file, integer $status = 200, array $headers = [], boolean $public = true, null | string $contentDisposition = null, boolean $autoEtag = false, boolean $autoLastModified = true ) | ||
$file | SplFileInfo | string | The file to stream |
$status | integer | The response status code |
$headers | array | An array of response headers |
$public | boolean | Files are public by default |
$contentDisposition | null | string | The type of Content-Disposition to set automatically with the filename |
$autoEtag | boolean | Whether the ETag header should be automatically set |
$autoLastModified | boolean | Whether the Last-Modified header should be automatically set |
public function __construct($file, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true)
{
parent::__construct(null, $status, $headers);
$this->setFile($file, $contentDisposition, $autoEtag, $autoLastModified);
if ($public) {
$this->setPublic();
}
}
/** * Initialize the response with the file path and the original's file size * The original file's size is very important to prevent the null character padding of the encryption function at the end of the file * which can introduce a slight difference in the filesize wich will break checksums verifications * * @param EncryptionManager $encryptionManager * @param SplFileInfo|string $file * @param int $fileSize * @param int $status * @param array $headers * @param null|string $contentDisposition * @param bool $autoEtag * @param bool $autoLastModified */ public function __construct(EncryptionManager $encryptionManager, $file, $fileSize, $status = 200, $headers = array(), $contentDisposition = null, $autoEtag = false, $autoLastModified = true) { parent::__construct($file, $status, $headers, false, $contentDisposition, $autoEtag, $autoLastModified); $this->setPrivate(); $this->fileSize = $fileSize; $this->encryptionManager = $encryptionManager; }