class File implements ResponseSenderInterface

File response.

Properties

protected FileSystem $fileSystem File system instance.
protected string $filePath File path.
protected int $fileSize File size.
protected string $filename Filename.
protected string $disposition Content disposition.
protected string $contentType Content type.
protected Closure $callback Callback.

Methods

__construct(FileSystem $fileSystem, string $file)

Constructor.

setName(string $name)

Sets the filename.

setDisposition(string $disposition)

Sets the content disposition.

setType(string $type)

Sets the response content type.

done(Closure $callback)

Sets the callback closure.

string
getName()

Returns the filename.

string
getDisposition()

Returns the content disposition.

string
getContenType()

Returns the content type.

array|false
calculateRange(string $range)

Calculates the content range that should be served.

sendFile(int $start, int $end)

Sends the file.

send(Request $request, Response $response)

Sends the response.

Details

at line 93
__construct(FileSystem $fileSystem, string $file)

Constructor.

Parameters

FileSystem $fileSystem FileSytem instance
string $file File path

at line 113
File setName(string $name)

Sets the filename.

Parameters

string $name Filename

Return Value

File

at line 126
File setDisposition(string $disposition)

Sets the content disposition.

Parameters

string $disposition Content disposition

Return Value

File

at line 139
File setType(string $type)

Sets the response content type.

Parameters

string $type Mime type

Return Value

File

at line 152
File done(Closure $callback)

Sets the callback closure.

Parameters

Closure $callback Callback closure

Return Value

File

at line 164
protected string getName()

Returns the filename.

Return Value

string

at line 174
protected string getDisposition()

Returns the content disposition.

Return Value

string

at line 184
protected string getContenType()

Returns the content type.

Return Value

string

at line 195
protected array|false calculateRange(string $range)

Calculates the content range that should be served.

Parameters

string $range Request range

Return Value

array|false

at line 247
protected sendFile(int $start, int $end)

Sends the file.

Parameters

int $start Starting point
int $end Ending point

at line 283
send(Request $request, Response $response)

Sends the response.

Parameters

Request $request Request instance
Response $response Response instance